Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xUnit tests are not discovered (and run) in a .Net9 UWP application #3219

Open
vgromfeld opened this issue Mar 12, 2025 · 1 comment
Open

Comments

@vgromfeld
Copy link

Description

I've converted an UWP test application using xUnit to .Net 9 + AOT.
The xUnit tests are not discovered (and not run).
See Modernize your UWP app with preview UWP support for .NET 9 and Native AOT for more details

Steps To Reproduce

  1. Create an UWP test application
  2. Import xUnit nuget package
  3. Convert the project to a .Net 9 project
  4. Add an MSTest class:
[TestClass]
public class msUnitTest
{
    [TestMethod]
    public void Test()
    {
        var a = 10;
        Assert.AreEqual(10, a);
    }
}
  1. Add an xUnit test class
public class xUnitTest
{
    [Fact]
    public void Test()
    {
        var a = 10;
        a.Should().Be(10);
    }
}
  1. Run the tests

Only the msTest.Test test is run. The xUnitTest.Test testis not discovered by the test runner and not run.

Expected Behavior

All the tests should run.

Version Info

TargetFramework = net9.0-windows10.0.26100.0
Microsoft.NET.Test.Sdk = 17.14.0-preview-25107-01
MSTest = 3.8.2
xunit = 2.9.3
xunit.runner.visualstudio = 3.0.2

Additional Context

Sample test application: UnitTests.zip

@vgromfeld
Copy link
Author

vgromfeld commented Mar 12, 2025

This has initially be opened in the csWinrt project: microsoft/CsWinRT#1943
This issue affects only .NET 9 + UWP test. "Regular" .NET 9 test projects are working fine.
XUnit stops discovering the test once I'm adding <Platforms>x86;x64;arm64</Platforms> to the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant