-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Add code fixer to add [Obsolete] attribute on code that gets an 'obsolete' warning. #28549
Conversation
Tagging @dotnet/roslyn-ide @jcouv . Tests incoming. |
src/Features/CSharp/Portable/AddObsoleteAttribute/CSharpAddObsoleteAttributeCodeFixProvider.cs
Outdated
Show resolved
Hide resolved
@sharwell Do you have any other concerns? |
@sharwell Do you have any other concerns? Have the design concerns been discussed? |
@CyrusNajmabadi If the two remaining warnings I pointed out before (CS1062, CS1064 for collection initializers) can be implemented without a problem, it would be nice to have the complete feature done. Otherwise the primary code fix design here is approved. If there is a reason why it would be problematic to implement the last two cases, please let us know. |
Should be no problem. Will do tonight/tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs tests, but the implementation is looking complete. @CyrusNajmabadi if you won't be able to get the tests let me know and I'll try to find some time to add them to the branch you started.
@jaredpar @jasonmalinowski something is causing the CI system to cancel testing PRs: |
@sharwell this is ready to go in. Can you look? |
Are you referring to the behavior that when you push it cancels the PR builds that are in progress? If so I've already given the AzDev team the feedback that this behavior needs to be configurable. I specifically sent them some of our PRs as examples of how our users take advantage of the testing happening on every push. Fixing this is in the works but don't expect it anytime soonish. |
Wat... is that what's happening? What sort of crazy CI behavior is that? :-/
Ok, great. Thanks for sending that message along. Let them know that a CI/CD system that doesn't actually do the 'C' part is really lacking :) |
@jaredpar Feel free to point the devops team at their own messaging of the product: https://docs.microsoft.com/en-us/azure/devops/learn/what-is-continuous-integration
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still missing tests for the following:
- Cases where
error: true
is used (it would be good to create this test as a theory so it's easy to verify that the fix is offered if and only iferror: false
is used) - Obsolete collection initializer warnings
Tests added.
These tests are here already. Thanks! |
@jinujoseph for approval |
@jinujoseph this can go in. thanks! |
Thanks! |
Fixes one of the cases reported here: #27168
Very simple feature. When it hears about "you're using something obsolete" from teh compiler, offers to add the 'obsolete' attribute itself to your code. Useful when doing something like overriding an obsolete member with something non-obsolete: