Repository navigation
Description
Summary
With .NET 11 Preview 6 CoreCLR Debug, a Fast Deploy build/install succeeds after a
comment-only C# edit, but the app crashes on its next launch on both physical devices
and Android emulators.
An app-defined Activity passed to Intent is resolved as java.lang.Object, causing
an ActivityNotFoundException. A clean deployment launches successfully, and
restoring the original source makes the app launch successfully again.
Reproduction
Environment:
- SDK
11.0.100-preview.6.26359.118 - Android workload
37.0.0-preview.6.59 - Physical arm64 Android device or API 36.1 arm64 emulator
Fresh Android and MAUI builds with no runtime or packaging overrides evaluated to the
same CoreCLR Debug/Fast Deploy behavior used below.
Create a fresh app:
dotnet new android -n AndroidFastDeployReproAdd a second Activity:
[Activity(Label = "Fast Deploy Result")]
public sealed class SecondActivity : Activity
{
}Launch it from MainActivity.OnCreate:
StartActivity(new Intent(this, typeof(SecondActivity)));Build and install:
dotnet build AndroidFastDeployRepro.csproj \
-c Debug -f net11.0-android -t:Install \
-p:RuntimeIdentifier=android-arm64 \
-p:UseMonoRuntime=false \
-p:EmbedAssembliesIntoApk=false \
-p:AdbTarget="-s DEVICE_SERIAL" \
/bl:{}- Launch the clean deployment. It successfully opens
SecondActivity. - Append a comment to
MainActivity.cs. - Run the same build/install command.
- Launch again.
The incremental launch fails:
android.content.ActivityNotFoundException:
Unable to find explicit activity class
{<package-name>/java.lang.Object}
Restoring the original source and rebuilding makes the launch succeed again.
The same clean-pass / incremental-fail / restored-pass sequence reproduces on a
Samsung A16 and an API 36.1 arm64 Android emulator.
Initial analysis
- The app assembly MVID changes after the comment-only edit.
_CreateApplicationSharedLibrariesrelinkslibxamarin-app.sowith the new typemap._BuildApkFastDevis skipped, so the installed APK retains the old
libxamarin-app.so.- Fast Deploy reports success and copies only the updated app DLL/PDB to
files/.__override__. - CoreCLR loads the new assembly but performs managed-to-Java lookup with the old
MVID map.
The clean and incremental APK and libxamarin-app.so hashes are identical, while the
app assembly and typemap MVID differ.
The template repro surfaces as an ActivityNotFoundException. The same mismatch was
also observed in AzureUX as no Java peer type found, followed by SIGABRT from its
unhandled-exception path.
_BuildApkFastDevStaticInputs does not include @(_ApplicationSharedLibrary), even
though _BuildApkFastDev packages that item.
Adding @(_ApplicationSharedLibrary) to the target inputs fixes the failure by
rebuilding and reinstalling the APK whenever the typemap library changes. This keeps
EmbedAssembliesIntoApk=false, but is a correctness fix rather than an assembly-only
Fast Deploy solution.
Related context:
- [CoreCLR] support for debug build typemaps #10065 added the MVID-keyed CoreCLR Debug typemap and noted that Fast Deploy typemap
support was not implemented. - [CoreCLR] Support for fastdev assemblies #10113 added CoreCLR Fast Deploy assembly loading, but its device test covered clean
install/run rather than an incremental app edit. - [FastDev] Add faster FastDeploy2 #11795 is not involved: this workload predates FastDeploy2 and uses the legacy
FastDeploytask.
Activity
jonathanpeppers commentedon Jul 21, 2026
@davidnguyen-tech is the problem solved if you set
_AndroidFastDevStrategy=FastDeploy?A new
FastDeploy2was introduced by default:davidnguyen-tech commentedon Jul 21, 2026
Tried this on the same physical Samsung A16 with
_AndroidFastDevStrategy=FastDeploy.Result was unchanged:
ActivityNotFoundExceptionforjava.lang.ObjectThe incremental binlog confirms
_AndroidFastDevStrategy=FastDeploy, theFastDeploytask executed,FastDeploy2did not execute, and_BuildApkFastDevwas skipped.This workload is
37.0.0-preview.6.59, which predates #11795, so it was already using the legacy FastDeploy implementation.jonathanpeppers commentedon Jul 21, 2026
Ok, I think the cause is
UseMonoRuntime=false(CoreCLR), .NET 10 works unless I setUseMonoRuntime=false.[XABT] Track libxamarin-app.so as a _BuildApkFastDev input
kotlarmilos commentedon Jul 22, 2026
@davidnguyen-tech Could you try running it with this fix #12205?
[-][CoreCLR][Fast Deploy] App crashes after an incremental C# edit[/-][+][CoreCLR][Fast Deploy] App crashes after an incremental C# edit on device or emulator[/+]davidnguyen-tech commentedon Jul 22, 2026
Verified both #12204 and #12205 on a physical Samsung A16 and an API 36.1 arm64 emulator. Both fix the issue.
#12205 looks cleaner to me. I’d add the regression test from #12204 before merging.
Comment posted by GitHub Copilot with @davidnguyen-tech’s approval.
davidnguyen-tech commentedon Jul 22, 2026
@jonathanpeppers I closed #12204 in favor of #12205 in the end. Added test coverage to #12205 on top as well.
[xabt] Track `libxamarin-app.so` as a `_BuildApkFastDev` input (#12205)