Topic | Value |
---|---|
Id | GU0013 |
Severity | Warning |
Enabled | True |
Category | Gu.Analyzers.Correctness |
Code | ObjectCreationAnalyzer |
Throw for correct parameter.
In the below code the wrong name is used.
public Foo(string bar)
{
this.bar = bar ?? throw new ArgumentNullException(nameof(Foo));
}
Use the code fix to change it to:
public Foo(string bar)
{
this.bar = bar ?? throw new ArgumentNullException(nameof(bar));
}
Configure the severity per project, for more info see MSDN.
#pragma warning disable GU0013 // Throw for correct parameter
Code violating the rule here
#pragma warning restore GU0013 // Throw for correct parameter
Or put this at the top of the file to disable all instances.
#pragma warning disable GU0013 // Throw for correct parameter
[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness",
"GU0013:Throw for correct parameter",
Justification = "Reason...")]