Skip to content

Proposal: Create TypeMapEntryAssembly ItemGroup to indicate assemblies that should be used as entry points for TypeMapHandler #121138

@jtschuster

Description

@jtschuster

IOS and Android are trimmed as libraries and have no EntryPointAssembly in the trimmer that the TypeMapHandler can use as the root for marking TypeMap attributes and types. ILLink and ILC need to provide a way for library apps to set the entrypoint assembly (or assemblies) for type mapping. Following the example of the UnmanagedEntryPointsAssembly item group for ILC, it seems natural to create a new TypeMapEntryAssembly item group to indicate the entrypoints for the TypeMap handling.

See #120271 for additional context and conversation.

Open questions:

Can there be multiple TypeMapAssemblyItems? If so, can there for both Exe and Library projects, or just Library?

I think it makes sense to allow multiple, especially since there is an API that allows setting and resetting the entry assembly. This also aligns with UnmanagedEntryPointsAssembly

What are the defaults? Are the implicitly set in MSBuild and explicitly passed to ILLink, or implicitly set in ILLink? Do we assume the entrypoint assembly for exe applications if no TypeMapEntryAssembly is explicitly provided to the ILLink process, or do we require it to be passed explicitly? Do we assume the IntermediateAssembly is a TypeMapEntryAssembly for Library apps too?

I think it makes sense to infer the items in MSBuild, but should be passed explicitly to ILLink. I believe this also generally aligns with UnmanagedEntryPointsAssembly. For Exe applications, the IntermediateAssembly will be added to TypeMapEntryAssembly by default. For Libraries it would need to be done manually or by setting a property (for example, SetTypeMapEntryAssembly) to true.

cc @dotnet/illink @dotnet/ilc-contrib @simonrozsival

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzers

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions