Repository navigation
Description
Context
While exercising the samples/WasiPlayground sample for #2196 / #5366, I noticed several [UnsupportedOSPlatform("browser")] / ("ios") / ("tvos") annotations that have no matching ("wasi") annotation, even though those code paths use APIs that are clearly broken on wasi-wasm (no Process, no Console.CancelKeyPress, no threads, ...).
When the .NET runtime eventually publishes proper [UnsupportedOSPlatform("wasi")] annotations on the BCL surface (tracked at dotnet/runtime#99126), MTP code that does not propagate those annotations will generate fresh CA1416 warnings at every consumer call site. Adding the wasi annotations now is a cheap, mechanical change and lets a wasi consumer get analyzer warnings instead of runtime crashes.
Files / members
Found by grep for [UnsupportedOSPlatform("browser")] followed by ("ios") / ("tvos") without ("wasi"):
src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpExtensions.cs (AddHangDumpProvider)
src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpProcessLifetimeHandler.cs (class + .ctor)
src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpActivityIndicator.cs (class)
src/Platform/Microsoft.Testing.Extensions.HangDump/TestingPlatformBuilderHook.cs (AddExtensions hook)
src/Platform/Microsoft.Testing.Extensions.HangDump/Helpers/IProcessExtensions.cs (multiple methods)
src/Platform/Microsoft.Testing.Platform/Helpers/System/IConsole.cs
src/Platform/Microsoft.Testing.Platform/Helpers/System/SystemConsole.cs
src/Platform/Microsoft.Testing.Platform/Helpers/System/SystemProcessHandler.cs
In each of these, the existing trio
[UnsupportedOSPlatform("browser")]
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]should grow a fourth entry [UnsupportedOSPlatform("wasi")].
Related
- Enable test execution in browser-wasm #2196 - Enable test execution in browser-wasm
- Allow running on wasm platform #5366 - Allow running on wasm platform
- MTP runs correctly on wasi #7137 / Fix running in browser wasm #7146 - earlier wasi/browser boot fixes
Note on CrashDump
Microsoft.Testing.Extensions.CrashDump uses a runtime guard (IsCrashReportUnsupportedOnCurrentPlatform) instead of [UnsupportedOSPlatform] annotations, so it's not affected by this change. Its csproj already declares <SupportedPlatform Include="browser" />; we may want to add wasi there too, but that is independent of this issue.
Activity
Address PR review and fix CI