Bug 24739 - Didn't find class "java.lang.ICharSequence" on path: DexPathList
Summary: Didn't find class "java.lang.ICharSequence" on path: DexPathList
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 5.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-11-21 13:24 UTC by Iliass Yousfi
Modified: 2017-08-08 17:23 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Cases (14.65 KB, application/zip)
2014-11-25 05:47 UTC, Ram Chandra
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Iliass Yousfi 2014-11-21 13:24:38 UTC
Hi,

We are experiencing a very worst bug that manifests badly on our released app on the play store.
This crashes our application when it's runing on Android 5.0.
On previous OS versions (from 4.03 up to latest KitKat), It was not crashing at all!

The issue is related to AlertDialog when built with strings menu

here is the log from the release app version on android 5 device :

11-21 10:14:25.091: E/mono(24827): Unhandled Exception:
11-21 10:14:25.091: E/mono(24827): Java.Lang.Exception: Exception of type 'Java.Lang.Exception' was thrown.
11-21 10:14:25.091: E/mono(24827): at Android.Runtime.JNIEnv.FindClass (string) <0x00204>
11-21 10:14:25.091: E/mono(24827): at Android.Runtime.JNIEnv.FindClass (System.Type) <0x00053>
11-21 10:14:25.091: E/mono(24827): at Android.Runtime.JNIEnv.NewArray (Android.Runtime.IJavaObject[]) <0x00043>
11-21 10:14:25.091: E/mono(24827): at Android.Runtime.JNIEnv.<CreateCreateManagedToNativeArray>m__112 (System.Array) <0x00067>
11-21 10:14:25.091: E/mono(24827): at Android.Runtime.JNIEnv.NewArray<Java.Lang.ICharSequence> (Java.Lang.ICharSequence[]) <0x00097>
11-21 10:14:25.091: E/mono(24827): at Android.App.AlertDialog/Builder.SetItems (Java.Lang.ICharSequence[],Android.Content.IDialogInterfaceOnClickListener) <0x0006b>
11-21 10:14:25.091: E/mono(24827): at Android.App.AlertDialog/Builder.SetItems (string[],Android.Content.IDialogInterfaceOnClickListener) <0x0003b>
11-21 10:14:25.091: E/mono(24827): at Android.App.AlertDialog/Builder.SetItems (string[],System.EventHandler`1<Android.Content.DialogClickEventArgs>) <0x00057>
11-21 10:14:25.091: E/mono(24827): at Distech.X50.UI.Droid.Views.BaseView`1/<>c__DisplayClass8<Distech.X50.Core.Database.Connection.ConnectionViewModel>.<OnPopUpMenuCommandDialogMessageReceived>b__5 () <0x00263>
11-21 10:14:25.091: E/mono(24827): a
11-21 10:14:25.092: E/mono-rt(24827): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.Exception: Exception of type 'Java.Lang.Exception' was thrown.
11-21 10:14:25.092: E/mono-rt(24827): at Android.Runtime.JNIEnv.FindClass (string) <0x00204>
11-21 10:14:25.092: E/mono-rt(24827): at Android.Runtime.JNIEnv.FindClass (System.Type) <0x00053>
11-21 10:14:25.092: E/mono-rt(24827): at Android.Runtime.JNIEnv.NewArray (Android.Runtime.IJavaObject[]) <0x00043>
11-21 10:14:25.092: E/mono-rt(24827): at Android.Runtime.JNIEnv.<CreateCreateManagedToNativeArray>m__112 (System.Array) <0x00067>
11-21 10:14:25.092: E/mono-rt(24827): at Android.Runtime.JNIEnv.NewArray<Java.Lang.ICharSequence> (Java.Lang.ICharSequence[]) <0x00097>
11-21 10:14:25.092: E/mono-rt(24827): at Android.App.AlertDialog/Builder.SetItems (Java.Lang.ICharSequence[],Android.Content.IDialogInterfaceOnClickListener) <0x0006b>
11-21 10:14:25.092: E/mono-rt(24827): at Android.App.AlertDialog/Builder.SetItems (string[],Android.Content.IDialogInterfaceOnClickListener) <0x0003b>
11-21 10:14:25.092: E/mono-rt(24827): at Android.App.AlertDialog/Builder.SetItems (string[],System.EventHandler`1<Android.Content.DialogClickEventArgs>) <0x00057>
11-21 10:14:25.092: E/mono-rt(24827): at X50.UI.Droid.Views.BaseView`1/<>c__DisplayClass8<X50.Core.Database.Connection.ConnectionViewModel>.<OnPopUpMenuCommandDialogMessageReceived>b__5 (

Also a related thread is on the forum : http://forums.xamarin.com/discussion/15740/didnt-find-class-java-lang-icharsequence-in-alertdialog-builder-setitems

This is really critical for us! So please help !
Comment 1 Ram Chandra 2014-11-25 05:47:07 UTC
Created attachment 8859 [details]
Test Cases

I have checked this issue and I am able to reproduce this issue.

Steps to reproduce:

1. Download the attach project and open in VS.
2. Break on exceptions turned on.
3. Build and deploy the sample project
4. Tab the button.

When I tab the button I observed that I am getting an exception, i.e.

"Java.Lang.ClassNotFoundException: Didn't find class "java.lang.ICharSequence" on path: DexPathList[[zip file "/data/app/bug_24739.bug_…" 

I am getting this behavior on both android device Nexus 4 (Android: 5.0) and Samsung S5 (Android 4.4.2).

However, I am not getting this exception when I turn off the Break on exceptions.

Screencast: http://www.screencast.com/t/bXnXKqUs

Debug output: https://gist.github.com/Rajneesh360Logica/56d839dacee78473c8ba
IDE logs:  https://gist.github.com/Rajneesh360Logica/9ce83af4cea9b7bea878
Device logs: https://gist.github.com/Rajneesh360Logica/428b5f6723ab7161ed7d

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.50938
Installed Version: Professional
Xamarin   3.8.150.0 (10cfd178d55287f09c85f5a1e604dfe20889a40f)
Xamarin.Android   4.20.0.28 (ba9bbbdd44cfdc4bf485e8885bd2ad24fba525f7)
Xamarin.iOS   8.4.0.0 (840a925103a0bf4a856507f13d5eaee3c1579c2f)
Comment 2 Iliass Yousfi 2014-11-25 08:29:05 UTC
It turns out that it's related to mono RT delivered with the app on the store.

1. If  install the app from the play store on Android 5 device I got the crash that you see below. By Crash I mean a real crash.

2. If I build the app apk using latest Xamarin + Latest SDK, then the app will cover the issue, which is still there but the mono RT is able to recover as we experience the actual app on the store on previous android OS (KitKat and before)

This is an anoying issue making the user having bad experience with the app just because the mono runtime ?
Comment 3 Jonathan Pryor 2014-11-26 22:53:31 UTC
@Ram:

> I am not getting this exception when I turn off the Break on exceptions.

That's not a bug. It is (currently) normal and expected to have a first-chance exception for some types, including java.lang.ICharSequence. It is caught and handled internally, which is why you don't see the exception when you turn off Break On Exceptions.
Comment 4 Jonathan Pryor 2014-11-26 23:02:25 UTC
@Iliass Yousfi: Unfortunately I don't understand how you're getting an unhandled exception.

What's particularly odd is that you're getting a Java.Lang.Exception; I'd expect it to be a Java.Lang.NoClassDefFoundError or a Java.Lang.ClassNotFoundException (which are the actual types we check for as part of the first-chance exception recovery).

Are you able to create a repro?

Do you have Link All Assemblies enabled?

Have you subscribed to the AndroidEnvironment.UnhandledExceptionRaiser event?
Comment 5 Iliass Yousfi 2014-11-27 08:39:15 UTC
I know that it is caught. AS I explained above, w have our app on the play store that was built using older Xamarin.Android version (may be 4.6).
When you install it on older version than Android 5.0 (on 4.4.4 or older) the app works right, and "bugous" android dialogs were caught and recovered along through the app.
The problem is that when you install it on an android 5.0, or when you upgrade your mobile device to Android 5.0 while it was already installed, then the error is not caught anymore, and the app just crashes and tombstoned.

What i Found is that if I build the same app, but using the latest Xamarin android I have now (stable latest) then the app will recover from this on Android 5.0.

So tio reproduce it, It will be easier if you install from the store (https://play.google.com/store/apps/details?id=com.distech.x50.ui.droid&hl=en) on an android 5.0 device. As soon as you add new item on the app (which triggers android dialog) you will see the crash. But if you install it on previous version (android 4.4 or older) then it will work just fine
Comment 6 Jon Douglas [MSFT] 2017-08-08 17:23:22 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.

I had also attempted to reproduce this on API 23 and the application installs just fine. I believe this is fixed.