dotnet / dotnet/android

[TrimmableTypeMap] Enable deferred Export device coverage for JCW-only shapes

Open
#11,289 0 comments 0 reactions 0 assignees View on GitHub
needs-triage
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 19h
Merged PRs (30d)
252

Description

## Summary

PR #11123 adds trimmable `[Export]` / `[ExportField]` scanner, generator, and runtime dispatch support, but several end-to-end device test shapes are intentionally deferred because they currently fail before reaching the trimmable runtime path.

This issue tracks the focused follow-up needed to enable those device tests.

## Missing device coverage

`tests/Mono.Android-Tests/Mono.Android-Tests/Java.Interop/ExportTests.cs` currently enables 9 `[Export]` device tests. The following shapes remain covered only by host scanner/emitter tests and need end-to-end runtime tests once the JCW side can build them:

- enum `[Export]` parameter/return shapes
- `Java.Lang.ICharSequence` `[Export]` parameter/return shapes
- non-generic collection `[Export]` parameter/return shapes (`IList`, `IDictionary`, `ICollection`)
- `[ExportField]` runtime visibility/initialization shapes

## Current blocker

The generated Java callable wrapper path rejects or mishandles some of these shapes before runtime validation can execute:

- `CecilImporter.GetJniSignature` returns `null` for some managed enum, `ICharSequence`, and non-generic collection shapes while generating Java callable wrappers, causing the app build to fail before the trimmable export dispatch path can be exercised.
- `[ExportField]` needs separate JCW field-initializer work before runtime coverage is meaningful; current field initialization can call the exported method with the wrong static/instance shape.

## Expected outcome

After fixing the JCW side:

1. Add the deferred device tests to `ExportTests.cs`.
2. Verify they pass for the legacy typemap path that defines the contract.
3. Verify they pass for `_AndroidTypeMapImplementation=trimmable` + `UseMonoRuntime=false`.
4. Update PR/issue references so the host scanner/emitter coverage and device coverage are aligned.

Related: #10788, #10933, #11123.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.