Skip to content

Commit 8fe9203

Browse files
MSTEST0036: Add analyzer for when a test member is shadowing another member (#42220)
Co-authored-by: Amaury Levé <[email protected]>
1 parent 9cd3172 commit 8fe9203

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: "Do not use shadowing inside test class."
3+
description: "Learn about code analysis rule MSTEST0036: Do not use shadowing inside test class."
4+
ms.date: 08/19/2024
5+
f1_keywords:
6+
- MSTEST0036
7+
- DoNotUseShadowingAnalyzer
8+
helpviewer_keywords:
9+
- DoNotUseShadowingAnalyzer
10+
- MSTEST0036
11+
author: engyebrahim
12+
ms.author: enjieid
13+
---
14+
# MSTEST0036: Do not use shadowing inside test class.
15+
16+
| Property | Value |
17+
|-------------------------------------|------------------------------------------------------------------------|
18+
| **Rule ID** | MSTEST0036 |
19+
| **Title** | Do not use shadowing inside test class. |
20+
| **Category** | Design |
21+
| **Fix is breaking or non-breaking** | Non-breaking |
22+
| **Enabled by default** | Yes |
23+
| **Default severity** | Warning |
24+
| **Introduced in version** | 3.6.0 |
25+
| **There is a code fix** | No |
26+
27+
## Cause
28+
29+
Shadowing test members could cause testing issues (such as NRE).
30+
31+
## Rule description
32+
33+
Shadowing test members could cause testing issues (such as NRE).
34+
35+
## How to fix violations
36+
37+
Delete the shadowing member.
38+
39+
## When to suppress warnings
40+
41+
Don't suppress warnings from this rule as it could cause testing issues (such as NRE).

docs/navigate/devops-testing/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ items:
121121
href: ../../core/testing/mstest-analyzers/mstest0025.md
122122
- name: MSTEST0029
123123
href: ../../core/testing/mstest-analyzers/mstest0029.md
124+
- name: MSTEST0036
125+
href: ../../core/testing/mstest-analyzers/mstest0036.md
124126
- name: Performance
125127
items:
126128
- name: Overview

0 commit comments

Comments
 (0)