Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Xamarin.Android typeload exception with MSAL 4.5.0 #1449

Closed
bgavrilMS opened this issue Oct 16, 2019 · 8 comments
Closed

[Bug] Xamarin.Android typeload exception with MSAL 4.5.0 #1449

bgavrilMS opened this issue Oct 16, 2019 · 8 comments

Comments

@bgavrilMS
Copy link
Member

Which Version of MSAL are you using ?
Note that to get help, you need to run the latest version. Preview version are also ok.
For ADAL, please log issues to https://github.com/AzureAD/azure-activedirectory-library-for-dotnet
4.5.0

Platform
android only

Repro

  1. Update to latest VS (RTM)
  2. Create a new XForms solution
  3. Add MSAL 4.5.0 (just add the nuget packge)
  4. Run

VS 16.3.5
Xamarin: 16.3.0.277
Xamarin.Android.SDK 10.0.3.0

UNHANDLED EXCEPTION:
10-16 13:18:43.263 I/MonoDroid(23861): System.TypeInitializationException: The type initializer for 'Attribute' threw an exception. ---> System.TypeLoadException: Could not resolve type with token 01000022 from typeref (expected class 'Microsoft.Identity.Client.Ref.Resource' in assembly 'Microsoft.Identity.Client, Version=4.5.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae')
10-16 13:18:43.263 I/MonoDroid(23861): at Android.Runtime.ResourceIdManager.UpdateIdValues () [0x00097] in <11a340ccc8de43f09c97400139266ef5>:0
10-16 13:18:43.263 I/MonoDroid(23861): at Xamarin.Forms.Platform.Android.Resource+Attribute..cctor () [0x012a2] in D:\a\1\s\Xamarin.Forms.Platform.Android\Resources\Resource.Designer.cs:1579
10-16 13:18:43.263 I/MonoDroid(23861): --- End of inner exception stack trace ---
10-16 13:18:43.263 I/MonoDroid(23861): at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
10-16 13:18:43.263 I/MonoDroid(23861): at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.ActionBarHeight () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:476
10-16 13:18:43.263 I/MonoDroid(23861): at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0001a] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:392
10-16 13:18:43.263 I/MonoDroid(23861): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean p0, System.Int32 p1, System.Int32 p2, System.Int32 p3, System.Int32 p4) [0x00008] in D:\a\1\s\Xamarin.Forms.Platform.Android.FormsViewGroup\obj\Release\generated\src\Xamarin.Forms.Platform.Android.FormsViewGroup.cs:198
10-16 13:18:43.263 I/MonoDroid(23861): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.40(intptr,intptr,bool,int,int,int,int)
10-16 13:18:43.278 W/zygote64(23861): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable

@bgavrilMS
Copy link
Member Author

Workaround - downgrade MSAL to 4.4 on the Android head but keep the iOS at 4.5. You can also keep the shared project at 4.5, it doesn't really matter.

At runtime, the Android will use MSAL 4.4 and iOS will use MSAL 4.5. This should be fine because the 4.5 release has virtually no impact on Android code paths.

@mastermoe01
Copy link

I have the same issue, it seems @bgavrilMS workaround works for me for now though.

@norton287
Copy link

I'm having the same issue and reverting the package works.

@jennyf19
Copy link
Collaborator

jennyf19 commented Oct 17, 2019

@WilliamWatterson86 @mastermoe01 @norton287
@bgavrilMS has a fix for this. We are running a new release build now, if you would like to try it out before we officially release....here is the package:
Microsoft.Identity.Client.4.5.1.zip

@jennyf19 jennyf19 added the Fixed label Oct 17, 2019
@jennyf19 jennyf19 modified the milestones: 4.6, 4.5.1 Oct 17, 2019
@jennyf19
Copy link
Collaborator

Fixed in 4.5.1 release

@WilliamWatterson86
Copy link

@jennyf19 @bgavrilMS sorry for the delay getting back to you. V4.5.1 works well! Thanks for getting this out so quickly :)

@bgavrilMS
Copy link
Member Author

Thanks for confirming @WilliamWatterson86 !

@mastermoe01
Copy link

@jennyf19 4.5.1 also worked for me! thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants