Skip to content

Add analyzer for when a test member is shadowing another member #3263

Description

@Evangelink

Summary

Prevent testing issues (such as NRE) when user is shadowing test members.

Background and Motivation

.NET allows to do shadowing of members and MSTest will respect the behavior but this is nearly always causing issues. When shadowing a member (test, TestContext property...) from a base class, the base class is ignored (see microsoft/playwright-dotnet#2958).

Proposed Feature

Raise a diagnostic when a member is being shadowed even if the user is using the new keyword to force shadowing.

The analyzer should be enabled by default with a warning severity and its category should be design.

Alternative Designs

None

AB#2200925

Metadata

Metadata

Assignees

Labels

area/analyzersMSTest.Analyzers Roslyn analyzers and code fixes.state/in-prA PR is open for this issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions