Skip to content

Commit 2e8fab4

Browse files
jpnurmiclaude
andauthored
test(aot): build with (MSBuild)TreatWarningsAsErrors to catch warnings (#5125)
* test(aot): build with MSBuildTreatWarningsAsErrors Projects using MSBuildTreatWarningsAsErrors=true would fail to publish with Native AOT due to warnings. Add a test to prevent such warnings slipping in. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test(aot): fold warnings-as-errors into the main Aot test Enable both TreatWarningsAsErrors and MSBuildTreatWarningsAsErrors in the main Aot publish test (all platforms) and drop the separate Windows-only MSBuildTreatWarningsAsErrors block. Portable PDBs make the original Windows-only scoping unnecessary, and reusing the existing test avoids a second publish while also exercising the resulting binary at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f83537b commit 2e8fab4

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

integration-test/aot.Tests.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,16 @@ Console.WriteLine("Hello, Sentry!");
5252
It 'Aot' {
5353
$rid = $env:RuntimeIdentifier
5454
$baseImage = $env:ContainerBaseImage
55-
$publishArgs = @('-c', 'Release')
56-
if ($rid) {
55+
# To exclude specific warnings without disabling warnings-as-errors entirely, add:
56+
# '-p:WarningsNotAsErrors=CS####;IL####' # compiler/analyzer warnings (CS, IL2###, IL3###)
57+
# '-p:MSBuildWarningsNotAsErrors=MSB####' # MSBuild task warnings (MSB###)
58+
$publishArgs = @(
59+
'-c', 'Release',
60+
'-p:TreatWarningsAsErrors=true',
61+
'-p:MSBuildTreatWarningsAsErrors=true'
62+
)
63+
if ($rid)
64+
{
5765
Write-Host "Environment RuntimeIdentifier: $rid"
5866
$publishArgs += @('-r', $rid)
5967
}

0 commit comments

Comments
 (0)