You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider adding attributes to the list of supported backcompat scenarios #11232
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.
This is a refactoring/cleanup request to centralize type attribute back-compat merging logic into a shared TypeProvider-level API, rather than keeping it local to CanonicalTypeProvider.BuildAttributes().
Current behavior: CanonicalTypeProvider.BuildAttributes() locally handles merging of generated, last-contract, and custom-code type attributes.
Proposed improvement: Extract this logic into a TypeProvider.BuildAttributesForBackCompatibility() API to centralize responsibility and follow existing back-compat patterns.
Scope: Internal refactor — no user-facing behavior change expected. Improves code consistency and maintainability in the C# emitter.
Affected components: CanonicalTypeProvider, TypeProvider in http-client-csharp.
📝 Suggested next steps
Implement BuildAttributesForBackCompatibility on TypeProvider handling restore, merge, filter, and deduplication
Update CanonicalTypeProvider.BuildAttributes() to delegate to the new shared API
Verify existing tests pass; add tests for the new API if needed
Attributes can be part of the public surface, but we should consider if the generator should actually make the decision of re-adding them back if they are missing from the current version. Maybe we start with an allow list of known attributes that can be added back, and eventually let that be extensible for downstream plugins ?
changed the title [-]Centralize type attribute back-compat merging in C# generator[/-][+]Consider adding attributes to the list of supported backcompat scenarios[/+]on Jul 15, 2026
Activity
github-actions commentedon Jul 13, 2026
🎯 Issue Triage
This is a refactoring/cleanup request to centralize type attribute back-compat merging logic into a shared
TypeProvider-level API, rather than keeping it local toCanonicalTypeProvider.BuildAttributes().Category: Feature Request
Area:
emitter:client:csharp🔍 Analysis
CanonicalTypeProvider.BuildAttributes()locally handles merging of generated, last-contract, and custom-code type attributes.TypeProvider.BuildAttributesForBackCompatibility()API to centralize responsibility and follow existing back-compat patterns.CanonicalTypeProvider,TypeProviderinhttp-client-csharp.📝 Suggested next steps
BuildAttributesForBackCompatibilityonTypeProviderhandling restore, merge, filter, and deduplicationCanonicalTypeProvider.BuildAttributes()to delegate to the new shared APIjorgerangel-msft commentedon Jul 14, 2026
Attributes can be part of the public surface, but we should consider if the generator should actually make the decision of re-adding them back if they are missing from the current version. Maybe we start with an allow list of known attributes that can be added back, and eventually let that be extensible for downstream plugins ?
[-]Centralize type attribute back-compat merging in C# generator[/-][+]Consider adding attributes to the list of supported backcompat scenarios[/+]chore: clean up TypeProvider attributes (microsoft#11418)