dotnet / dotnet/runtime

TypeMap API: For trimmed and nativeaot builds, provide a list of the types kept by the typemap

Open
#120,204 13 comments 0 reactions 0 assignees View on GitHub
area-Tools-ILLink
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

In Android (and maybe iOS), it is necessary to create Java wrapper types and native glue stubs that call into .NET. It's not necessary to keep these java types and native methods for .NET types that are trimmed away, but there's not an easy way to tell what is necessary for the app. If the TypeMap output the target types in the typemap that are kept, it would greatly simplify and speed up the build process, and create smaller applications.
Alternatively, the android build could inspect every single assembly in trimmed apps, and parse the ILC trimming xml logger for nativeaot apps.

Open questions:

Android works around one Java class mapping to multiple .NET types with a "mapper class" in the TypeMap that points to each of the aliases. This would require additional bookkeeping in the build to remember which types are mapper classes and which java classes and stubs they should keep for those mapper types.

cc. @simonrozsival @AaronRobinsonMSFT

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.