Skip to content

MTP runs correctly on wasi - #7137

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/wasi
Dec 16, 2025
Merged

Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/wasi

Conversation

@Evangelink

@Evangelink Amaury Levé (Evangelink) commented Dec 16, 2025 •

Copy link
Copy Markdown
Member

Partially fixes #5366. Now we need some work on the frameworks side.

Testing with TUnit as in linked ticket:
image

Testing with MSTest:
image

I haven't added some acceptance test because we need bigger machinery (workload + winget tool installed).

Simply calling dotnet run doesn't work but I don't know enough wasi to see what's missing:
Uploading image.png…

@Evangelink Amaury Levé (Evangelink) changed the title MTP now run correctly on wasi MTP runs correctly on wasi Dec 16, 2025
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/wasi branch December 16, 2025 15:54
}
}

private static string ComputeNonCryptographicHash(string text)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasi is still experimental right? Why do we care too much about it early? Regardless, I would avoid using non-cryptographic hash here. Either we disable this code path on WASI (which is telemetry only I think), or implement a managed Sha256 and use it here.

@Youssef1313

Copy link
Copy Markdown
Member

Amaury Levé (@Evangelink) I tried this but it doesn't work and I don't see any viable workaround for that on our side.

Unhandled Exception:
System.PlatformNotSupportedException: Arg_PlatformNotSupported
   at System.Threading.Tasks.Task.InternalWaitCore(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.InternalWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Program.<Main>(String[] args)

@Evangelink

Copy link
Copy Markdown
Member Author

That's the error I was mentioning above and it's not produced by the platform afaik, so we need to fix MSTest (also TUnit as per screenshot)

Amaury Levé (Evangelink) added a commit that referenced this pull request May 25, 2026
After PRs #7137 and #7146, Microsoft.Testing.Platform boots on the
wasi-wasm runtime, but the sample wouldn't even produce a `dotnet.wasm`
bundle out of the box on the current preview SDK (`11.0.100-preview.5`):

* `WorkloadManifest.Wasi.targets` only resolves
  `$(UsingWasiRuntimeWorkload)` to `true` when `$(TargetsCurrent)`
  (net11.0) is true, never when `$(TargetsNet10)` is true, so the WASI
  Sdk targets are never imported.
* The pre-built `dotnet.wasm` tries to read `icudt.dat` from `cwd` even
  when `InvariantGlobalization` is on, so trimmed builds crash on
  startup.
* `WasmSingleFileBundle=true` requires `wasi-sdk` (clang) to relink the
  native runtime, which is a heavy prerequisite for a sample.

Set the matching properties explicitly on the project so a plain
`dotnet publish` produces a runnable bundle, and document the new
working build / run procedure (and the remaining `Task.Wait` blocker
tracked in #5366) in the README.

Co-authored-by: Copilot <[email protected]>
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

Successfully merging this pull request may close these issues.

Allow running on wasm platform

3 participants