Repository navigation
.NET extraction: shared NuGet locks, failing placeholder inputs, first-error summaries, host-only dotnet-di, workload skips - #416
Open
agorischek wants to merge 3 commits into
Open
agorischek wants to merge 3 commits into
agorischek wants to merge 3 commits into
Conversation
…rror summaries, host-only dotnet-di, workload skips - Every .NET extraction shares one NUGET_SCRATCH under the NuGet home, so concurrent restores into one packages folder see each other's locks. - A sweep fails a change whose declared input exists at neither revision nor in the working tree; explore proposes efcore-schema for the DbContext's project. - Sweep summaries give the first error line, and .NET extractors lead a missing SDK with the version global.json requests. - explore proposes dotnet-di only for programs that build a host, never for test, fuzz or benchmark projects. - nuget-dependencies skips projects needing a missing workload with a limitation. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues leave shared NuGet caches vulnerable to restore races, can misreport the first build error, and allow PascalCase test projects to be proposed for dotnet-di.
3 open issues
What changed in this PR
Improves .NET extraction reliability, project discovery, and failure reporting across the extractors and CLI.
Changes:
- Adds shared NuGet locking and skips projects requiring unavailable workloads.
- Refines host detection and proposes EF Core extraction for actual projects.
- Rejects missing placeholder inputs and improves SDK and sweep error summaries.
| File | Description |
|---|---|
packages/extractors/nuget-dependencies/tests/restore.rs |
Tests workload skips and all-skipped failures. |
packages/extractors/nuget-dependencies/src/lib.rs |
Skips workload-dependent projects with limitations. |
packages/extractors/nuget-dependencies/README.md |
Documents workload handling. |
packages/extractors/dotnet-support/src/toolchain.rs |
Adds shared scratch selection and SDK diagnostics. |
packages/extractors/dotnet-support/src/tests.rs |
Tests scratch configuration and SDK errors. |
packages/extractors/dotnet-support/README.md |
Explains shared NuGet locking. |
packages/cli/tests/authoring.rs |
Gives the EF Core fixture a project. |
packages/cli/src/sweep/tests.rs |
Tests failure summaries and missing inputs. |
packages/cli/src/sweep/run.rs |
Fails cells with nonexistent declared inputs. |
packages/cli/src/sweep/reason.rs |
Extracts failure reasons and diagnostic context. |
packages/cli/src/sweep/mod.rs |
Integrates the new summary logic. |
packages/cli/src/explore/dotnet.rs |
Refines host detection and EF Core proposals. |
packages/cli/src/explore.rs |
Passes repository context to .NET discovery. |
changelog.d/416.md |
Records user-visible fixes. |
Review effort: Balanced
…atch beside an explicit packages folder - explore splits PascalCase names into words, so ApiTests and HTTPFuzz are harnesses while Contest isn't. - A failed sweep cell keeps the reason chosen from the whole stderr, so a first error before the kept tail still names the failure; a timeout stays the reason. - Without a NuGet home, a granted NUGET_PACKAGES folder holds the shared NuGet scratch folder, so concurrent restores into it still share locks. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changed
Fixes five .NET extraction problems that setup trials on large .NET repositories turned up.
TMPDIR, and the .NET extractors give each a privateDOTNET_CLI_HOME. NuGet keeps the cross-process locks that make concurrent restores take turns extracting a package inNUGET_SCRATCH/lock. That folder defaults to$TMPDIR/NuGetScratch<user>, or on newer Linux NuGet to the NuGet home underDOTNET_CLI_HOME, and both are private per extraction. So parallel extractions sharing one packages folder never saw each other's locks: one deleted another's half-written package file (Could not find file '<packages>/<id>/<version>/gubdyv4y.32d').Dotnet::newnow setsNUGET_SCRATCHto one folder for all of the user's extractions,.nuget/projections-scratchunder the NuGet home, unless the definition grantsNUGET_SCRATCH. This coversdotnet-di,dotnet-public-api,efcore-schemaandnuget-dependencies. The dotnet-support README wrongly said concurrent restores were safe; it now explains this.src/App/App.csproj). It says: "Declared inputsrc/App/App.csprojdoesn't exist in the working tree or at either revision. Fix the projection's inputs". An input added after older revisions still reads as absent there, as before. Separately, explore proposesefcore-schemaonce per project that holds aDbContext(the nearest enclosing.csproj), withinputs.projectset, instead of the template's placeholder.failure_reasonused stderr's last line. It now takes the first error line (error CS…:,… : error NU1101:,…Exception:), skipping one that only introduces the next. Failing that, it uses the extractor's own report when that says more than how the process exited, then the last line. The lines under the summary show the details after the reason, or what led up to it when it's last. The .NET extractors also lead a missing SDK with what global.json requests: "A compatible .NET SDK was not found: the repository's global.json requests SDK 10.0.0…". dotnet's own wording varies by command;dotnet nugetputs it under "The command could not be loaded, possibly because:". The reason logic moved tosweep/reason.rsto keepsweep/mod.rsunder the complexity limit.Program.cs/Startup.csbuilds a host or service collection (HostBuilder,Host.Create,WebApplication,WebHost,ServiceCollection,ConfigureServices,UseStartup), or its project uses the Web or Worker SDK or referencesMicrosoft.Extensions.HostingorMicrosoft.AspNetCore. Test, fuzz and benchmark projects (by path or name words) are never proposed.NETSDK1147(missing workload) orNETSDK1139(unrecognized platform) is skipped. A limitation names it and gives the workload message without checkout paths. The extraction fails only if every project needs a missing workload.Out of scope, unchanged: default timeouts, how dotnet-di invokes Main, explore candidate ID naming, and nuget-dependencies grouping.
Evidence
Race reproduced and fixed, by direct experiment (.NET SDK 11.0.100). I ran 6 concurrent
dotnet restores × 4 rounds, each with its ownTMPDIRandDOTNET_CLI_HOME, sharing a freshNUGET_PACKAGES. Without a shared scratch, 24/24 failed with the same signature (Could not find file '…/microsoft.aspnetcore.app.ref/8.0.34/xm3aqsfz.fgm',Directory not empty). With a sharedNUGET_SCRATCH, 0/24 failed.End to end with a debug CLI on a synthetic repository (web API, worker, MAUI
net11.0-androidproject, SharpFuzz harness,DbContextlibrary; 6 commits):explore --listproposeddotnet-di-apianddotnet-di-workerbut not the fuzz harness, andefcore-schema-datawithsrc/Data/Data.csproj.explore --sweep --trust --concurrency 4with a fresh shared packages folder: allnuget-dependenciescells succeeded, with the MAUI project skipped in every revision, using the real NETSDK1147 output.efcore-schemadefinition failed on 5 of 5 changes with the message above.global.jsonrequesting 10.0.0, the summary readA compatible .NET SDK was not found: the repository's global.json requests SDK 10.0.0…, where it used to showhttps://aka.ms/dotnet/sdk-not-found.cargo test -p projections-extractor-dotnet-support --lib: 9 passed (new: shared scratch, missing SDK)cargo test -p projections-extractor-nuget-dependencies: passed (new: workload skip)cargo test -p projections-cli --lib -- sweep:: explore::: 58 passed (new: first-error reason, absent inputs, host-only dotnet-di, efcore project)cargo test -p projections-cli --test authoring -- adopting_writes_definitions_and_bookmarks explore: 6 passed. The adopt test now gives itsDbContexta project, so explore still proposes efcore-schema there.Review follow-ups (7e8265e):
ApiTests,HTTPFuzz) are detected.NUGET_PACKAGESfolder holds the shared scratch folder.cargo test -p projections-cli --lib -- sweep:: explore::: 59 passed.cargo test -p projections-extractor-dotnet-support --lib: 9 passed.cargo clippy -p projections-cli -p projections-extractor-dotnet-support -p projections-extractor-nuget-dependencies --all-targets -- -D warnings: cleannpm run tools -- check --fast: passNot run locally: the opt-in native .NET extractor suites, other platforms, and the full
tools check/tools test. They're left to CI because of sandbox disk limits.Documentation that this change affects is updated, and generated reference
pages are regenerated (
npm run docs:generate).Fixes include a regression test.
A changelog fragment at
changelog.d/<this PR's number>.mddescribes whatusers will notice, or the PR has the
no changeloglabel (seechangelog.d/README.md).
No credentials, private source or machine-specific paths are included.