Background
PR #10976 currently merges generated, last-contract, and custom-code type attributes locally in CanonicalTypeProvider.BuildAttributes(). This keeps the provider reference-map/pre-write internalization work scoped, but the back-compat behavior would be clearer and more consistent if it followed the existing centralized TypeProvider back-compat pattern.
Proposed cleanup
Add a TypeProvider-level API, such as BuildAttributesForBackCompatibility, that handles:
- restoring compatible attributes from the last contract,
- merging generated and custom-code attributes,
- filtering CodeGen-specific attributes that should not be preserved,
- deduplicating attributes consistently.
Then update CanonicalTypeProvider to use that shared API instead of owning this local merge/deduplication logic.
Notes
This was raised as a non-blocking review follow-up in PR #10976: #10976 (comment)
Background
PR #10976 currently merges generated, last-contract, and custom-code type attributes locally in CanonicalTypeProvider.BuildAttributes(). This keeps the provider reference-map/pre-write internalization work scoped, but the back-compat behavior would be clearer and more consistent if it followed the existing centralized TypeProvider back-compat pattern.
Proposed cleanup
Add a TypeProvider-level API, such as BuildAttributesForBackCompatibility, that handles:
Then update CanonicalTypeProvider to use that shared API instead of owning this local merge/deduplication logic.
Notes
This was raised as a non-blocking review follow-up in PR #10976: #10976 (comment)