Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 1.41 KB

GU0005.md

File metadata and controls

51 lines (37 loc) · 1.41 KB

GU0005

Use correct argument positions

Topic Value
Id GU0005
Severity Warning
Enabled True
Category Gu.Analyzers.Correctness
Code ObjectCreationAnalyzer

Description

Use correct position for name and message.

Motivation

ArgumentException & ArgumentNullException has different positions for parameterName and message. Changing exception type between the two is very likely to introduce an error.

How to fix violations

Use the code fix or manually change the argument positions.

Configure severity

Via ruleset file.

Configure the severity per project, for more info see MSDN.

Via #pragma directive.

#pragma warning disable GU0005 // Use correct argument positions
Code violating the rule here
#pragma warning restore GU0005 // Use correct argument positions

Or put this at the top of the file to disable all instances.

#pragma warning disable GU0005 // Use correct argument positions

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness", 
    "GU0005:Use correct argument positions", 
    Justification = "Reason...")]