Skip to content

Fix slow Android debug startup caused by unbundled assembly lookups#472

Merged
StuartFerguson merged 2 commits intomainfrom
copilot/investigate-slow-startup-issue
Mar 5, 2026
Merged

Fix slow Android debug startup caused by unbundled assembly lookups#472
StuartFerguson merged 2 commits intomainfrom
copilot/investigate-slow-startup-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 5, 2026

On debug builds, the .NET Android runtime attempts to load each assembly from the APK bundle first, fails (Fast Deployment places them outside the APK), then falls back to the deployed location. With 100+ assemblies, this double-lookup adds 20+ seconds to startup and can trigger ANR warnings on the emulator.

Change

  • Added EmbedAssembliesIntoApk=true to the Debug Android PropertyGroup in TransactionProcessor.Mobile.csproj, embedding assemblies directly in the APK and eliminating the failed-lookup fallback entirely.
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net10.0-android|AnyCPU'">
  <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>

Release builds are unaffected.

Original prompt

This section details on the original issue you should resolve

<issue_title>Slow Application Startup</issue_title>
<issue_description>App takes a long time to load when debugging. Somtimes the emulator thinks the app has hung.

Looking at the logs there are a lot of error loading bundled assemblies, can this be investigated please.

Here are the errors I captured:

03-05 11:24:38.355 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly TransactionProcessor.Mobile.dll
03-05 11:24:38.356 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Mono.Android.dll
03-05 11:24:38.363 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Runtime.dll
03-05 11:24:38.367 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Java.Interop.dll
03-05 11:24:38.375 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Runtime.InteropServices.dll
03-05 11:24:39.210 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Mono.Android.Runtime.dll
03-05 11:24:39.240 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Collections.dll
03-05 11:24:39.240 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Collections.Concurrent.dll
03-05 11:24:39.241 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Threading.dll
03-05 11:24:40.637 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Threading.Thread.dll
03-05 11:24:40.642 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Diagnostics.StackTrace.dll
03-05 11:24:41.015 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Maui.dll
03-05 11:24:41.222 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Memory.dll
03-05 11:24:42.532 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Maui.Essentials.dll
03-05 11:24:42.534 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Xamarin.AndroidX.Core.dll
03-05 11:24:43.026 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.Console.dll
03-05 11:24:43.477 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.ComponentModel.dll
03-05 11:24:43.711 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.VisualStudio.DesignTools.MobileTapContracts.dll
03-05 11:24:43.844 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly netstandard.dll
03-05 11:24:44.780 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.VisualStudio.DesignTools.TapContract.dll
03-05 11:24:45.069 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.DependencyInjection.Abstractions.dll
03-05 11:24:45.591 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.Hosting.Abstractions.dll
03-05 11:24:45.592 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Maui.Controls.dll
03-05 11:24:45.598 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly System.ObjectModel.dll
03-05 11:24:45.634 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Maui.Controls.Xaml.dll
03-05 11:24:45.989 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly CommunityToolkit.Maui.dll
03-05 11:24:46.124 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly CommunityToolkit.Maui.Core.dll
03-05 11:24:46.177 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.Configuration.dll
03-05 11:24:46.363 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.Configuration.Abstractions.dll
03-05 11:24:46.389 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.Diagnostics.Abstractions.dll
03-05 11:24:46.397 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.Logging.Abstractions.dll
03-05 11:24:46.680 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly TransactionProcessor.Mobile.BusinessLogic.dll
03-05 11:24:46.809 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.Caching.Memory.dll
03-05 11:24:46.812 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.Logging.dll
03-05 11:24:47.187 W/monodroid-assembly(20967): open_from_bundles: failed to load bundled assembly Microsoft.Extensions.Primitives.dll
03-05 11:24:47.351 ...


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate slow application startup and bundled assembly errors Fix slow Android debug startup caused by unbundled assembly lookups Mar 5, 2026
@StuartFerguson StuartFerguson marked this pull request as ready for review March 5, 2026 11:35
@StuartFerguson StuartFerguson merged commit c92c896 into main Mar 5, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slow Application Startup

2 participants