From 61cd5445063263a2dbaf85fd08bedc43e183b919 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Aug 2026 09:07:10 +0000 Subject: [PATCH 1/4] Initial plan From faa0a73da4ad40b3207241eeec792f78e74c5f0b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Aug 2026 09:53:06 +0000 Subject: [PATCH 2/4] Skip satellite assemblies during JLO scanning Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> --- ...crosoft.Android.Sdk.TypeMap.LlvmIr.targets | 10 ++-- .../PackagingTest.cs | 47 +++++++++++++++++-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets index 7bb826023f8..0d145205dd0 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets @@ -50,12 +50,16 @@ <_MergedManifestDocuments Condition=" '$(AndroidManifestMerger)' == 'legacy' " Include="@(ExtractedManifestDocuments)" /> + + <_AndroidResolvedAssembliesToScan + Include="@(_ResolvedAssemblies)" + Condition=" !$([System.String]::Copy('%(_ResolvedAssemblies.Filename)').ToLowerInvariant().EndsWith('.resources')) " /> @@ -63,7 +67,7 @@ @@ -95,7 +99,7 @@ EmitLlvmIrComments="$(_AndroidEmitLlvmIrComments)" EnableMarshalMethods="$(_AndroidUseMarshalMethods)" IntermediateOutputDirectory="$(IntermediateOutputPath)" - ResolvedAssemblies="@(_ResolvedAssemblies)" + ResolvedAssemblies="@(_AndroidResolvedAssembliesToScan)" SkipJniAddNativeMethodRegistrationAttributeScan="$(_SkipJniAddNativeMethodRegistrationAttributeScan)" SupportedAbis="@(_BuildTargetAbis)" TypemapImplementation="$(AndroidTypeMapImplementation)" diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs index ee0ff31d17e..e35da06a952 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs @@ -93,27 +93,62 @@ public void CheckDebugModeWithTrimming ([Values (AndroidRuntime.CoreCLR)] Androi string.Join (Environment.NewLine, missingFiles))); } - [Test] [NonParallelizable] // Commonly fails NuGet restore - public void CheckIncludedAssemblies ([Values (false, true)] bool usesAssemblyStores, [Values (AndroidRuntime.CoreCLR)] AndroidRuntime runtime) + [TestCase (false, AndroidRuntime.CoreCLR)] + [TestCase (true, AndroidRuntime.CoreCLR)] + [TestCase (true, AndroidRuntime.MonoVM)] + public void CheckIncludedAssemblies (bool usesAssemblyStores, AndroidRuntime runtime) { if (!usesAssemblyStores && runtime == AndroidRuntime.CoreCLR) { Assert.Ignore ("CoreCLR only supports builds with assembly stores."); return; } + var injectPackagedSatellite = new Import (() => "InjectPackagedSatellite.targets") { + TextContent = () => +""" + + + + <_ResolvedAssemblies Include="@(_AndroidResolvedSatellitePaths)"> + <_InjectedPackagedSatellite>true + + + + + + + <_ResolvedAssemblies + Remove="@(_ResolvedAssemblies)" + Condition=" '%(_ResolvedAssemblies._InjectedPackagedSatellite)' == 'true' " /> + + + +""" + }; var proj = new XamarinAndroidApplicationProject { - IsRelease = true + IsRelease = true, + Imports = { injectPackagedSatellite }, }; AndroidTargetArch[] supportedArches = new[] { runtime switch { - AndroidRuntime.MonoVM => AndroidTargetArch.Arm, + AndroidRuntime.MonoVM => AndroidTargetArch.Arm64, AndroidRuntime.CoreCLR => AndroidTargetArch.Arm64, _ => throw new NotSupportedException ($"Unsupported runtime '{runtime}'") } }; proj.SetRuntime (runtime); + if (runtime == AndroidRuntime.MonoVM) { + proj.SetProperty ("_DisableCheckForUnsupportedMonoMobileRuntime", "true"); + } proj.SetProperty ("AndroidUseAssemblyStore", usesAssemblyStores.ToString ()); proj.SetRuntimeIdentifiers (supportedArches); proj.PackageReferences.Add (new Package { @@ -157,6 +192,10 @@ public void CheckIncludedAssemblies ([Values (false, true)] bool usesAssemblySto using (var b = CreateApkBuilder ()) { Assert.IsTrue (b.Build (proj), "build should have succeeded."); + if (runtime == AndroidRuntime.MonoVM) { + Assert.IsTrue (b.LastBuildOutput.Any (line => line.Contains ("InjectedPackagedSatellite=", StringComparison.Ordinal)), + "The test should expose a packaged satellite assembly to Java stub generation."); + } var apk = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, $"{proj.PackageName}-Signed.apk"); var helper = new ArchiveAssemblyHelper (apk, usesAssemblyStores); From 6a8c9792904578cc538688ee44de854bc9a57bc1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Aug 2026 09:54:27 +0000 Subject: [PATCH 3/4] Clarify satellite assembly convention Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> --- .../targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets index 0d145205dd0..e83b0cb91ea 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets @@ -50,7 +50,7 @@ <_MergedManifestDocuments Condition=" '$(AndroidManifestMerger)' == 'legacy' " Include="@(ExtractedManifestDocuments)" /> - + <_AndroidResolvedAssembliesToScan Include="@(_ResolvedAssemblies)" Condition=" !$([System.String]::Copy('%(_ResolvedAssemblies.Filename)').ToLowerInvariant().EndsWith('.resources')) " /> From 4bd237388778cd2a6d62dca861fff25602216846 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Aug 2026 06:47:04 +0000 Subject: [PATCH 4/4] Fix satellite regression test injection Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> --- .../Tests/Xamarin.Android.Build.Tests/PackagingTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs index e35da06a952..48013d43bfc 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs @@ -112,7 +112,7 @@ public void CheckIncludedAssemblies (bool usesAssemblyStores, AndroidRuntime run AfterTargets="_PrepareAssemblies" Condition=" '$(UseMonoRuntime)' == 'true' "> - <_ResolvedAssemblies Include="@(_AndroidResolvedSatellitePaths)"> + <_ResolvedAssemblies Include="@(ReferenceSatellitePaths)"> <_InjectedPackagedSatellite>true