Skip to content
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

Champion: "Allow Obsolete attribute on getters and setters" (16.3, Core 3) #2152

Open
3 of 5 tasks
gafter opened this issue Jan 17, 2019 · 5 comments
Open
3 of 5 tasks
Assignees
Labels
Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification Proposal champion
Milestone

Comments

@gafter
Copy link
Member

gafter commented Jan 17, 2019

  • Proposal added
  • Discussed in LDM 2019-02-27
  • Decision in LDM
  • Finalized (done, rejected, inactive)
  • Spec'ed

See dotnet/roslyn#32472
See dotnet/roslyn#32571

LDM history:

@gafter gafter self-assigned this Jan 17, 2019
@YairHalberstadt
Copy link
Contributor

YairHalberstadt commented Jan 17, 2019

It would have to be decided whether it would be an error to obsolete all the accessors in a property, as the property should be obsoleted instead.

I would suggest for consistency the design should follow that of VB which already allows the obsolete attribute on getters and setters.

VB allows all accessors ina property to be declared obsolete. It also allows usages of nameof on a property where all accessors have been declared obsolete.

This also avoids needing to special case the obsolete attribute, as any other attribute which is valid on both methods and properties can be applied to all accessors of a property at once.

@scalablecory
Copy link

I found myself wishing for this just a few weeks ago, when trying to clean up some code that used a bunch of get/set properties to one that was a more read-only ctor-initialized record.

@YairHalberstadt
Copy link
Contributor

https://github.com/dotnet/csharplang/blob/master/meetings/2019/LDM-2019-02-27.md

It looks like the LDC has supported this proposal.

A prototype exists at dotnet/roslyn#32571

@YairHalberstadt
Copy link
Contributor

I think that obsolete should be disallowed on event accessors since it is meaningless to make add but not remove (or the other way round) obsolete.

@jcouv
Copy link
Member

jcouv commented Apr 2, 2019

Merged the feature for dev16.1 preview2 (dotnet/roslyn#32571). Thanks @YairHalberstadt!

@jcouv jcouv changed the title Champion: "Allow Obsolete attribute on getters and setters" Champion: "Allow Obsolete attribute on getters and setters" (16.3, Core 3) Jul 18, 2019
@333fred 333fred added the Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification label Oct 16, 2020
@jcouv jcouv assigned jcouv and unassigned jcouv Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implemented Needs ECMA Spec This feature has been implemented in C#, but still needs to be merged into the ECMA specification Proposal champion
Projects
None yet
Development

No branches or pull requests

5 participants