Repository navigation
Keep Base64 polyfills when Microsoft.Bcl.Memory is referenced - #665
Merged
Merged
Conversation
This was referenced Oct 12, 2026
This was referenced Oct 13, 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.
Bug
Base64Polyfill.cswas guarded with#if FeatureMemory && !RefsBclMemory && !NET11_0_OR_GREATER.Microsoft.Bcl.MemorysuppliesBase64Url,IndexandRange, but it does not (and cannot) add the net11 static members toSystem.Buffers.Text.Base64. So referencing that package silently removed 13 polyfills (Base64.EncodeToString,EncodeToChars,DecodeFromChars,TryDecodeFromChars,GetEncodedLength, ...) with nothing replacing them.PolyfillLibreferencesMicrosoft.Bcl.Memorybelow net9, so the compiled library shipped without them on those targets.The same
!RefsBclMemorycondition aroundBase64Usageinsrc/Consume/Consume.cshid this:ConsumeLibcompiles that file againstPolyfillLiband inherits the package reference, so the usage was compiled out exactly where the API was missing.Fix
Remove
!RefsBclMemoryfrom theBase64Polyfill.csguard and from theBase64Usageguard inConsume.cs.Test
These are compile-time consumers, so the coverage is compilation:
Consume.csBase64Usageis now compiled byConsumeLib/ConsumeEmbeddedLibagainstPolyfillLibon every targetConsumeBclMemoryNoResolve/Consume.cs(source-only Polyfill plus aMicrosoft.Bcl.Memoryreference) now callsBase64.EncodeToString,Base64.DecodeFromCharsandBase64Url.EncodeToStringBefore regenerating
src/Splitboth failed withCS0117: 'Base64' does not contain a definition for 'EncodeToString'(and the other members). After the fixConsumeBclMemoryNoResolve,ConsumeBclMemoryExcludeCompile,ConsumeConsumeBclMemory(which buildsConsumeBclMemory),ConsumeLib,ConsumeEmbeddedLibandConsumebuild on all their target frameworks with 0 warnings.