Skip to content

fix: assertion analyzers missing rules for common mistakes #4874

@thomhurst

Description

@thomhurst

Description

The assertion analyzers check for missing await, constants, dynamic usage, and mixed And/Or operators. Missing rules for common mistakes:

  1. GenerateAssertionAnalyzer doesn't catch Task (non-generic) return types — should require Task<bool> or Task<AssertionResult>
  2. No sync-blocking detection.Result or .Wait() on assertion expressions
  3. No assertion chain completenessAnd without a following assertion
  4. No assignment detection — using = instead of assertion in Assert.That()

Suggested Fix

Add new analyzer rules for each case above, with appropriate diagnostic IDs and fix suggestions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions