Skip to content

[tests] Move typemap rewrite coverage to net11 - #12732

Closed
simonrozsival wants to merge 1 commit into
mainfrom
fix-typemap-rewriter-test-reference
Closed

[tests] Move typemap rewrite coverage to net11#12732
simonrozsival wants to merge 1 commit into
mainfrom
fix-typemap-rewriter-test-reference

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Fixes the compilation regression introduced by #12631 after Microsoft.Android.Sdk.TrimmableTypeMap moved to .NET 11.

The two tests that exercise both typemap generation and JNI assembly rewriting now live in Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests, which directly references both components at a compatible target framework. Pure JNI rewriter coverage remains in Xamarin.Android.Build.Tests.

This unblocks the affected flaky-CI PR builds without changing product behavior.

Move the cross-component generated typemap rewrite tests out of the net10 Build.Tests project now that the typemap generator targets net11. Keep the same assertions in the existing net11 integration test project, which references both components directly.

Fixes the solution compilation regression introduced by #12631.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 8, 2026 21:33

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.

Copilot review overview

🟡 Changes recommended

The new integration test file is missing a required using Microsoft.Android.Sdk.TrimmableTypeMap; import for referenced typemap generator types, which will break compilation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity tests/​Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/​JniAssemblyRewriterIntegrationTests.cs — ❌ error: This test file uses TypeMapAssemblyGenerator/JavaPeerInfo/etc. but does not import the…
What changed in this PR

This PR moves the end-to-end typemap generation + JNI assembly rewriting coverage into the Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests project so the tests can target a compatible framework after Microsoft.Android.Sdk.TrimmableTypeMap moved to .NET 11, while keeping pure JNI rewriter coverage in Xamarin.Android.Build.Tests.

Changes:

  • Added xUnit integration tests that generate a typemap assembly and validate JniAssemblyRewriter output against R8 mappings.
  • Updated the integration-test MockBuildEngine to record warnings emitted via TaskLoggingHelper.
  • Removed the typemap-generation-based rewrite tests from the existing NUnit JniAssemblyRewriterTests suite (leaving the rest of the rewriter tests in place).
File Description
tests/​Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/​MockBuildEngine.cs Captures warning events so integration tests can assert on emitted XA codes.
tests/​Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/​JniAssemblyRewriterIntegrationTests.cs New integration coverage combining typemap generation and JNI rewrite verification on a net11-compatible test project.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Utilities/​JniRemapping/​JniAssemblyRewriterTests.cs Removes typemap-generation-dependent rewrite tests from NUnit suite to avoid incompatible references.

Comment on lines +1 to +10
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using Microsoft.Build.Utilities;
using Xunit;
using Xamarin.Android.Tasks.JniRemapping;

@simonrozsival

Copy link
Copy Markdown
Member Author

Duplicate of #12736

@simonrozsival simonrozsival marked this as a duplicate of #12736 Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants