.Net How to find SuppressMessageAttribute category for a given warning (BC42015)
attributes, vb.net, warnings
Solution
The general way to discover the category for a Code Analysis warning, for use in the `SuppressMessageAttribute` attribute would be to consult the documentation for the warning.
For instance, for `CA1039`, we get:
TypeName ListsAreStronglyTyped
CheckId CA1039
Category Microsoft.Design
Breaking Change Breaking
Now, for `BC42015` we don't find such information. Why? Because it's not a code analysis warning. It's a compiler warning (note that we're in a completely different part of the MSDN library).
So far as I'm aware, there's no local way to override compiler warnings in VB - all you can do is disable the warning at the project level (but I'll admit, this is hardly ever what you want to do).
Problem
I'm looking for a way how to find a SuppressMessageAttribute catagory for a given warning (BC42015). After recieving the following warning I would like to suppress it. ``` 'SomeLib.SomeInterface.DrawRuler' is already implemented by the base class 'SomeLib.SomeClass'. Re-implementation of function assumed. C:\Project\somefile.vb 5 115 ALibName ``` Using the SuppressMessage attribute should work but how can I find the relevant Catagory. The following won't work. ``` <CodeAnalysis.SuppressMessageAttribute("IDUNNO","BC42015")> ``` All MSDN examples are pretty useless. In Source Suppression Overview Rule Category - The category in which the rule is defined. For more information about code analysis rule categories, see some useless link.