Currenly two options are offered in Visual Studio: using #pragma on the line level, or using Attributes on the assembly level.
I actually prefer a third option: using the Attribute, but on the member level, so the method, class or namespace the issue resides in.
- Often a suppression is repeated in the same class, for instance because the class is used hevaliy in the UI and therefore ConfigurAwait(false) is not applicable. In this way multiple violations can be fixed at once
- Code is more readable, but still also it is clear that a supression is taking place because it is located in the same file.
I now do this bij choosing the option to supress in a separate file, then copy-paste the attribute code and change it. It would be very helpful if Sonarlint just natively would support this as a third option.