Description
Describe the bug
When an object from a WCF API is deserialized, if that API has a new property that does NOT exist in the model, all data in the document after that property is not loaded, even if it exists in the model.
If a property has the [XmlAnyElement] attribute, all unread values are saved there (even though the model DOES have those attributes).
All properties are loaded correctly even though the XML does not include the property that triggers the error.
An important detail is that if a base object has the [XmlAnyElement] property, all classes that inherit from it are NOT deserialized; all their values are hijacked by the attribute, even if an Order value is set to very high.
Using DataContract is not a viable option, as svcutil generates numerous errors when using that serializer (all are of this type).
Warning: The optional WSDL extension element "body" from the namespace "http://schemas.xmlsoap.org/wsdl/soap12/" was not handled.
XPath: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='NetHttpBinding_IWebServiceHttp']/wsdl:operation[@name='TaskNewChange']/wsdl:output
To Reproduce
Steps to reproduce the behavior:
-
Create an API with the netTcpBinding protocol in .NET 4.5 with a method that returns an object with multiple properties.
-
In a .NET Maui version 9 project, add the reference to the WCF service.
-
Modify the API of the first project to add a new, optional, nullable property (ordered among the other properties, so that the new property isn't last).
-
(WITHOUT updating the references) When calling the API from the Maui project, when loading the data, ALL the properties that were after the new property are NOT loaded.
Expected behavior
New node values from the XML that do not exist in the model should be ignored or stored in the property with the [XmlAnyElement] attribute and respecting inheritance. Since a Base object hijacks values and should not
Screenshots
Cut of the XML response.
<Row i:nil="true"></Row>
<Seeds i:nil="true"></Seeds>
</TrialItemVariety>
</TrialItemVarieties>
<WaterEC></WaterEC>
<WetDate i:nil="true"></WetDate>
<Zone i:nil="true"></Zone>
</TrialItem>
</Items>
<PreparationInstructions i:nil="true"></PreparationInstructions>
<Remarks>Example value</Remarks>
<Season>Winter</Season>
<State>Planning</State>
<Technical i:nil="true"></Technical>
<Time i:nil="true"></Time>
<TrialLot></TrialLot>
<TrialVarieties>
<TrialVariety>
<Extractions></Extractions>
<Id>c53f3a22-c9b0-4b90-b62c-fc3a0bcf9875</Id>
<IdAccession>69528d60-ca21-4412-a2b2-d087337fbf60</IdAccession>
<IdTrialExtra>14687ec7-b19e-499b-809f-0a6c8abcf7c2</IdTrialExtra>
</TrialVariety>
Look que end node (Items has values inside)
Look PreparationInstructions it's the new property not in model
Look Remarks and Season has value
Look TrialVarieties has items inside
Look State Planning it's not load (this value it's the default)

Adding to the model a property with XmlAnyElement all nodes after the missing it's added to XmlAnyElementProperty and not loaded

Additional context
It is important that the data loading is robust, since an API can be updated with optional parameters and that should not break the loading.