Skip to content

[TrimmableTypeMap] Unify InTune/method replacement support between AndroidTypeManager and TrimmableTypeMapTypeManager #10968

@simonrozsival

Description

@simonrozsival

Part of #10788

Problem

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
  • GetReplacementMethodInfoCore() — maps methods to replacement implementations (instance → static conversions)
  • GetStaticMethodFallbackTypesCore() — hardcoded desugaring patterns (Desugar*$_CC, *$-CC)

Considerations

  • The native P/Invoke calls (_monodroid_lookup_replacement_type, _monodroid_lookup_replacement_method_info) may not be trimming-safe — need to verify
  • ManagedTypeManager already has a non-native implementation of GetStaticMethodFallbackTypesCore — could be reused
  • Consider whether InTune support is even needed in the trimmable (NativeAOT) path, or only CoreCLR

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions