Skip to content

CS8618 (nullability warning) for TestContext is not suppressed when a constructor is explicitly declared #6136

@Youssef1313

Description

@Youssef1313
#nullable enable

[TestClass]
public class C
{
    // public C() { }

    // Normally, the compiler produces a nullability warning here.
    // We have a diagnostic suppressor to suppress it.
    // However, once the constructor above is commented out, the
    // compiler starts producing the warning on the constructor declaration instead.
    // In this case, we fail to suppress.
    public string S { get; set; }

    [TestMethod]
    public void MyTest() { }
}

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions