You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[TrimmableTypeMap] Unify InTune/method replacement support between AndroidTypeManager and TrimmableTypeMapTypeManager #10968
AndroidTypeManager implements InTune/MDM support via GetReplacementTypeCore() and GetReplacementMethodInfoCore(). These handle Java library desugaring by looking up replacement types and methods via native _monodroid_lookup_replacement_type() and _monodroid_lookup_replacement_method_info() calls.
The new TrimmableTypeMapTypeManager (added in #10967) does not implement this functionality. Apps using InTune SDK or Java library desugaring will not work correctly with the trimmable typemap path.
Proposed solution
Extract the replacement logic from AndroidTypeManager into a shared base class or helper that both type managers can use. This avoids duplicating the InTune-specific code while keeping the trimmable path clean.
Key methods to share:
GetReplacementTypeCore() — looks up desugared types
The remapping data is currently generated as LLVM IR (JniRemappingAssemblyGenerator : LlvmIrComposer) and compiled into the native library. The native JniRemapping::lookup_replacement_type and lookup_replacement_method_info are simple linear scans over these build-time generated arrays.
Short-term (v1): Use the same P/Invoke (_monodroid_lookup_replacement_type, _monodroid_lookup_replacement_method_info) from TrimmableTypeMapTypeManager. The native tables exist in the binary regardless of typemap path — the P/Invoke works on all platforms (Mono, CoreCLR, NativeAOT).
Long-term (low priority): Generate the remapping tables as managed IL (e.g., as part of the TypeMap assembly or a separate generated assembly) instead of LLVM IR. This would allow doing the lookups entirely in managed code, eliminating the P/Invoke and native dependency. Same approach as we did with the typemap itself (TypeMapping API instead of native binary tables).
Activity
simonrozsival commentedon Mar 18, 2026
Implementation note: managed vs native lookups
The remapping data is currently generated as LLVM IR (
JniRemappingAssemblyGenerator : LlvmIrComposer) and compiled into the native library. The nativeJniRemapping::lookup_replacement_typeandlookup_replacement_method_infoare simple linear scans over these build-time generated arrays.Short-term (v1): Use the same P/Invoke (
_monodroid_lookup_replacement_type,_monodroid_lookup_replacement_method_info) fromTrimmableTypeMapTypeManager. The native tables exist in the binary regardless of typemap path — the P/Invoke works on all platforms (Mono, CoreCLR, NativeAOT).Long-term (low priority): Generate the remapping tables as managed IL (e.g., as part of the TypeMap assembly or a separate generated assembly) instead of LLVM IR. This would allow doing the lookups entirely in managed code, eliminating the P/Invoke and native dependency. Same approach as we did with the typemap itself (TypeMapping API instead of native binary tables).