Overview
This rule flags global SuppressMessageAttributes that specify Target using the legacy FxCop target string format. Using the legacy format Target is known to have performance problems and should be avoided. For more information, see dotnet/roslyn issue 44362.
The recommended format for Target is the documentation ID format. For information about documentation IDs, see Documentation ID format.
Options
This rule has no associated code-style options.
Example
// IDE0077: Legacy format target 'N.C.#F'
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "Id: Title", Scope = "member", Target = "N.C.#F")]
// Fixed code
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "Id: Title", Scope = "member", Target = "~F:N.C.F")]
namespace N
{
class C
{
public int F;
}
}Suppress a warning
If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.
#pragma warning disable IDE0077
// The code that's violating the rule is on this line.
#pragma warning restore IDE0077To disable the rule for a file, folder, or project, set its severity to none in the configuration file.
[*.{cs,vb}]
dotnet_diagnostic.IDE0077.severity = noneTo disable this entire category of rules, set the severity for the category to none in the configuration file.
[*.{cs,vb}]
dotnet_analyzer_diagnostic.category-CodeQuality.severity = noneFor more information, see How to suppress code analysis warnings.