Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 1.06 KB

File metadata and controls

52 lines (39 loc) · 1.06 KB

NS5000

CheckId NS5000
Category Usage

Cause

Checking received calls without specifying member.

Rule description

A violation of this rule occurs when there is no call after

  • Received()
  • ReceivedWithAnyArgs()
  • DidNotReceived()
  • DidNotReceiveWithAnyArgs()

How to fix violations

To fix a violation of this rule, call method or access member after received checks.

For example:

// Incorrect:
sub.Received();

// Correct:
sub.Received().SomeMethodCall();

How to suppress violations

This warning can be suppressed by disabling the warning in the ruleset file for the project. The warning can also be suppressed programmatically for an assembly:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "NS5000:Received check.", Justification = "Reviewed")]

Or for a specific code block:

#pragma warning disable NS5000 // Received check.
// the code which produces warning
#pragma warning restore NS5000 // Received check.