question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Xamarin: Make library linker-safe

See original GitHub issue

Which Version of MSAL are you using ? MSAL 4.8.0

Platform Xamarin.Android & Xamarin.iOS

Repro Enable full linking in Xamarin project iOS: image Android: image

Expected behavior Library works without any (or minimal) adjustments needed

Actual behavior Usage of the library fails (see error below) because needed classes (or their constructors/methods) were removed/linked away. Affected classes are, amongst others, Microsoft.Identity.Client.Core.IdToken, Microsoft.Identity.Client.Instance.TenantDiscoveryResponse, Microsoft.Identity.Client.Instance.Discovery.InstanceDiscoveryResponse. Previously (with v4.7.1) I only had to manually add class Microsoft.Identity.Client.BrowserTabActivity to the LinkDescription.xml, but with v4.8.0, many more classes need to be excluded from linking manually.

Possible Solution It would be great if the SDK could be made linker-safe so that I wouldn’t have to care and exclude classes manually. Afaik, this can be done by Attributes as described here or here

Additional context/ Logs / Screenshots

MSAL.Xamarin.iOS.4.8.0.0.MsalClientException: ErrorCode: json_parse_failed Microsoft.Identity.Client.MsalClientException: Failed to parse the returned id token. —> Microsoft.Identity.Json.JsonSerializationException: Unable to find a constructor to use for type Microsoft.Identity.Client.Core.IdToken. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path ‘ver’, line 1, position 7. at Microsoft.Identity.Json.Serialization.JsonSerializerInternalReader.CreateNewObject (Microsoft.Identity.Json.JsonReader reader, Microsoft.Identity.Json.Serialization.JsonObjectContract objectContract, Microsoft.Identity.Json.Serialization.JsonProperty containerMember, Microsoft.Identity.Json.Serialization.JsonProperty containerProperty, System.String id, System.Boolean& createdFromNonDefaultCreator) [0x000d5] in <d6f56669a77644b7bf251a9335804604>:0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tipacommented, Jan 30, 2020

My bad, somehow the project decided to downgrade MSAl to 4.7.1 again, sorry for the false alarm!

1reaction
bgavrilMScommented, Jan 29, 2020

Ok, able to repro the issue and found a fix. Will be releasing 4.8.1 soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linking Xamarin.iOS Apps
This document describes the Xamarin.iOS linker, which is used to eliminate unused code from a Xamarin.iOS application in order to reduce its ...
Read more >
How can I correctly exclude some libraries so that they are ...
I updated my library and added the recommended workaround. I still believe it's a bug but my library is working properly as my...
Read more >
Resolving Android Support Library NuGet Installation Issues
NuGet and Android Support Libraries can be tricky, but I walk you through any issues with version conflicts that you may get.
Read more >
Fixing Xamarin.Forms linker issues - Progrunning
To fix Xamarin.Forms linker related issues one needs to instruct it to keep the code that shouldn't be stripped out. There are multiple...
Read more >
Linker Xamarin Forms
Binding Objective-C Payleven libraries in Xamarin iOS. ... Android Tutorial = "Mysterious" bugs related to ProGuard. Xamarin.forms: Fehler Mono.Linker.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found