Expose IPropertySymbol.AssociatedField #42355
Labels
Area-Compilers
Concept-API
This issue involves adding, removing, clarification, or modification of an API.
Feature Request
Same as #40103 which covers IEventSymbol.
The only way to detect the existence of the backing field from a third-party analyzer is to find the field in the parent ITypeSymbol.GetMembers() collection and check its AssociatedSymbol property. This means of locating backing fields would disappear if property backing fields (like event backing fields) were removed from
ITypeSymbol.GetMembers()
.The ability to remove all backing fields from
ITypeSymbol.GetMembers()
solves a binding cycle problem that is blocking one of the design options for dotnet/csharplang#140. IfIPropertySymbol.AssociatedField
was exposed, it would enable removing all backing fields from GetMembers() rather than just event backing fields. That would enable the preferred syntax for dotnet/csharplang#140./cc @CyrusNajmabadi
The text was updated successfully, but these errors were encountered: