Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.22 KB

File metadata and controls

46 lines (34 loc) · 1.22 KB

SA1205

TypeName SA1205PartialElementsMustDeclareAccess
CheckId SA1205
Category Ordering Rules

Cause

The partial element does not have an access modifier defined.

Rule description

A violation of this rule occurs when the partial elements does not have an access modifier defined.

Partial methods in C# 9

C# 9 allows partial methods to have access modifiers and non-void return types. For compatibility across versions, SA1205 does not require these access modifiers to be included. In addition, the compiler enforces the presence of access modifiers when using the new features, so SA1205 will not apply duplicate diagnostics in cases where required modifiers are omitted.

How to fix violations

To fix an instance of this violation, specify an access modifier for the partial element.

How to suppress violations

[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1205:PartialElementsMustDeclareAccess", Justification = "Reviewed.")]
#pragma warning disable SA1205 // PartialElementsMustDeclareAccess
#pragma warning restore SA1205 // PartialElementsMustDeclareAccess