-
Notifications
You must be signed in to change notification settings - Fork 347
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: Make library linker-safe #1586
Comments
This looks like it's tied to the serialization work we've done. We've moved away from [DataContract] to Newtonsoft, and this seems to affect the serializer. |
Hi @tipa we are going to send you a preview package to test soon. What is a good email address that we can send it to? |
partl_at_outlook.com |
We've realeased a 4.8.1-preview https://www.nuget.org/packages/Microsoft.Identity.Client/4.8.1-preview1 that fixes the crashing bug found on 4.8.0 and improves linking. During our testing with Linker Options set to Link ALL, we're hitting a Null Ref exception in App Center, with no possibility of figuring out the stack trace. So there may be a bug in there still and would be great if someone can verify on their app. |
Can you perhaps give some more information about in what scenario you tested the 4.8.1-preview? Did the token refresh continue to work? I am currently on the fence testing that preview version in my app with a lot of users relying on the OneDrive connection to work reliably |
We tested this manually around acquiring tokens interactive and silent, with a variety of web UIs (embedded browser, system browser, broker). We have automation for scenarios around token refresh, so I'd expect those to work. Today, our automation on Android and iOS cannot run system browsers and brokers (AppCenter limitations), but most scenarios are common between mobile and desktop and we test on desktop. In MSAL 4.9 we will be releasing support for Android broker, which is something that you may want to use. Perhaps this would be a better time to upgrade? |
I just tested briefly with v4.8.1-preview + Linker set to Full but I still encountered the same problem on both Android & iOS:
@bgavrilMS I would rather get this resolved sooner than later, afaik Android broker requires the MS Authenticator app to be installed and I would expect this applies only to a small percentage of my users |
@tipa - I assume that you are using Link All option? |
Yes, I do |
Ok, able to repro the issue and found a fix. Will be releasing 4.8.1 soon. |
I am still getting this exception with 4.8.1
|
@tipa - I don't really know what else to do to please the linker, this class was decorated with the [Preserve] attribute, meant to give a hint to the linker to not delete this. Line 20 in faabb9c
I will follow up with Xamarin folks. May I recommend that you don't link MSAL - I don't think there's that much to gain anyway, but happy to be proven wrong. |
My bad, somehow the project decided to downgrade MSAl to 4.7.1 again, sorry for the false alarm! |
Ah ok, no worries, glad this works :) |
Which Version of MSAL are you using ?
MSAL 4.8.0
Platform
Xamarin.Android & Xamarin.iOS
Repro
Enable full linking in Xamarin project
iOS:
Android:
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
The text was updated successfully, but these errors were encountered: