Skip to content

[TrimmableTypeMap] Add UCO wrappers, RegisterNatives, and IAndroidCallableWrapper#10831

Draft
simonrozsival wants to merge 3 commits intodev/simonrozsival/trimmable-typemap-03-generatorsfrom
dev/simonrozsival/trimmable-typemap-03b-uco-register-natives
Draft

[TrimmableTypeMap] Add UCO wrappers, RegisterNatives, and IAndroidCallableWrapper#10831
simonrozsival wants to merge 3 commits intodev/simonrozsival/trimmable-typemap-03-generatorsfrom
dev/simonrozsival/trimmable-typemap-03b-uco-register-natives

Conversation

@simonrozsival
Copy link
Member

@simonrozsival simonrozsival commented Feb 18, 2026

Part of #10799

Summary

Adds ACW (Android Callable Wrapper) support to TypeMap proxy types, building on the groundwork from PR #10808.

Changes

  • UcoMethodData/UcoConstructorData/NativeRegistrationData model types
  • ModelBuilder: generates UCO method wrappers, constructor wrappers, and native method registrations for ACW types
  • TypeMapAssemblyEmitter: emits [UnmanagedCallersOnly] UCO methods, UCO constructor wrappers, RegisterNatives, IAndroidCallableWrapper interface implementation
  • IsAcw detection for types that need JNI native method registration
  • Cross-assembly IgnoresAccessChecksTo for UCO callback types

Tests

  • Tests for all UCO/RegisterNatives generation scenarios (ACW detection, UCO methods, UCO constructors, native registrations)

Stacked PRs:

  1. PR [TrimmableTypeMap] Add TypeMap proxy groundwork with CreateInstance #10808 — Proxy groundwork with CreateInstance
  2. PR [TrimmableTypeMap] Add UCO wrappers, RegisterNatives, and IAndroidCallableWrapper #10831this PR — UCO wrappers + RegisterNatives
  3. PR [TrimmableTypeMap] Add JCW Java source generator #10830 — JCW Java Source Generation

@simonrozsival simonrozsival added Area: NativeAOT Issues that only occur when using NativeAOT. Area: CoreCLR Issues that only occur when using CoreCLR. copilot `copilot-cli` or other AIs were used to author this trimmable-type-map labels Feb 18, 2026
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from 7b5ecb7 to a03f521 Compare February 18, 2026 18:42
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from 132b798 to 9914c6e Compare February 18, 2026 18:42
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from a03f521 to 6772756 Compare February 18, 2026 22:55
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from 9914c6e to 0c90133 Compare February 18, 2026 22:55
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from 6772756 to 0ecbfd8 Compare February 18, 2026 22:59
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch 2 times, most recently from d18059a to a235422 Compare February 18, 2026 23:13
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch 2 times, most recently from f8d83fe to 1b05635 Compare February 18, 2026 23:46
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from e2a6a83 to cd59ff8 Compare February 18, 2026 23:46
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from 1b05635 to 8287fe9 Compare February 18, 2026 23:52
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch 2 times, most recently from 5cf8820 to b6371e0 Compare February 19, 2026 06:54
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch 2 times, most recently from 5d561c1 to b582ff5 Compare February 19, 2026 08:45
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from b6371e0 to dcdc6cf Compare February 19, 2026 08:45
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from b582ff5 to 4c8b459 Compare February 19, 2026 09:27
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from dcdc6cf to 687f7be Compare February 19, 2026 09:27
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from 4c8b459 to e3e4f05 Compare February 19, 2026 10:03
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from 687f7be to 10e549d Compare February 19, 2026 10:03
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from e3e4f05 to 9449651 Compare February 19, 2026 10:09
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from 10e549d to f2a2cfa Compare February 19, 2026 10:09
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Move UCO-specific JniSignatureHelper methods (JniParamKind, ParseParameterTypes,
ParseReturnType, EncodeClrType, ParseSingleType) and their tests to PR #10831.

Move JCW-specific scanner properties (BaseJavaName, ImplementedInterfaceJavaNames,
JavaConstructors, JavaConstructorInfo) and resolver methods (ResolveBaseJavaName,
ResolveImplementedInterfaceJavaNames, ResolveInterfaceJniName, BuildJavaConstructors)
to PR #10830.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from f2a2cfa to b709256 Compare February 19, 2026 10:59
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from b709256 to ca74680 Compare February 19, 2026 12:00
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from d9bd575 to 163f892 Compare February 19, 2026 12:07
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from ca74680 to 2574cc1 Compare February 19, 2026 12:07
simonrozsival added a commit that referenced this pull request Feb 19, 2026
- Replace try-finally cleanup with IDisposable temp directories
- Add IGCUserPeer infrastructure methods (monodroidAddReference,
  monodroidClearReferences, refList) to JCW Java source generator
- Port improved UCO attribute and NegativeEdgeCase tests from #10831

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival and others added 2 commits February 19, 2026 14:26
…lableWrapper

Add ACW (Android Callable Wrapper) support to TypeMap proxy types:

- UcoMethodData/UcoConstructorData/NativeRegistrationData model types
- ModelBuilder: generates UCO method wrappers, constructor wrappers,
  and native method registrations for ACW types
- TypeMapAssemblyEmitter: emits [UnmanagedCallersOnly] UCO methods,
  UCO constructor wrappers, RegisterNatives, IAndroidCallableWrapper
- IsAcw detection for types that need JNI native method registration
- Cross-assembly IgnoresAccessChecksTo for UCO callback types
- Tests for all UCO/RegisterNatives generation scenarios

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add JniParamKind enum, ParseParameterTypes, ParseReturnType,
EncodeClrType, ParseSingleType, and their test classes
(JniSignatureHelperTests, NegativeEdgeCase) — moved from PR #10808.

Also add back JavaConstructors property, JavaConstructorInfo record,
and BuildJavaConstructors scanner method needed by ModelBuilder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from 8bc6d91 to 1b0a135 Compare February 19, 2026 13:28
simonrozsival added a commit that referenced this pull request Feb 19, 2026
- Replace try-finally cleanup with IDisposable temp directories
- Add IGCUserPeer infrastructure methods (monodroidAddReference,
  monodroidClearReferences, refList) to JCW Java source generator
- Port improved UCO attribute and NegativeEdgeCase tests from #10831

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix UCO attribute test to verify actual UnmanagedCallersOnlyAttribute
  type name instead of just Assert.NotEmpty(attrs)
- Replace non-asserting NegativeEdgeCase Theory with three Facts that
  each assert a specific expected behavior
- Remove duplicate SkipSingleType method; ParseParameterTypeStrings
  now reuses ParseSingleType to advance the index

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03b-uco-register-natives branch from 1b0a135 to a59275c Compare February 19, 2026 13:29
simonrozsival added a commit that referenced this pull request Feb 19, 2026
- Replace try-finally cleanup with IDisposable temp directories
- Add IGCUserPeer infrastructure methods (monodroidAddReference,
  monodroidClearReferences, refList) to JCW Java source generator
- Port improved UCO attribute and NegativeEdgeCase tests from #10831

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CoreCLR Issues that only occur when using CoreCLR. Area: NativeAOT Issues that only occur when using NativeAOT. copilot `copilot-cli` or other AIs were used to author this trimmable-type-map

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments