Skip to content

bug: PublicMethodMissingTestAttributeAnalyzer may flag property accessors #4863

@thomhurst

Description

@thomhurst

Description

File: TUnit.Analyzers/PublicMethodMissingTestAttributeAnalyzer.cs (Lines 35-46)

The analyzer filters for MethodKind.Ordinary but doesn't explicitly exclude property accessor methods. If a test class has public properties, the compiler-generated get_/set_ methods could be flagged as missing a test attribute.

Impact

False positives on compiler-generated property accessors, reducing confidence in the analyzer.

Suggested Fix

Add filters to exclude MethodKind.PropertyGet, MethodKind.PropertySet, MethodKind.EventAdd, MethodKind.EventRemove, and other compiler-generated methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions