| Topic | Value |
|---|---|
| Id | GU0010 |
| Severity | Error |
| Enabled | True |
| Category | Gu.Analyzers.Correctness |
| Code | SimpleAssignmentAnalyzer |
Assigning same value does not make sense and is sign of a bug.
While not a common bug this happens:
public class Foo
{
public Foo(int a)
{
this.A = A;
}
public int A { get; private set; }
}You probably meant:
public class Foo
{
public Foo(int a)
{
this.A = a;
}
public int A { get; private set; }
}Configure the severity per project, for more info see MSDN.
#pragma warning disable GU0010 // Assigning same value
Code violating the rule here
#pragma warning restore GU0010 // Assigning same valueOr put this at the top of the file to disable all instances.
#pragma warning disable GU0010 // Assigning same value[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness",
"GU0010:Assigning same value",
Justification = "Reason...")]