Skip to content

Commit 14ba87c

Browse files
Sergio0694Copilot
andcommitted
Suppress CA1416 in UnitTest for intentional platform-warning tests
UnitTest deliberately calls Windows Runtime APIs annotated with [SupportedOSPlatform] for a higher Windows version than the project minimum: the 'Warning*' types exercised by TestSupportedOSPlatformWarnings exist specifically to verify those platform warnings fire, and ComInteropTests calls the DisplayInformation interop extensions (22621). Under the centralized Release warnings-as-errors these CA1416 warnings became errors. Suppress CA1416 for this test project rather than raising the minimum target platform, which would defeat the purpose of TestSupportedOSPlatformWarnings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 593c0e8 commit 14ba87c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/Tests/UnitTest/UnitTest.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
only contains lower-cased ascii characters"). This is generated code we don't control, so suppress it.
1919
-->
2020
<NoWarn>$(NoWarn);CS8981</NoWarn>
21+
22+
<!--
23+
This project intentionally calls Windows Runtime APIs annotated with '[SupportedOSPlatform]' for a
24+
higher Windows version than the project's minimum (e.g. the 'Warning*' types exercised by
25+
'TestSupportedOSPlatformWarnings', which exist specifically to verify the platform warnings, and the
26+
'DisplayInformation' interop extensions). These deliberately trip 'CA1416', so suppress it here rather
27+
than raising the minimum target platform (which would defeat the purpose of those tests).
28+
-->
29+
<NoWarn>$(NoWarn);CA1416</NoWarn>
2130
<SelfContained>true</SelfContained>
2231
<CsWinRTEnabled>false</CsWinRTEnabled>
2332
<OutputType>exe</OutputType>

0 commit comments

Comments
 (0)