Open alankbi opened 9 months ago
Regardless of whether this is a bug or known limitation with XMLSerializer, is there a workaround to force validation for all unknown attributes? These attributes get dropped during deserialization, so I also can't perform a post-deserialization check on the resulting objects.
Have you considered implementing IXmlSerializable
?
Description
When parsing the following XML:
Into the following classes:
XMLSerializer's Deserialize function correctly fires an UnknownAttribute event. However, for the following XML:
And classes:
No event is fired for the unknown attribute on either the list or the string field.
Reproduction Steps
Using the XML and classes above, run the following code to verify that
HandleUnknownAttribute
is not called when erroneous attributes are present on string or list fields (or any built-in type it seems, including ints, bools, etc.):Expected behavior
An UnknownAttribute event should be fired and the event handler called
Actual behavior
No event is fired
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response