From a727e361b7b46db7540b5f3280aedb8344af3e3e Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 20 Jul 2026 13:36:01 -0500 Subject: [PATCH 1/3] [tests] Cover incremental compressed assembly stores Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bcf67079-07cc-4d87-818c-1c0a0a571226 --- .../Tests/InstallAndRunTests.cs | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs index e90cacd8120..b114b4fd934 100644 --- a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs @@ -751,6 +751,72 @@ string ValidFileHash () => RunAdbCommand ( ); } + [Test] + public void IncrementalReleaseBuildUpdatesCompressedAssemblyStore () + { + const AndroidRuntime runtime = AndroidRuntime.CoreCLR; + if (IgnoreUnsupportedConfiguration (runtime, release: true)) { + return; + } + + string payload = "initial"; + var app = new XamarinAndroidApplicationProject (packageName: PackageUtils.MakePackageName (runtime, "incrementalstore")) { + IsRelease = true, + }; + app.SetRuntime (runtime); + app.SetRuntimeIdentifiers (new [] { DeviceAbi }); + app.SetDefaultTargetDevice (); + app.MainActivity = app.DefaultMainActivity.Replace ( + "base.OnCreate (savedInstanceState);", + "base.OnCreate (savedInstanceState);" + Environment.NewLine + "\t\tConsole.WriteLine (Payload.Value);" + ); + app.Sources.Add (new BuildItem.Source ("Payload.cs") { + TextContent = () => $$""" + namespace UnnamedProject; + + public static class Payload + { + public static string Value => "{{payload}}"; + } + """, + }); + + using var appBuilder = CreateApkBuilder (); + Assert.IsTrue (appBuilder.Install (app), "The initial install should succeed."); + + ClearAdbLogcat (); + AdbStartActivity ($"{app.PackageName}/{app.JavaPackageName}.MainActivity"); + Assert.IsTrue ( + WaitForActivityToStart ( + app.PackageName, + "MainActivity", + Path.Combine (Root, appBuilder.ProjectDirectory, "initial-launch.log"), + ActivityStartTimeoutInSeconds + ), + "The initial Release build should launch." + ); + + RunAdbCommand ($"shell am force-stop --user all {app.PackageName}"); + payload = new string ('x', 64 * 1024); + app.Touch ("Payload.cs"); + Assert.IsTrue ( + appBuilder.Install (app, doNotCleanupOnUpdate: true, saveProject: false), + "The incremental install should succeed." + ); + + ClearAdbLogcat (); + AdbStartActivity ($"{app.PackageName}/{app.JavaPackageName}.MainActivity"); + Assert.IsTrue ( + WaitForActivityToStart ( + app.PackageName, + "MainActivity", + Path.Combine (Root, appBuilder.ProjectDirectory, "incremental-launch.log"), + ActivityStartTimeoutInSeconds + ), + "The incrementally rebuilt app should launch without a compressed assembly size mismatch." + ); + } + [Test] public void ActivityAliasRuns ([Values] bool isRelease, [Values (AndroidRuntime.CoreCLR, AndroidRuntime.NativeAOT)] AndroidRuntime runtime) { From b60956bc5dc170082544b9ece115569919c80df2 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 20 Jul 2026 13:50:22 -0500 Subject: [PATCH 2/3] [tests] Remove redundant runtime guard Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bcf67079-07cc-4d87-818c-1c0a0a571226 --- .../MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs index b114b4fd934..07e4e5d7c5e 100644 --- a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs @@ -754,16 +754,11 @@ string ValidFileHash () => RunAdbCommand ( [Test] public void IncrementalReleaseBuildUpdatesCompressedAssemblyStore () { - const AndroidRuntime runtime = AndroidRuntime.CoreCLR; - if (IgnoreUnsupportedConfiguration (runtime, release: true)) { - return; - } - string payload = "initial"; - var app = new XamarinAndroidApplicationProject (packageName: PackageUtils.MakePackageName (runtime, "incrementalstore")) { + var app = new XamarinAndroidApplicationProject (packageName: PackageUtils.MakePackageName (AndroidRuntime.CoreCLR, "incrementalstore")) { IsRelease = true, }; - app.SetRuntime (runtime); + app.SetRuntime (AndroidRuntime.CoreCLR); app.SetRuntimeIdentifiers (new [] { DeviceAbi }); app.SetDefaultTargetDevice (); app.MainActivity = app.DefaultMainActivity.Replace ( From 12dbaa8563dc578bbb55d3df74fbff727a2b4ed6 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 21 Jul 2026 12:02:22 -0500 Subject: [PATCH 3/3] [tests] Match multi-RID assembly store scenario Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bcf67079-07cc-4d87-818c-1c0a0a571226 --- tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs index 07e4e5d7c5e..b142a0f91d4 100644 --- a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs @@ -759,7 +759,12 @@ public void IncrementalReleaseBuildUpdatesCompressedAssemblyStore () IsRelease = true, }; app.SetRuntime (AndroidRuntime.CoreCLR); - app.SetRuntimeIdentifiers (new [] { DeviceAbi }); + app.SetRuntimeIdentifiers (new [] { "arm64-v8a", "x86_64" }); + app.SetProperty ("AndroidPackageFormat", "apk"); + app.SetProperty ("EmbedAssembliesIntoApk", "true"); + app.SetProperty ("PublishTrimmed", "true"); + app.SetProperty ("AndroidLinkMode", "SdkOnly"); + app.SetProperty ("TrimMode", "partial"); app.SetDefaultTargetDevice (); app.MainActivity = app.DefaultMainActivity.Replace ( "base.OnCreate (savedInstanceState);",