serialization: Allow enums when no type filter has an opinion - #10234
Merged
Merged
Conversation
Contributor
Author
|
I thought about adding this as a new, internal |
Tragetaschen
force-pushed
the
fix-enum-handling
branch
from
June 18, 2026 15:00
44f410c to
83a169c
Compare
The TypeConverter rewrite in 10.2.0 (dotnet#10032) split InspectType into a bool? core and a bool wrapper and changed the call sites from "throw on explicit deny" (== false) to "throw unless explicitly allowed". That flipped filter silence from allow to deny, so any enum that is not in TypeManifestOptions.AllowedTypes and matched by no filter now fails type validation, even though enums need no registration to round-trip. Enums carry no behavior and are serialized through their underlying integral type, so they cannot act as deserialization gadgets. Treat a filter-silent enum as allowed while still honoring an explicit filter deny, which short-circuits before this check. Fixes dotnet#10227.
ReubenBond
force-pushed
the
fix-enum-handling
branch
from
June 30, 2026 22:15
83a169c to
68860f4
Compare
ReubenBond
approved these changes
Jun 30, 2026
ReubenBond
enabled auto-merge
June 30, 2026 22:16
ReubenBond
disabled auto-merge
July 1, 2026 21:10
This was referenced Jul 22, 2026
This was referenced Jul 29, 2026
This was referenced Jul 29, 2026
Merged
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The TypeConverter rewrite in 10.2.0 (#10032) split InspectType into a bool? core and a bool wrapper and changed the call sites from "throw on explicit deny" (== false) to "throw unless explicitly allowed". That flipped filter silence from allow to deny, so any enum that is not in TypeManifestOptions.AllowedTypes and matched by no filter now fails type validation, even though enums need no registration to round-trip.
Enums carry no behavior and are serialized through their underlying integral type, so they cannot act as deserialization gadgets. Treat a filter-silent enum as allowed while still honoring an explicit filter deny, which short-circuits before this check. Fixes #10227.
Microsoft Reviewers: Open in CodeFlow