Skip to content

Disallow test methods with out/ref parameters #7058

@Youssef1313

Description

@Youssef1313

Today, the following is allowed:

        [TestMethod]
        [DataRow("Hello", "World")]
        public void TestMethod1(out string s, ref string s2)
        {
            s = "";
        }

I think we should:

  1. Fail at run time when we encounter such a test method.
  2. Update the analyzer for test method validity to also produce a compile-time warning.

It's technically a breaking change, but I think it's acceptable and is unlikely that people are doing this today.

Metadata

Metadata

Assignees

Labels

Area: AnalyzersArea: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions