SA1106.md

November 26, 2025 ยท View on GitHub

SA1106

TypeName SA1106CodeMustNotContainEmptyStatements
CheckId SA1106
Category Readability Rules

Cause

The C# code contains an extra semicolon.

Rule description

A violation of this rule occurs when the code contain an extra semicolon. Syntactically, this results in an extra, empty statement in the code.

C# 8 using declarations (e.g. using var stream = new MemoryStream(); or await using) end with a required semicolon that is part of the declaration syntax. This semicolon is not considered an empty statement and does not trigger this rule.

How to fix violations

To fix a violation of this rule, remove the unneeded semicolon.

How to suppress violations

[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1106:CodeMustNotContainEmptyStatements", Justification = "Reviewed.")]
#pragma warning disable SA1106 // CodeMustNotContainEmptyStatements
#pragma warning restore SA1106 // CodeMustNotContainEmptyStatements