Add a suppressor for the nullability warning on the TestContext property.
Background and Motivation
When enabling nullability analysis, the compiler will notify that the TestContext property can be nullable because it's not assigned a value. This is a false positive because MSTest will always assign this property a value before calling any method (after the constructor).
Many people are currently working around the issue using the following pattern:
[TestClass]
public class C
{
public TestContext TestContext { get; set; } = null!
}
Proposed Feature
Add a code suppressor.
Alternative Designs
Allow TestContext to be injected through ctor (see #2039)
Summary
Add a suppressor for the nullability warning on the
TestContext
property.Background and Motivation
When enabling
nullability
analysis, the compiler will notify that theTestContext
property can be nullable because it's not assigned a value. This is a false positive because MSTest will always assign this property a value before calling any method (after the constructor).Many people are currently working around the issue using the following pattern:
Proposed Feature
Add a code suppressor.
Alternative Designs
Allow
TestContext
to be injected through ctor (see #2039)