`dotnet test` does not work for WASM libraries tests

Open
#119,358 4 comments 0 reactions 1 assignee View on GitHub

@akoeplinger is already working on this.

Since Sep 9, 2025.

Assessment

This issue has not been assessed yet.

Description

arch-wasm area-Infrastructure-libraries

Writing this purely in the spirit of https://github.com/dotnet/runtime/issues/94183#issuecomment-3254389607, feel free to close / move this issue.

Currently if you try to do:

dotnet test /p:TargetOS=wasi /p:TargetArchitecture=wasm .\tests\System.Collections.Specialized.Tests.csproj

It will fail with:

Settings file provided does not conform to required format. An error occurred while loading the settings.  Error: Invalid setting 'RunConfiguration'. Invalid value 'wasm' specified for 'TargetPlatform'..
Unhandled exception. System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.TestPlatform.Client.TestPlatform' threw an exception.
 ---> Microsoft.VisualStudio.TestPlatform.ObjectModel.SettingsException: Invalid settings 'RunConfiguration'.  Invalid value 'wasm' specified for 'TargetPlatform'.
   at Microsoft.VisualStudio.TestPlatform.ObjectModel.RunConfiguration.FromXml(XmlReader reader) in /_/src/vstest/src/Microsoft.TestPlatform.ObjectModel/RunSettings/RunConfiguration.cs:line 781
   at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetNodeValue[T](String settingsXml, String nodeName, Func`2 nodeParser) in /_/src/vstest/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs:line 377
   at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetRunConfigurationNode(String settingsXml) in /_/src/vstest/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs:line 136
   at Microsoft.VisualStudio.TestPlatform.Client.TestPlatform.AddExtensionAssembliesFromExtensionDirectory() in /_/src/vstest/src/Microsoft.TestPlatform.Client/TestPlatform.cs:line 283
   --- End of inner exception stack trace ---

dotnet msbuild /t:Test works as expected:

dotnet msbuild /p:TargetOS=wasi /p:TargetArchitecture=wasm /t:Test .\tests\System.Collections.Specialized.Tests.csproj

...
  info: === TEST EXECUTION SUMMARY ===
  info: Tests run: 2131 Passed: 2123 Inconclusive: 0 Failed: 0 Ignored: 0 Skipped: 8
...
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.