Refine JsonIgnoreAttribute semantics when used in conjunction with other attributes. #59364
Labels
area-System.Text.Json
enhancement
Product code improvement that does NOT require public API changes/additions
Priority:3
Work that is nice to have
Milestone
The
JsonIgnoreAttribute
is a mechanism intended to prevent serialization or deserialization of a given property. However, users might sometimes apply the attribute with the expectation that it can be used to suppress serializer errors if the property in question has been misconfigured. This is not the case, and the handling of such scenaria in System.Text.Json is largely undefined behavior.That behavior can be inconsistent depending on the combination of attributes, and changes can result in broken applications like the one reported in #58469 (comment). In future releases we should try to ensure consistent semantics of the
JsonIgnoreAttribute
(e.g. by making that attribute suppress every other attribute) in both the reflection-based serializer and the source generator.The text was updated successfully, but these errors were encountered: