Skip to content

[Mono.Android.Export] Remove the legacy export assembly - #13111

Merged
simonrozsival merged 1 commit into
mainfrom
simonrozsival-verify-export-assembly-use
Oct 13, 2026
Merged

simonrozsival merged 1 commit into
mainfrom
simonrozsival-verify-export-assembly-use

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Trimmable type maps generate Java-to-managed export callbacks at build time. Mono.Android.Export.dll still ships in the targeting and runtime packs, but its legacy runtime callback generator is no longer needed on the supported path.

Remove the project and its callback/code-generation implementation, the solution and pack entries, the reflection bridge, friend-assembly declaration, obsolete build/linker handling, and XA4210 diagnostic. Keep the public Java.Interop.BaseExportAttribute, Java.Interop.ExportAttribute, and Java.Interop.ExportFieldAttribute types supported through trimmable type maps.

Update export fixtures to build without explicitly referencing the removed assembly, retain the APK assertion that the DLL is absent, and rename the device fixture to ExportAttributeBuildTest.

Breaking change

Mono.Android.Export.dll is no longer provided by the targeting or runtime packs. Applications and libraries with explicit references must remove them; [Export] and [ExportField] need no replacement assembly reference. Document this in Documentation/release-notes/mono-android-export-removal.md.

No linked issue.

Local validation

Command Result
make prepare Passed after repairing an incomplete local Android 37.0 platform installation.
./dotnet-local.sh build Microsoft.Android.slnx -c Debug -p:DisableApiCompatibilityCheck=True Passed.
./dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'Name~ExportAttributeBuildDoesNotPackageLegacyHelper' -v minimal Passed: 1/1. Builds an APK using [Export] without the legacy assembly reference and verifies the DLL is not packaged.
make all Failed at the API-compatibility gate on RequiresPermissionAttribute mismatches for Android APIs outside this change. The successful solution build above disables that gate; it is not a successful API-compatibility check.
git diff --check Passed.

The ExportAttributeBuildTest device integration run completed with 2 passed and 4 failed. Two no-embedding Release cases failed during CoreCLR/FastDev startup because System.Private.CoreLib.dll was missing; two other cases failed to start the activity (Error type 3). The run involved both an emulator and a physical device despite requesting the emulator. These failures remain unresolved: the logs do not report a missing Mono.Android.Export lookup, but runtime validation is not fully passing.

Generated non-English localization files and external API-doc metadata are left untouched.

Trimmable type maps generate Java callbacks at build time, so the\nlegacy runtime callback generator is no longer needed.  Remove the\nassembly from the solution, targeting packs, and runtime packs, along\nwith its reflection bridge and obsolete build and linker handling.\n\nKeep the public export attributes supported through trimmable type\nmaps, update export test fixtures, and document the breaking removal.\nCustomers with explicit assembly references must remove them.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

On-device export callback validation still fails in four of six configurations.

0 open findings

What changed in this PR

Removes the obsolete Mono.Android.Export assembly now that trimmable type maps generate export callbacks at build time.

Changes:

  • Deletes the legacy runtime callback generator and assembly.
  • Removes pack, linker, diagnostic, and solution integration.
  • Updates export tests, documentation, and release notes.
File Description
tests/​MSBuildDeviceIntegration/​Tests/​ExportAttributeBuildTest.cs Removes explicit assembly references and renames export device coverage.
src/​Xamarin.Android.NamingCustomAttributes/​Java.Interop/​ExportFieldAttribute.cs Removes dynamic callback creation.
src/​Xamarin.Android.NamingCustomAttributes/​Java.Interop/​ExportAttribute.cs Removes dynamic callback creation.
src/​Xamarin.Android.NamingCustomAttributes/​Java.Interop/​BaseExportAttribute.cs Removes the reflection bridge to the legacy assembly.
src/​Xamarin.Android.Build.Tasks/​Utilities/​MonoAndroidHelper.Linker.cs Removes the assembly from known linker assemblies.
src/​Xamarin.Android.Build.Tasks/​Utilities/​MonoAndroidHelper.cs Removes forced retention handling.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​TrimmableTypeMapBuildTests.cs Removes obsolete explicit references from export tests.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​GeneratePackageManagerJavaTests.cs Uses a generic excluded assembly fixture.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​PackagingTest.cs Tests export builds without the legacy reference.
src/​Xamarin.Android.Build.Tasks/​Properties/​Resources.resx Removes XA4210.
src/​Xamarin.Android.Build.Tasks/​Properties/​Resources.Designer.cs Removes the generated XA4210 accessor.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Trimmable.targets Removes packaging exclusion metadata.
src/​Xamarin.Android.Build.Tasks/​Linker/​MonoDroid.Tuner/​AddKeepAlivesHelper.cs Removes a stale legacy-source reference.
src/​Mono.Android/​Properties/​AssemblyInfo.cs.in Removes legacy friend-assembly access.
src/​Mono.Android.Export/​Properties/​AssemblyInfo.cs Deletes assembly metadata.
src/​Mono.Android.Export/​Mono.CodeGeneration/​MonoAndroidExport.cs Deletes legacy code-generation metadata.
src/​Mono.Android.Export/​Mono.CodeGeneration/​Exp.cs Deletes expression helpers.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeWriter.cs Deletes code-writing support.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeWhile.cs Deletes while-loop generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeWhen.cs Deletes conditional-expression generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeVariableReference.cs Deletes variable-reference generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeVariableDeclaration.cs Deletes variable declaration generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeValueReference.cs Deletes value-reference infrastructure.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeUnaryOperation.cs Deletes unary-operation generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeTryBlock.cs Deletes exception-block generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeSelfIncrement.cs Deletes increment generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeSelect.cs Deletes conditional selection generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeReturn.cs Deletes return generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodePropertyReference.cs Deletes property-reference generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeProperty.cs Deletes dynamic property generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeOr.cs Deletes logical-OR generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeNotEquals.cs Deletes inequality generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeNewArray.cs Deletes array-construction generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeNew.cs Deletes object-construction generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeModule.cs Deletes dynamic module generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeMethodCall.cs Deletes method-call generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeMethod.cs Deletes dynamic method generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeLiteral.cs Deletes literal generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeItem.cs Deletes base code-generation types.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeIs.cs Deletes type-test generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeIncrement.cs Deletes increment helpers.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeIf.cs Deletes conditional statement generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeGenerationHelper.cs Deletes IL and conversion helpers.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeForeach.cs Deletes foreach generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeFor.cs Deletes for-loop generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeFieldReference.cs Deletes field-reference generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeExpression.cs Deletes expression infrastructure.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeEquals.cs Deletes equality generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeDecrement.cs Deletes decrement generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeCustomAttribute.cs Deletes dynamic attribute generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeClass.cs Deletes dynamic class generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeCast.cs Deletes cast generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeBuilder.cs Deletes the legacy code builder.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeBlock.cs Deletes code-block generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeBinaryOperation.cs Deletes binary-operation infrastructure.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeBinaryComparison.cs Deletes comparison generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeAssignment.cs Deletes assignment generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeArrayLength.cs Deletes array-length generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeArrayItem.cs Deletes array-item generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeArithmeticOperation.cs Deletes arithmetic generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeArgumentReference.cs Deletes argument-reference generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeArgument.cs Deletes argument generation.
src/​Mono.Android.Export/​Mono.CodeGeneration/​CodeAnd.cs Deletes logical-AND generation.
src/​Mono.Android.Export/​Mono.Android.Export.csproj Deletes the legacy project and pack-copy targets.
src/​Mono.Android.Export/​CallbackCode.cs Deletes runtime callback and marshalling generation.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​Generator/​ExportMethodDispatchEmitter.cs Removes references to the legacy implementation.
Microsoft.Android.slnx Removes the project from the solution.
external/​Java.Interop/​src/​Java.Interop.Tools.Diagnostics/​Java.Interop.Tools.Diagnostics/​Diagnostic.cs Removes XA4210 documentation.
Documentation/​release-notes/​mono-android-export-removal.md Documents the breaking removal and migration.
Documentation/​project-docs/​ExploringSources.md Removes the deleted project from source documentation.
Documentation/​docs-mobile/​messages/​index.md Removes XA4210 from the diagnostic index.
build-tools/​create-packs/​Microsoft.Android.Runtime.Managed.proj Removes the assembly from runtime packs.
build-tools/​create-packs/​Microsoft.Android.Ref.proj Removes the assembly from reference packs.
.github/​skills/​tests/​references/​test-catalog.md Updates the export device-test filter.
Files not reviewed (1)
  • src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Generated file

🧠 Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member

/review

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Android PR Reviewer completed successfully!

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #13111

@simonrozsival simonrozsival added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Oct 13, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Needs Changes

Findings: 0 errors · 1 warning · 0 suggestions

The assembly, pack, diagnostic, and callback-generator removals are consistent, and the retained trimmable type-map path has useful build-level coverage. One runtime coverage gap remains for [ExportField] after removing the legacy helper.

CI is currently red in Package Tests macOS > Tests > APKs 1 (Azure build 1633246); the other reported lanes passed. Azure timeline/log access required authentication in this environment, so the failure remains unclassified and should be resolved or triaged before merge.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #13111 · copilot · gpt56 · 172 AIC · ⌖ 11.2 AIC · ⊞ 26.4K
Comment /review to run again

Comment thread tests/MSBuildDeviceIntegration/Tests/ExportAttributeBuildTest.cs
@simonrozsival
simonrozsival enabled auto-merge (squash) October 13, 2026 16:44
@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complete 74-file source and separate integration reviews found no high-confidence blocker. The retained scanner/direct-dispatch/native-registration path preserves supported Export and ExportField attributes without the deleted reflection bridge. Existing included device tests already read static primitive, static object and instance primitive exported fields through JNI; their execution was not independently claimed. Pack, linker, solution, generated diagnostic and metadata consumers are consistent. The documented legacy-assembly removal and explicit-reference migration remain accepted breaking-change scope.

@simonrozsival
simonrozsival merged commit 5c2fa0a into main Oct 13, 2026
42 checks passed
@simonrozsival
simonrozsival deleted the simonrozsival-verify-export-assembly-use branch October 13, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants