Skip to content

no-returns-on-void

C#stylefix: safedefault: offcsharp/stylecop

Reports a <returns> on a method or delegate that returns void. The fix removes the element with its line when it is alone on it.

There is nothing to return, so the tag documents a value that does not exist and is shown in the reference as a result.

Reported
...
/// </returns>
public int BlankReturns() => 0;
/// <summary>Does.</summary>
/// <returns>Nothing.</returns>
public void VoidReturns() { }
/// <summary>Does.</summary>
/// <returns></returns>
public void VoidEmptyReturns() { }
/// <summary>Does.</summary>
/// <returns />
public void VoidSelfClosingReturns() { }
/// <summary>Does.</summary>
...
/// <summary>Delegate.</summary>
...
/// <summary>Delegate.</summary>
/// <returns>Nothing.</returns>
public delegate void VoidCallback();
/// <summary>Does.</summary>
...
csharp:
lint:
rules:
no-returns-on-void: warn # off (default), warn, error

Enabled by the presets: csharp/stylecop.

Suppress one line with sudsy-disable-next-line no-returns-on-void in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
StyleCop SA1617 full