AzureAD/azure-activedirectory-library-for-dotnet

android.runtime.JavaProxyThrowable crash in ADAL.Net

Closed this issue · 3 comments

MSAL is the recommended auth library for use with the Microsoft identity platform

No new features will be implemented on ADAL. The team's efforts are on improving MSAL, the next-gen auth library. MSAL's wiki contains a migration guide from ADAL.

Only regressions, high severity issues and security issues will be fixed on ADAL. Other issues are likely to have already been fixed in MSAL.

If you think that your issue falls into the above categories, please fill in the form below.

Which Version of ADAL are you using ?
5.2.7

Which platform has the issue?
Xamarin android

What authentication flow has the issue?

  • Mobile Interactive flow

Other? - please describe;

Is this a new or existing app?
This is an existing app. The app is in production and we moved to ADAL.Net couple of months ago from ADAL Xamarin bindings.

Repro

result = await this.authContext.AcquireTokenAsync(
                resourceId,
                Settings.ApplicationClientId,
                new Uri(this.redirectUrl),
                platformParams,
                userIdentifier);

Expected behavior
App is not expected to crash.

Actual behavior
We have been observing multiple crashes in google play console with the same type of log. So far around 4000 instances are reported within last 30 days

Possible Solution

Additional context/ Logs / Screenshots
Crashes reported in Play Console have the following info:

android.runtime.JavaProxyThrowable: at Microsoft.Identity.Core.UI.EmbeddedWebview.AuthenticationAgentActivity.OnCreate (Android.OS.Bundle bundle) [0x00077] in :0 at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in :0 at (wrapper dynamic-method) System.Object.6(intptr,intptr,intptr)
at md50f4052871844d9a9a86e0830b7f51549.AuthenticationAgentActivity.n_onCreate (Native Method)
at md50f4052871844d9a9a86e0830b7f51549.AuthenticationAgentActivity.onCreate (AuthenticationAgentActivity.java:30)
at android.app.Activity.performCreate (Activity.java:7981)
at android.app.Activity.performCreate (Activity.java:7970)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3594)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2146)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:7777)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1047)

@pavanarava : Did you try MSAL?

@pavanarava : can you pls. provide the ADAL logs? Which steps did you do to troubleshoot?

Seems like something is done here which needs a review:
Microsoft.Identity.Core.UI.EmbeddedWebview.AuthenticationAgentActivity.OnCreate (Android.OS.Bundle bundle) [0x00077] in :0 at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in :0 at (wrapper dynamic-method) System.Object.6(intptr,intptr,intptr)

@henrik-me : We are currently in the process of migrating to MSAL. But it will take some time. But given that this is the current pressing issue, it would be great if you can help us with this issue. Also, I found this related MSAL thread AzureAD/microsoft-authentication-library-for-dotnet#1209 where similar issue is discussed. So probably this might be present in MSAL too.

Unfortunately, this crash is not reproducible and only seen in the play console crash list. Even our app telemetry is not able to catch this one. So I cannot provide any logs.

Any guesses regarding what could cause this problem?

Code is here but without an error message and some logs, I have no idea what is going on :(