Skip to content

Android: new cil-strip feature causes app crashes #88538

@jonathanpeppers

Description

@jonathanpeppers

Description

This was originally implemented in:

But the app crashes at runtime, log snippet with mono --trace on:

07-07 08:33:25.712 18759 18759 D Mono    : AOT: FOUND method Android.Runtime.JNIEnvInit:Initialize (Android.Runtime.JNIEnvInit/JnienvInitializeArgs*) [0x74d4760990 - 0x74d4760d10 0x74d476a970]
07-07 08:33:25.712 18759 18759 V mono    : [0x78158e04f8: 0.01401 0] 
07-07 08:33:25.712 18759 18759 V mono    : ENTER:c (wrapper alloc) object:AllocSmall (intptr,intptr)(
07-07 08:33:25.712 18759 18759 V mono    : 0xb4000076dbe1f8e0
07-07 08:33:25.712 18759 18759 V mono    : , 
07-07 08:33:25.712 18759 18759 V mono    : 0x40
07-07 08:33:25.712 18759 18759 V mono    : )
07-07 08:33:25.712 18759 18759 V mono    : [0x78158e04f8: 0.01405 0] 
07-07 08:33:25.712 18759 18759 V mono    : LEAVE:c (wrapper alloc) object:AllocSmall (intptr,intptr)(
07-07 08:33:25.712 18759 18759 V mono    : [Java.Interop.JniMethodInfo:0x74d7c01898]
07-07 08:33:25.712 18759 18759 V mono    : 
07-07 08:33:25.712 18759 18759 D Mono    : AOT: FOUND method Java.Interop.JniMethodInfo:.ctor (intptr,bool) [0x74d46f8c20 - 0x74d46f8c60 0x74d47042de]
07-07 08:33:25.712 18759 18759 D Mono    : AOT NOT FOUND: (wrapper managed-to-native) object:__icall_wrapper_ves_icall_object_new_specific (intptr).
07-07 08:33:25.712 18759 18759 V mono    : [0x78158e04f8: 0.01425 0] 
07-07 08:33:25.712 18759 18759 V mono    : ENTER:c (wrapper managed-to-native) object:__icall_wrapper_ves_icall_object_new_specific (intptr)(
07-07 08:33:25.712 18759 18759 V mono    : 0xb4000076dbe209d8
07-07 08:33:25.712 18759 18759 V mono    : )
07-07 08:33:25.712 18759 18759 V mono    : [0x78158e04f8: 0.01428 0] 
07-07 08:33:25.712 18759 18759 V mono    : LEAVE:c (wrapper managed-to-native) object:__icall_wrapper_ves_icall_object_new_specific (intptr)(
07-07 08:33:25.712 18759 18759 V mono    : [Android.Runtime.AndroidRuntime:0x74d7c018d8]
07-07 08:33:25.712 18759 18759 V mono    :
...
07-07 08:33:25.714 18759 18759 E companyname.foo: * Assertion at /__w/1/s/src/mono/mono/mini/mini-trampolines.c:1416, condition `invoke' not met

The method in question, looks like it is stripped as expected:

image

I also get the log message:

07-07 08:33:25.712 18759 18759 D Mono    : AOT: FOUND method Android.Runtime.JNIEnvInit:Initialize (Android.Runtime.JNIEnvInit/JnienvInitializeArgs*) [0x74d4760990 - 0x74d4760d10 0x74d476a970]

Reproduction Steps

Expected behavior

A dotnet new android app runs.

Actual behavior

dotnet new android app appears to crash at the first managed method that was stripped away.

Regression?

No, this is a new feature.

Known Workarounds

Don't use -p:AndroidStripIL=true, as this is the new feature.

Configuration

.NET SDK 8.0.100-preview.7.23330.16

Other information

Full adb log: log.txt
Assembly files: uncompressed-com.companyname.foo.zip
Method tokens: tokens.zip

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions