Skip to content

Regression: Runtime errors with IL stripped assemblies #7088

@jxbrenner

Description

@jxbrenner

Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.)

Affected platform version

Xamarin.Android 12.3

Description

Mono runtime error, app hangs and crashes. See device log output below.

Sample project attached for reference. MSBuild configured to match what I'm using in VS 2019 for app distribution.
XamarinAndroidApp.zip

Steps to Reproduce

  1. New Android App (Xamarin) - Blank App
  2. Configure MSBuild for static compilation, IL stripping, and target arm64-v8a
  3. Build and run

Did you find any workaround?

Build with Xamarin.Android 12.0.

Relevant log output

Time	Device Name	Type	PID	Tag	Message
	Sonimtech XP8800	Info	1785	ActivityManager	Process com.companyname.xamarinandroidapp (pid 14562) has died: fore TOP 
	Sonimtech XP8800	Error	14562	mono-rt	
  at Java.Interop.JniRuntime.GetRegisteredRuntime (System.IntPtr invocationPointer) <0x720f10ff0c + 0x0007c> in <4be0212dda1448dbbb5bcb78bcd13cf4>:0 
  at Java.Interop.JniEnvironmentInfo.set_EnvironmentPointer (System.IntPtr value) <0x720f12534c + 0x0008b> in <4be0212dda1448dbbb5bcb78bcd13cf4>:0 
  at Java.Interop.JniRuntime..ctor (Java.Interop.JniRuntime+CreationOptions options) <0x720f110234 + 0x005b7> in <4be0212dda1448dbbb5bcb78bcd13cf4>:0 
  at Android.Runtime.AndroidRuntime..ctor (System.IntPtr jnienv, System.IntPtr vm, System.Boolean allocNewObjectSupported, System.IntPtr classLoader, System.IntPtr classLoader_loadClass, System.Boolean jniAddNativeMethodRegistrationAttributePresent) <0x720f4c15b0 + 0x0008b> in <97754039425649c180140cd9408a4bd2>:0 
  at Android.Runtime.JNIEnv.Initialize (Android.Runtime.JnienvInitializeArgs* args) [0x000f3] in <97754039425649c180140cd9408a4bd2>:0 
	Sonimtech XP8800	Error	14562	mono-rt	
	Sonimtech XP8800	Error	14562	mono-rt	[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in System.Collections.Generic.Dictionary`2<intptr, Java.Interop.JniRuntime>:TryGetValue (intptr,Java.Interop.JniRuntime&): IL_0000: ret       

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.need-attentionA xamarin-android contributor needs to review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions