-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
We've built an analyzer that allows an API to be marked as unsupported for a given set of platforms. We're going to use this to mark APIs that we can't make work in Blazor WebAssembly.
In the Blazor case, there are many cuts and they cut deep (threading or file I/O). We don't want an experience where developers of normal cross-platform class libraries or console apps are confronted with a myriad of diagnostics these APIs don't work in WebAssembly -- most developers don't need their code to run in those environment.
We intend to address this experience by allowing the developer to include and exclude platforms that the analyzer will consider. Since we want developers to add an remove from the default set, it sees an item group is much more natural fit than a property:
- The base SDK includes a standard set, such as:
<ItemGroup> <SupportedPlatform Include="android" /> <SupportedPlatform Include="ios" /> <SupportedPlatform Include="linux" /> <SupportedPlatform Include="macos" /> <SupportedPlatform Include="windows" /> </ItemGroup>
- The Blazor SDK changes that set:
<ItemGroup> <SupportedPlatform Include="browser" /> </ItemGroup>
- Developers can do this manually in the project file, if, for example, they are building a class library for Blazor:
<ItemGroup> <SupportedPlatform Include="browser" /> </ItemGroup>
- Developers can also manually remove platforms from the project file that they don't care about:
<ItemGroup> <SupportedPlatform Remove="macos" /> </ItemGroup>
Questions
-
The name seems to conflict with the existing item groups in the SDK has:
SupportedTargetFrameworkandSupportedTargetPlatform. So maybe we should call this oneAnalyzedPlatform? -
The assumption is that there is a way to pass this to the Roslyn analyzer. @mavasani is looking into that.