Skip to content

Exception: Sequence contains more than one element #2926

@skrysm

Description

@skrysm

Description

In version 2.2.3 there is a regression (compared to 2.1.2) for this code:

[TestClass]
public sealed class MyTestClass : MyTestClassBase
{
    [TestMethod]
    [TestCategory("MyTests")]
    public new void TestSomething()
    {
        base.TestSomething();
    }
}

public abstract class MyTestClassBase
{
    protected void TestSomething()
    {
        // Do something
    }
}

Executing this via:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "MyTests.dll" /TestCaseFilter:"TestCategory=MyTests"

Leads to this error (I had to manually translate it because the error is in German on my machine):

Exception in call of Executor "executor://mstestadapter/v2": The sequence contains more than one element.

This does not happen in version 2.1.2.

Steps to reproduce

  1. Create a modern-SDK test project
  2. Select net48 as target framework
  3. Add code above
  4. Reference NuGet packages like this:
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
    <PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
    <PackageReference Include="MSTest.TestFramework" Version="2.2.3" />

Run the tests via vstest.console (like shown above).

Expected behavior

There should be no exception.

Actual behavior

The exception above is thrown.

Environment

  • Windows 10
  • Visual Studio 2019 16.7.12
  • vstest.console 16.7.0

AB#1335565

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions