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
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.
Context
While exercising the
samples/WasiPlaygroundsample 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 onwasi-wasm(noProcess, noConsole.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 freshCA1416warnings 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"):In each of these, the existing trio
should grow a fourth entry
[UnsupportedOSPlatform("wasi")].Related
Note on CrashDump
Microsoft.Testing.Extensions.CrashDumpuses a runtime guard (IsCrashReportUnsupportedOnCurrentPlatform) instead of[UnsupportedOSPlatform]annotations, so it's not affected by this change. Itscsprojalready declares<SupportedPlatform Include="browser" />; we may want to addwasithere too, but that is independent of this issue.