Repository navigation
Keep conditional guards on split type forwards - #725
Merged
Merged
Conversation
The splitter moved TypeForwardedTo lines into TypeForwardeds.cs without the preserved #if blocks around them, so the Base64Url forward lost its !RefsBclMemory guard. Microsoft.Bcl.Memory 11.0.0 has no net9.0 build, so on net9.0 its netstandard2.1 Base64Url clashed with the in-box type (CS0433). Forwards now keep the guards they had in the source, grouped by guard in TypeForwardeds.cs.
This was referenced Nov 23, 2026
Closed
This was referenced Nov 23, 2026
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
The first build on the .NET 11 GA SDK fails on
ConsumeBclMemoryfornet9.0:Microsoft.Bcl.Memory11.0.0 dropped itsnet8.0andnet9.0builds (10.0.14 had both). Anet9.0project now gets the package'snetstandard2.1build, which defines its ownBase64Url, and that clashes with the one built into .NET 9.src/Polyfill/Base64Url.csalready handles this: the whole file, including the forward, is behind#if FeatureMemory && !RefsBclMemory. But when the splitter movesTypeForwardedTolines into the combinedTypeForwardeds.cs, it copies just the line and drops the#ifblocks around it. SoSplit/net9.0/TypeForwardeds.csforwardedBase64Urlunconditionally.This affects consumers as well as CI. The shipped Split files have the same unguarded line, so any
net9.0project that referencesMicrosoft.Bcl.Memory11.0.0, directly or through another package, fails to compile even if it never usesBase64Url.Fix
Splitter.ExtractTypeForwardswalks the processed lines with a directive stack. Each forward it lifts out records the guard formed by the#ifblocks around it. A forward in an#elifor#elsebranch also gets the earlier branch conditions, negated.Splitter.BuildTypeForwardedsLineslists unguarded forwards first, then one#if … #endifblock per guard.src/Split/*/TypeForwardeds.csfiles. Each framework has exactly the same set of forwards as before; only the guards and order changed. 15 other forwards had also lost aFeatureMemory,FeatureValueTuple && !RefsBclMemory(Index/Range) or similar guard; they have them back.Verification
SplitterTestscover:Base64Urlcase#elif/#elsenegation and nested blocksnet9.0file keeps theMicrosoft.Bcl.Memoryguard onBase64UrlApiBuilderTests(Debug): 92/92 pass.ConsumeBclMemorybuilds for every framework againstMicrosoft.Bcl.Memory11.0.0. With the oldnet9.0file restored, it fails with the sameCS0433.dotnet build src/Polyfill.slnx --configuration Release: 0 errors, 0 warnings.run-tests.ps1not run locally.