Closed Maxyeah closed 1 month ago
This a known issue and it is currently not fixable as there is no way to get the #if-def conditional in analyzer until https://github.com/dotnet/roslyn/issues/24569 is fixed, see case 3 from https://github.com/dotnet/roslyn-analyzers/issues/5938
Closing as duplicate of https://github.com/dotnet/roslyn-analyzers/issues/5938
Version Used: VS2022 Version 17.8.4
Steps to Reproduce:
The question is, why is it necessary to set the supported OS platform in the assembly info if the WINDOWS Preprocessor already hides the class instantiation for non windows framework targets.
Expected Behavior: Compiler will hide Warning due to WINDOWS Preprocessor.
Actual Behavior: Compiler warning CA1416: This call site is reachable on all platforms. 'WindowsOnlyClass' is only supported on: 'windows'.
Example Project: WindowsPreprocessor.zip