Fix issue where 2 IDE analyzers are using IDE0035#24590
Fix issue where 2 IDE analyzers are using IDE0035#24590chborl merged 5 commits intodotnet:masterfrom
Conversation
|
@chborl Can we add a test that we don't have duplicates? Something that just uses reflection to grab all the const values in this type and makes sure there aren't any duplicates? It's not perfect, but would have caught this. @jinujoseph I'm guessing we want this in 15.7? |
|
yes , lets take this for 15.7 |
sharwell
left a comment
There was a problem hiding this comment.
👍 but file an issue to address Jason's feedback as a follow-up item.
📝 I am particularly in favor of changing the ID of the format string analyzer, as it seems more likely for people to be depending on the suppressions for unreachable code. In other words, the approach taken here is the less-breaking of the two possible changes.
|
@jasonmalinowski , I've added a test for duplicate IDs so hopefully this won't happen in the future. |
| public void UniqueIDEDiagnosticIds() | ||
| { | ||
| Type type = typeof(IDEDiagnosticIds); | ||
| List<string> ListOfIDEDiagnosticIds = type.GetFields().Select(x => x.GetValue(null).ToString()).ToList(); |
There was a problem hiding this comment.
nit: local, so lowercase 'l'.
|
📝 Someone needs to backport this to 15.7 since it was merged before retargeting. |
|
Thanks, @sharwell! I'll put this in 15.7 as well. |
Customer scenario
Both the Validate Format String and Remove Unreachable Code analyzers use the same ID, so a user would see the same code for both of these issues and if they suppress either one it would suppress both.
Bugs this fixes
#23983
Workarounds, if any
none
Risk
No code risk, but it is a breaking change. If a customer previously suppressed the Validate Format String analzyer, it would start firing again because it has a new ID number. @kuhlenh will change it in our documentation and add it to the breaking change log.
Performance impact
none
Is this a regression from a previous update?
no
Root cause analysis
How was the bug found?
Test documentation updated?