Skip to content

[dotnet-svcutil] defer known types import to resolve IsReference inheritance issue #5810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

imcarolwang
Copy link
Contributor

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:

  • Add _deferredKnownTypesImport list to collect types requiring known types import
  • Defer known types import until after all main types are imported
  • Process deferred known types after inheritance chains are fully established
  • Ensure IsReference property propagates correctly through inheritance hierarchy

This ensures that inheritance-based property propagation works correctly by processing known types only after the complete type hierarchy is established.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReferencedTypeDoesNotMatch thrown on correct DataContract
1 participant