microsoft / testfx

MSTest framework and adapter
MIT License
723 stars 254 forks source link

Tests using ValueTask return type always succeed #3136

Closed Rans4ckeR closed 3 months ago

Rans4ckeR commented 3 months ago

Describe the bug

Using ValueTask return type causes a test to always succeed. It seems the ValueTask is not awaited.

Steps To Reproduce

Using Task this test correctly fails:

[TestClass]
public sealed class TestClassX
{
    [TestMethod]
    public async Task TestMethodY()
    {
        await ValueTask.CompletedTask;
        Assert.Fail();
    }
}

Using ValueTask this same test succeeds:

[TestClass]
public sealed class TestClassX
{
    [TestMethod]
    public async ValueTask TestMethodY()
    {
        await ValueTask.CompletedTask;
        Assert.Fail();
    }
}

Additional context

MSTest.Sdk/3.4.3

Evangelink commented 3 months ago

Hi @Rans4cker!

THanks for the bug report, I can reproduce the issue. We will work on a fix soon.