Repository navigation
fix(csharp): evaluate with the global.json-pinned SDK, not the machine default - #360
Merged
Merged
Conversation
…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.
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.
Problem
On machines whose default .NET SDK is newer than a repo's
global.jsonpin — 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 (duplicateCompileitems, unresolvable project references), while a plaindotnet buildof the same solution succeeds.Root cause:
dotnet buildresolves the SDK pinned byglobal.jsonfrom the muxer, but the helper registered MSBuild from the machine's default SDK (MSBuildLocator only reports the muxer default).RequiredSdkMajorFloorused the pin only as a major floor, so the higher RC SDK qualified.Fix
TryRegisterMsBuildnow resolves the pin the way the muxer would, viadotnet --list-sdks:and registers that SDK's own MSBuild (
MSBuildLocator.RegisterMSBuildPath, plusMSBUILD_EXE_PATHfor 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-sdksparsing incl. prerelease lines, the rollForward ladder). Suite 126 passed; app csproj builds clean.