[dotnet-svcutil] defer known types import to resolve IsReference inheritance issue#5810
[dotnet-svcutil] defer known types import to resolve IsReference inheritance issue#5810imcarolwang wants to merge 1 commit intodotnet:mainfrom
Conversation
|
Is this a fix for an issue which also exists on .NET Framework? You've added code that doesn't exist on .NET Framework so I would presume so, but wanted to check first. |
Yes, I think the issue should also exist on .NET Framework. The bug is in the serialization logic, an inheritance timing issue where IsReference property isn't properly set before DataContract equality comparisons occur during referenced assembly type reuse. The fix has been validated with dotnet-svcutil using the original repro app provided in the reported issue. While I couldn't reproduce it on .NET Framework due to validation challenges:
|
|
Update |
Fixes #5769: The DataContract IsReference property was incorrectly set to false for some derived types when known types and inheritance were involved. This led to a mismatch between the imported DataContract type and the referenced type, which caused issues when trying to reuse the referenced types.
Root cause: ImportKnownTypes(typeName) was called immediately after importing each type, which could import derived types as known types before their base types were fully processed, causing inheritance-based IsReference propagation to fail.
Solution: Implement deferred known types import strategy:
This ensures that inheritance-based property propagation works correctly by processing known types only after the complete type hierarchy is established.