Skip to content

PlatformNotSupportedException when running unit tests from VS #123491

@mrek-msft

Description

@mrek-msft

Description

I am new in .NET runtime repo. I try run library tests in VS, but in case of some libraries (for example, System.IO.Ports, Microsoft.Extensions.Logging) some tests fails with PlatformNotSupportedException because test executable run with component implemented by .notsupported.cs platform variant (in case of Logging) and .Unix.cs variant in case of Ports. It happens only with net11 targets and do not happen with net481. It also do not happen when running dotnet build /t:Test in command line.

Image

Did I anything wrong?

Reproduction Steps

  1. Clone fresh runtime repo
  2. .\build.cmd -rc Release
  3. .\Build.cmd -vs Microsoft.Extensions.Logging
  4. Test Explorer > Run All Tests in View

Expected behavior

Exclude tests for unsupported platform

Actual behavior

They are included multiple times. For one platform they pass, other fails.

Regression?

No response

Known Workarounds

Run from commad line

Configuration

dotnet/runtime, branch main, commit 216076f
Windows 11 x64 DevBox
VS version: 18.4.0 Insiders [11407.181.main]

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions