Skip to content

Commit 5a6cb51

Browse files
Update NativeAOT warning expectations
Account for the additional temporary reflection-manager trim warnings emitted by the Java.Interop update while preserving AOT warning visibility. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e747c69 commit 5a6cb51

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,11 @@ public void BuildHasNoWarnings (bool isRelease, bool multidex, string packageFor
462462
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
463463

464464
if (runtime == AndroidRuntime.NativeAOT) {
465-
// NativeAOT currently (Nov 2025) produces 6 `ILC : AOT analysis warning IL3050` warnings for various
465+
// NativeAOT currently (Nov 2025) produces 10 `ILC : AOT analysis warning IL3050` warnings for various
466466
// bits of code. Even though this test expects no warnings and the above likely make the app not work
467467
// correctly at run time, it is still worth running this test under NativeAOT to test for the absence
468468
// of other warnings.
469-
int numberOfExpectedWarnings = 6;
469+
int numberOfExpectedWarnings = 10;
470470

471471
Assert.IsTrue (
472472
StringAssertEx.ContainsText (
@@ -501,15 +501,15 @@ static IEnumerable<object[]> Get_BuildHasTrimmerWarningsData ()
501501
} else {
502502
AddTestData (runtime, "", new string [0], true);
503503
}
504-
AddTestData (runtime, "SuppressTrimAnalysisWarnings=false", new string [] { "IL2055" }, true, 2);
504+
AddTestData (runtime, "SuppressTrimAnalysisWarnings=false", new string [] { "IL2055" }, true, 3);
505505
AddTestData (runtime, "TrimMode=full", new string [] { "IL2055" }, false, 1);
506-
AddTestData (runtime, "TrimMode=full", new string [] { "IL2055" }, true, 2);
506+
AddTestData (runtime, "TrimMode=full", new string [] { "IL2055" }, true, runtime == AndroidRuntime.NativeAOT ? 2 : 3);
507507
AddTestData (runtime, "IsAotCompatible=true", new string [] { "IL2055", "IL3050" }, false);
508508

509509
if (runtime == AndroidRuntime.NativeAOT) {
510510
AddTestData (runtime, "IsAotCompatible=true", new string [] { "IL2055", "IL3050" }, true, 2);
511511
} else {
512-
AddTestData (runtime, "IsAotCompatible=true", new string [] { "IL2055", "IL3050" }, true, 3);
512+
AddTestData (runtime, "IsAotCompatible=true", new string [] { "IL2055", "IL3050" }, true, 4);
513513
}
514514
}
515515

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManifestTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,8 @@ public void SupportedOSPlatformVersion (string minSdkVersion, bool removeUsesSdk
13401340
} else {
13411341
if (runtime == AndroidRuntime.NativeAOT) {
13421342
// 2 of: warning IL3053: Assembly 'Mono.Android' produced AOT analysis warnings.
1343-
StringAssertEx.Contains ("2 Warning(s)", builder.LastBuildOutput, "NativeAOT should produce two IL3053 warnings");
1343+
// 2 of: warning IL2104: Assembly 'Mono.Android' produced trim warnings.
1344+
StringAssertEx.Contains ("4 Warning(s)", builder.LastBuildOutput, "NativeAOT should produce four warnings");
13441345
} else {
13451346
builder.AssertHasNoWarnings ();
13461347
}

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ public void CheckSignApk ([Values] bool useApkSigner, [Values] bool perAbiApk, [
569569
if (runtime != AndroidRuntime.NativeAOT) {
570570
b.AssertHasNoWarnings ();
571571
} else {
572-
StringAssertEx.Contains ("2 Warning(s)", b.LastBuildOutput, "NativeAOT should produce two IL3053 warnings");
572+
StringAssertEx.Contains ("4 Warning(s)", b.LastBuildOutput, "NativeAOT should produce four warnings");
573573
}
574574

575575
//Make sure the APKs are signed

0 commit comments

Comments
 (0)