JsonPropertyOrderAttribute
and fast-path serialization
#99869
Replies: 1 comment
-
Transfered to issue dotnet/docs#40051 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The documentation here lists
JsonPropertyOrderAttribute
as unsupported for fast-path serialization.I've been browsing the code in the emitter and parser and it doesn't seem like that's really the case. The properties are sorted by order if an order has been specified and the
HasInvalidConfigurationForFastPath
flag doesn't look like it's set as a result of this. Following through,FastPathPropertyIndices
should therefore have a value and, assuming nothing else incompatible, the object should be eligible for a fast path delegate when emitted.I know that fast-path requires some other things like a certain set of options... However order isn't so much an option, but rather more a part of the metadata.
Am I missing something? Is
JsonPropertyOrderAttribute
really unsupported in fast path? Or is this a documentation bug?If it's truly unsupported, can I ask what about it makes it so? It seems like the properties need to be emitted in some order and even in the precense of attributes that that order should be known at compile / generated context emitting time. I understand why things like
JsonConverterAttribute
are unsupported since they essentially change what code gets executed at runtime and can be classified as "unknowns". But property order from attributes should be static and safe here.Cc: @eiriktsarpalis
Beta Was this translation helpful? Give feedback.
All reactions