Skip to content

fix(csharp): evaluate with the global.json-pinned SDK, not the machine default - #360

Merged
flupkede merged 1 commit into
developfrom
fix/scip-csharp-honor-global-json
Oct 20, 2026
Merged

flupkede merged 1 commit into
developfrom
fix/scip-csharp-honor-global-json

Conversation

@flupkede

Copy link
Copy Markdown
Owner

Problem

On machines whose default .NET SDK is newer than a repo's global.json pin — Isaac's VS2026 RC machine, whose default is the .NET 11 RC against repos pinned to 10.x — the scip-csharp helper degraded every symbol index with ~11 workspace evaluation failures (duplicate Compile items, unresolvable project references), while a plain dotnet build of the same solution succeeds.

Root cause: dotnet build resolves the SDK pinned by global.json from the muxer, but the helper registered MSBuild from the machine's default SDK (MSBuildLocator only reports the muxer default). RequiredSdkMajorFloor used the pin only as a major floor, so the higher RC SDK qualified.

Fix

TryRegisterMsBuild now resolves the pin the way the muxer would, via dotnet --list-sdks:

  1. exact pinned version, else
  2. highest same major.minor (the default rollForward band), else
  3. highest same major,

and registers that SDK's own MSBuild (MSBuildLocator.RegisterMSBuildPath, plus MSBUILD_EXE_PATH for the BuildHost). Discovery stays the fallback when nothing matches or the probe fails; prerelease pins (11.0.0-rc.1) compare on their numeric prefix.

Tests

6 new unit tests (pin walk incl. nearest-file-stops semantics, --list-sdks parsing incl. prerelease lines, the rollForward ladder). Suite 126 passed; app csproj builds clean.

…e default

dotnet build resolves the SDK pinned by global.json from the muxer; the
helper registered MSBuild from whatever SDK was the machine's default.
When the default is NEWER than the pin — Isaac's VS2026 RC machine,
whose default is the .NET 11 RC against repos pinned to 10.x — every
project evaluated under the wrong SDK: duplicate Compile items,
unresolvable project references, 11 workspace failures, degraded symbol
index — while a plain dotnet build of the same solution succeeds.

TryRegisterMsBuild now resolves the pin the way the muxer does: exact
version, then highest same major.minor (default rollForward band), then
highest same major, registering that SDK's own MSBuild; discovery stays
the fallback when nothing matches or the probe fails. Prerelease pins
(11.0.0-rc.1) compare on their numeric prefix.

Reported on HUSQ.Aprimo (features/243800_Warranty_documents): csharp
symbol index degraded, 11 distinct failures.
@flupkede
flupkede merged commit eeb8e89 into develop Oct 20, 2026
7 checks passed
@flupkede
flupkede deleted the fix/scip-csharp-honor-global-json branch October 22, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant