Skip to content

[CoreCLR] Build R2R images for SDK assemblies in Debug builds #10760

@simonrozsival

Description

@simonrozsival

Android framework version

net11.0-android (Preview)

Affected platform version

.NET 11

Description

To improve runtime performance in Debug builds, we could pre-compile R2R images for all the libraries (Mono.Android.dll, ideally also Microsoft.Maui.Controls.dll and other MAUI assemblies) which don't change after they are restored.

The idea is to create the R2R image only during the first Debug build for a given target RID and cache this image in the obj/Debug/<rid>/r2r directory. This step should be skipped on any subsequent builds of the app (requires a build test).

The pre-built native images need to be included in the app alongside the managed assemblies so that CoreCLR will load them and avoid JITting code at startup. I wonder if we should embed the images into the .dll directly instead of creating a separate .ni.dll so that we don't need to make any changes to FastDev.

Open questions:

  • Can we build a composite image of all .NET for Android and .NET MAUI assemblies?
  • Does this change require changes to FastDev?
  • Do we need to make changes to AssemblyStoreBuilder (ClrAddIgnoredNativeImageAssembly), or is it only relevant for Release builds?

Steps to Reproduce

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Labels

Area: CoreCLRIssues that only occur when using CoreCLR.needs-triageIssues that need to be assigned.

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions