Skip to content

Blazor developers get warnings when they call APIs that aren't available on WebAssembly #42335

@jeffhandley

Description

@jeffhandley

For #41087, we annotated many APIs with [UnsupportedOSPlatform("browser")], which will allow the Platform Compatibility Analyzer to provide customers with warnings when calling APIs that are unsupported on browser from call sites intended to work on browser. This is working for customer scenarios, but the dotnet/runtime repo itself isn't currently producing warnings for the scenario.

Since support for browser is not implied, the analyzer requires an MSBuild item for <SupportedPlatform Include="browser" /> to be supplied in order for browser-related warnings to be produced. With #41760, we enabled the analyzer in the master branch, but a quick test during the review of that PR revealed that even with this MSBuild item specified, the errors were still not getting produced within the libraries projects.

We need to:

  1. Identify which libraries projects should have <SupportedPlatform Include="browser" /> specified, and annotate them as such, indicating that the library is intended to be supported on browser
  2. Ensure that each of those projects can produce warnings/errors from the analyzer during a normal build
  3. Resolve any warnings/errors that currently exist with the annotations that have been made

/cc @mdh1418 @steveisok

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions