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 AndroidFastDeployRepro
Add 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.
_CreateApplicationSharedLibraries relinks libxamarin-app.so with the new typemap.
_BuildApkFastDev is 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:
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
Intentis resolved asjava.lang.Object, causingan
ActivityNotFoundException. A clean deployment launches successfully, andrestoring the original source makes the app launch successfully again.
Reproduction
Environment:
11.0.100-preview.6.26359.11837.0.0-preview.6.59Fresh 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:
Add a second Activity:
Launch it from
MainActivity.OnCreate: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:{}SecondActivity.MainActivity.cs.The incremental launch fails:
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
_CreateApplicationSharedLibrariesrelinkslibxamarin-app.sowith the new typemap._BuildApkFastDevis skipped, so the installed APK retains the oldlibxamarin-app.so.files/.__override__.MVID map.
The clean and incremental APK and
libxamarin-app.sohashes are identical, while theapp assembly and typemap MVID differ.
The template repro surfaces as an
ActivityNotFoundException. The same mismatch wasalso observed in AzureUX as
no Java peer type found, followed bySIGABRTfrom itsunhandled-exception path.
_BuildApkFastDevStaticInputsdoes not include@(_ApplicationSharedLibrary), eventhough
_BuildApkFastDevpackages that item.Adding
@(_ApplicationSharedLibrary)to the target inputs fixes the failure byrebuilding and reinstalling the APK whenever the typemap library changes. This keeps
EmbedAssembliesIntoApk=false, but is a correctness fix rather than an assembly-onlyFast Deploy solution.
Related context:
support was not implemented.
install/run rather than an incremental app edit.
FastDeploytask.