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

Make running netfx assemblies via Mono opt-in on non-Windows platforms #4908

Open
akoeplinger opened this issue Feb 26, 2024 · 1 comment
Open

Comments

@akoeplinger
Copy link
Member

akoeplinger commented Feb 26, 2024

Description

Right now VSTest will run .NET Framework assemblies using Mono on Unix platforms. This was useful in the past but nowadays the more common usage is multi-targetting a test assembly for net462/net8 where the netfx assembly contains Windows-specific code.

This results in issues like dotnet/runtime#81395 where a test assembly tried to run on mono unexpectedly.

Steps to reproduce

$ dotnet new mstest
  1. Edit the .csproj to contain <TargetFrameworks>net462;net8.0</TargetFrameworks> and <LangVersion>Latest</LangVersion>.

  2. Run dotnet test

Expected behavior

Only runs the tests once, for the net8.0 assembly.

Actual behavior

Runs both the net8.0 and net462 assembly, the latter using Mono.

Diagnostic logs

Environment

macOS 14, dotnet 8

@nohwnd
Copy link
Member

nohwnd commented Feb 27, 2024

I see how that would be useful, it would have to be a new flag, to avoid breaking people who are relying on the current behavior. We could add it to dotnet test msbuild task, so you could put opt-out flag directly into your project (e.g. false). And as a new runconfiguration.

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

2 participants