Skip to content

chore: use Union types instead of OneOf library based implementation when targeting .NET 11 - #11182

Merged
vicancy merged 6 commits into
dotnet:mainfrom
filzrev:chore-use-union-types-on-net11
Sep 25, 2026
Merged

vicancy merged 6 commits into
dotnet:mainfrom
filzrev:chore-use-union-types-on-net11

Conversation

@filzrev

@filzrev filzrev commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

This PR contains following changes.

  1. Add net11.0 target framework (.NET 11 RC is released with go-live license)
  2. Replace OneOf library based implementation to use C# 15 union types when targeting net11.0.

Note: As commented at following lines.

// NOTE:
// This is a pretty slow implementation by attempting to deserialize into every possible union case.
// It also depends on marking discriminator properties as required.
foreach (var (type, cast) in s_types)

Existing OneOf based implementation is too slow (Especially when running under debugger)

@filzrev
filzrev force-pushed the chore-use-union-types-on-net11 branch from 8cffcc9 to ac7744d Compare September 24, 2026 14:09
@vicancy
vicancy merged commit ba844df into dotnet:main Sep 25, 2026
20 checks passed
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.

2 participants