Platform Specific Analyzer marks Windows.UI.Xaml classes as if they need adaptive code
Closed this issue · 2 comments
Hi,
Using the latest pre release version (2.0.0), I've found that it warns about classes in the Windows.UI.Xaml namespace, like Thickness, as being Platform-specific code.
But these classes are declared in the Windows.Foundation.UniversalApiContract.
It's that ok?
Regards.
I noticed using 2.0.2, that Windows.UI.Xaml.GridLength.Auto was marked as platform-specific. The suggested fix was to wrap in a call to IsTypePresent, which was pointless since when I investigated, GridLength is in the UniversalApiContract. This would always return true.
However, the type in the UniversalApiContract (both versions 1 and 2) contains just two of the members listed on MSDN, all the other members are defined in System.Runtime.WindowsRuntime.UI.Xaml, Version=4.0.0.0.
So the fix suggested by the analyzer is incorrect, it should have been something like:
Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.GridLength", "Auto")
...assuming that works with static properties (I haven't tested).
[closed this issue, and re-opened it in the analyzer's new repo]