Closed neon-sunset closed 2 weeks ago
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis See info in area-owners.md if you want to be subscribed.
I believe this is covered under #100144.
Ah, my bad, I tried searching for issues and could not find an appropriate one. Thanks.
Note that non-nullable element types are out of scope for https://github.com/dotnet/runtime/issues/100144, due to restrictions in their run-time representation.
Note that non-nullable element types are out of scope for #100144, due to restrictions in their run-time representation.
I see. Could there be a possibility of that changing in the future? (perhaps for source-generated serialization only?)
Note that non-nullable element types are out of scope for #100144, due to restrictions in their run-time representation.
I see. Could there be a possibility of that changing in the future? (perhaps for source-generated serialization only?)
Unlikely. The serialization infrastructure is shared between reflection and source gen and both key they contracts on Type
, which cannot distinguish between List<string>
and List<string?>
.
Description
It appears that
System.Text.Json
treats the following objects in the same way:Reproduction Steps
Expected behavior
Serializer throws an exception
Actual behavior
The "unreachable" exception is thrown
Regression?
No
Known Workarounds
Using custom converter
Configuration
.NET 8.0.3
Other information
No response