[tests] Move type map rewrite tests to net11 - #12736
Merged
Merged
Conversation
Run the JNI rewriter cases that directly consume the trimmable type map generator in the existing net11 integration test assembly. This removes the accidental transitive reference from the net10 Xamarin.Android.Build.Tests project. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes cleanly relocate the typemap-dependent tests to the net11 integration test project and preserve the warning assertions without introducing compile or behavioral issues in the remaining net10 test suite.
Pull request overview
Moves the two JNI assembly rewriter tests that depend on Microsoft.Android.Sdk.TrimmableTypeMap APIs out of the net10.0 Xamarin.Android.Build.Tests project into the existing net11 trimmable type map integration test project, restoring cross-platform compilation after the tasks/test refactoring in #12678 while preserving the “no XA4326 emitted” assertions.
Changes:
- Added xUnit-based
JniAssemblyRewriterTeststo theMicrosoft.Android.Sdk.TrimmableTypeMap.IntegrationTestsproject to cover rewriting generated typemap images. - Extended the integration test
MockBuildEngineto optionally captureBuildWarningEventArgsso tests can assert XA4326 is not logged. - Removed the typemap-generator-dependent tests (and the typemap
using) from theXamarin.Android.Build.TestsNUnit suite to eliminate the broken transitive dependency.
File summaries
| File | Description |
|---|---|
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/MockBuildEngine.cs | Allows capturing warning events for assertions via TaskLoggingHelper in integration tests. |
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/JniAssemblyRewriterTests.cs | New xUnit tests validating typemap rewrite output and asserting XA4326 is not emitted. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/JniRemapping/JniAssemblyRewriterTests.cs | Removes the two typemap-generator tests from the net10.0 test project to restore compilation. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
simonrozsival
approved these changes
Sep 9, 2026
This was referenced Sep 9, 2026
jonathanpeppers
pushed a commit
that referenced
this pull request
Sep 9, 2026
Remove the primary-constructor parameter list from the integration tests' `MockBuildEngine`, fixing CS0111 on `main`. #12724 (`ecef743e91614754e6e1ab0ed7ed1834ecdedf5c`) added that signature after #12736 had introduced an explicit constructor with the same optional warning-list parameter. The merged combination left both constructors in place. This one-line repair keeps the explicit constructor and warning collection unchanged, including the existing no-XA4326 assertions; it does not change the production generator. The failure appears in the Linux and macOS builds of [Azure DevOps build 1588988](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1588988): MockBuildEngine.cs(15,9): error CS0111: Type 'MockBuildEngine' already defines a member called 'MockBuildEngine' with the same parameter types. Based directly on current `main` (`d907cd735615d5d17616cbba9e1a4aeef99ab61d`), independently of #12722. Rechecked live main and open PRs before editing and immediately before opening this PR; no equivalent fix was found. ### Validation - Compiled the actual `MockBuildEngine.cs` using an isolated .NET SDK `11.0.100-rc.1.26431.118`, its net11.0 reference assemblies, and its real `Microsoft.Build.Framework.dll`. The same command reproduced CS0111 before the fix and succeeded without diagnostics after it. - An artifacts-only host driver compiled together with the fixed source passed default construction, explicit `null`, and supplied-list cases. Logging with default/null was harmless; successive warnings appended to the supplied list with object identity preserved. - The fixed file is byte-for-byte identical to its last working main version, immediately before #12724. <details> <summary>Direct compiler command</summary> `SDK` points to the private SDK copy and `OUT` to the session artifact directory; run from the repository root: ```bash refs=() for ref in "$SDK"/packs/Microsoft.NETCore.App.Ref/*/ref/net11.0/*.dll; do refs+=("-r:$ref") done "$SDK/dotnet" exec \ "$SDK/sdk/11.0.100-rc.1.26431.118/Roslyn/bincore/csc.dll" \ -nologo -target:library -nullable:enable -langversion:latest \ "-out:$OUT/MockBuildEngine.dll" "${refs[@]}" \ "-r:$SDK/sdk/11.0.100-rc.1.26431.118/Microsoft.Build.Framework.dll" \ tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/MockBuildEngine.cs ``` </details> **Integration-test limit:** Attempted `dotnet test tests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests/Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests.csproj --no-restore -p:BuildProjectReferences=false --filter 'FullyQualifiedName~JniAssemblyRewriterTests|FullyQualifiedName~GeneratedTypeMapRewriterTests' -v minimal`, but no tests executed in the unprepared worktree. A subsequent `dotnet build` of the same project with `--no-restore -p:BuildProjectReferences=false -v minimal` confirmed NETSDK1004 (missing `project.assets.json`). The local Android build outputs are also absent. No full bootstrap or device tests were run, and older installed generator binaries were not substituted for current-main integration validation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Microsoft.Android.Sdk.TrimmableTypeMaptypes from thenet10.0Xamarin.Android.Build.Testsassembly to the existingnet11.0trimmable type map integration test assemblyXA4326warning is emittedXamarin.Android.Build.TasksThis fixes the cross-platform compilation regression exposed by Azure DevOps build 1587962 without adding a
net11.0project reference to thenet10.0test project.Validation
.\dotnet-local.cmd build src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Xamarin.Android.Build.Tests.csproj -v:minimal.\dotnet-local.cmd test tests\Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests\Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests.csproj -v:minimal --filter "FullyQualifiedName~JniAssemblyRewriterTests"(2 passed)