I just noticed that if you use [SupportedOSPlatformGuard], the normal CA1416 analyzer breaks down. Consider this snippet:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-windows10.0.26100.0</TargetFramework>
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
</PropertyGroup>
</Project>
using System.Runtime.Versioning;
using Windows.Foundation.Metadata;
using Windows.UI.Composition;
class C
{
public void M1()
{
// No warning (correct)
_ = ApiInformation.IsMethodPresent(
typeName: typeof(CompositionEasingFunction).FullName,
methodName: nameof(CompositionEasingFunction.CreatePowerEasingFunction));
}
[SupportedOSPlatformGuard("windows10.0.20348.0")]
public bool M2() => ApiInformation.IsMethodPresent(
typeName: typeof(CompositionEasingFunction).FullName,
methodName: nameof(CompositionEasingFunction.CreatePowerEasingFunction)); // warning..?!?
}
This gives you this:
If you add [SupportedOSPlatformGuard], the CA1416 analyzer starts firing even if the project has a higher minimum OS version.
We're having dozens of hits in the Microsoft Store (we just updated the Windows SDK to get the new annotations).
cc. @sbomer could you help take a quick look if you can? Thank you! 🙂
I just noticed that if you use
[SupportedOSPlatformGuard], the normal CA1416 analyzer breaks down. Consider this snippet:This gives you this:
If you add
[SupportedOSPlatformGuard], the CA1416 analyzer starts firing even if the project has a higher minimum OS version.We're having dozens of hits in the Microsoft Store (we just updated the Windows SDK to get the new annotations).
cc. @sbomer could you help take a quick look if you can? Thank you! 🙂