Skip to content

.NET 11 fails to decode certain base64 inputs #133495

Description

@JustArchi

Description

I've observed a serious regression in one of my unit tests after updating the project to target .NET 11. I've isolated minimal reproducible one-liner in the meantime to aid debugging.

Reproduction Steps

dotnet new console, then in Program.cs:

Console.WriteLine($"OK: {Convert.FromBase64String("KDHC3rsY8+CmiswnXJcE5e5dRfd=").Length}");

Expected behavior

Should work fine with OK: 20 output, which is the case when running this against <TargetFramework>net10.0</TargetFramework>

Actual behavior

Unhandled exception. System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
   at System.Buffers.Text.Base64.DecodeFromChars(ReadOnlySpan`1 source)
   at Program.<Main>$(String[] args) in Program.cs:line 1

Happens with <TargetFramework>net11.0</TargetFramework>

As a side note, not every valid base64 input results in this regression, but I've found at least one that does, which you can hardcode for unit test later on if deemed wanted.

Regression?

Yes, worked fine in .NET 10

Known Workarounds

None for now.

Configuration

.NET SDK:
 Version:           11.0.100-rc.1.26425.128
 Commit:            3551975be0
 Workload version:  11.0.100-rc.1.26458.5
 MSBuild version:   18.11.0-1.26425.128+3551975be

Runtime Environment:
 OS Name:     debian
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/11.0.100-rc.1.26425.128

.NET workloads installed:
Brak zainstalowanych obciążeń do wyświetlenia.
Skonfigurowano używanie workload sets podczas instalowania nowych manifestów.

Host:
  Version:      11.0.0-rc.1.26425.128
  Architecture: x64
  Commit:       3551975be0

.NET SDKs installed:
  11.0.100-rc.1.26425.128 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 10.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 11.0.0-rc.1.26425.128 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 10.0.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 11.0.0-rc.1.26425.128 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_CLI_TELEMETRY_OPTOUT              [true]
  DOTNET_NOLOGO                            [true]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Other information

I don't see any user error, neither a mention in the changelog regarding that - especially considering this is a valid base64 input that worked before.

I'd recommend to take a look into it before full release, as it seems rather serious to me and is a blocker right now for several of my projects.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions