Skip to content

Commit ee6af2c

Browse files
authored
Use Android API level instead of OS number (#24564)
Android versions the APIs using a "level" concept which doesn't follow the version numbering scheme of the OS release. We're using the API level for the SupportedOSPlatform annotations.
1 parent d2d6a0f commit ee6af2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/standard/analyzers/platform-compat-analyzer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ The platform compatibility analyzer is one of the Roslyn code quality analyzers.
2424

2525
- An **unattributed API** is considered to work on **all OS platforms**.
2626
- An API marked with `[SupportedOSPlatform("platform")]` is considered only portable to the specified OS `platform`.
27-
- The attribute can be applied multiple times to indicate **multiple platform support** (`[SupportedOSPlatform("windows"), SupportedOSPlatform("Android6.0")]`).
27+
- The attribute can be applied multiple times to indicate **multiple platform support** (`[SupportedOSPlatform("windows"), SupportedOSPlatform("Android29.0")]`).
2828
- The analyzer will produce a **warning** if platform-specific APIs are referenced without a proper **platform context**:
2929
- **Warns** if the project doesn't target the supported platform (for example, a Windows-specific API called from a project targeting iOS `<TargetFramework>net5.0-ios14.0</TargetFramework>`).
3030
- **Warns** if the project is cross-platform and calls platform-specific APIs (for example, a Windows-specific API called from cross platform TFM `<TargetFramework>net5.0</TargetFramework>`).
3131
- **Doesn't warn** if the platform-specific API is referenced within a project that targets any of the **specified platforms** (for example, for a Windows-specific API called from a project targeting windows `<TargetFramework>net5.0-windows</TargetFramework>`).
3232
- **Doesn't warn** if the platform-specific API call is guarded by corresponding platform-check methods (for example, a Windows-specific API call guarded by `OperatingSystem.IsWindows()`).
3333
- **Doesn't warn** if the platform-specific API is referenced from the same platform-specific context (**call site also attributed** with `[SupportedOSPlatform("platform")`).
3434
- An API marked with `[UnsupportedOSPlatform("platform")]` is considered unsupported only on the specified OS `platform` but supported for all other platforms.
35-
- The attribute can be applied multiple times with different platforms, for example, `[UnsupportedOSPlatform("iOS"), UnsupportedOSPlatform("Android6.0")]`.
35+
- The attribute can be applied multiple times with different platforms, for example, `[UnsupportedOSPlatform("iOS"), UnsupportedOSPlatform("Android29.0")]`.
3636
- The analyzer produces a **warning** only if the `platform` is effective for the call site:
3737
- **Warns** if the project targets the platform that's attributed as unsupported (for example, if the API is attributed with `[UnsupportedOSPlatform("windows")]` and the call site targets `<TargetFramework>net5.0-windows</TargetFramework>`).
3838
- **Warns** if the project is multi-targeted and the `platform` is included in the default [MSBuild `<SupportedPlatform>`](https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.SupportedPlatforms.props) items group, or the `platform` is manually included within the `MSBuild` \<SupportedPlatform> items group:

0 commit comments

Comments
 (0)