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

Xamarin Forms iOS crashing #3106

Closed
1 task
stevendwebster opened this issue Jan 12, 2022 · 4 comments
Closed
1 task

Xamarin Forms iOS crashing #3106

stevendwebster opened this issue Jan 12, 2022 · 4 comments

Comments

@stevendwebster
Copy link

Hi,

Looking for some guidance on an issue I am facing. I have a Xamarin forms application which works well when authenticating using Android, but when I run the application using Hot Restart on my iPhone, things don't go so well. I've added a link to the logs but please let me know if there is anything else I need to provide.

One thing that stands out to me is the following. I actually see this in the logs for a brand new Xamarin application that has only had MSAL added.

[0:] Failed to force load assembly /var/containers/Bundle/Application/00E8F78A-96F0-4E96-9956-0471971011F5/InFlight.iOS.app/InFlight.iOS.content/System.Security.SecureString.dll. Type:System.Security.SecureString. Exception: 'oleaut32.dll assembly:<unknown assembly> type:<unknown type> member:(null)'. Callstack: ' at (wrapper managed-to-native) Interop+OleAut32.SysAllocStringLen(intptr,uint) at System.Security.SafeBSTRHandle.Allocate (System.UInt32 lenInChars) <0x128c90950 + 0x0001c> in <157571ce8e394e4ea27d9526ab72a133>:0 at System.Security.SecureString.AllocateBuffer (System.UInt32 size) <0x128c883e8 + 0x0000a> in <157571ce8e394e4ea27d9526ab72a133>:0 at System.Security.SecureString.InitializeSecureString (System.Char* value, System.Int32 length) <0x128c88048 + 0x00008> in <157571ce8e394e4ea27d9526ab72a133>:0 at System.Security.SecureString..ctor () <0x128c87c08 + 0x0001e> in <157571ce8e394e4ea27d9526ab72a133>:0 at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&) at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936 '

I'm pretty new to MSAL and Xamarin, so apologies if I'm just being a bit of an idiot.

Logs and network traces
logs

Which version of MSAL.NET are you using?
MSAL.NET 4.40.0

Platform
Xamarin.iOS (Xamarin Forms 5.0.0.2291)
VS2022 17.0.4 64-bit

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive

Is this a new or existing app?
c. This is a new app or experiment.

@trwalke
Copy link
Member

trwalke commented Jan 13, 2022

@stevendwebster Have you disabled the linker? It says you need to do that in the documentation for hot reload to work on a physical device.
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/hot-reload#enable-xaml-hot-reload-for-xamarinforms

@stevendwebster
Copy link
Author

stevendwebster commented Jan 13, 2022

@trwalke Thanks for the response. I actually had Hot Reload disabled for my project for Xamarin.Forms. I re-enabled it and also confirmed that the linker settings were as per the documentation, but I still get the same issue.

I have also went through the docs for Hot Restart again and I seem to have everything as per the instructions.
Hot Restart

One thing I did not mention and probably should have, was that I have configured my application to use brokers. I've just removed the WithBroker from my PublicClientApplicationBuilder and it has allowed the auth flow to proceed. It gets to the point where Microsoft asks me to confirm that I would like to sign in to my application. Here are the new logs that are produced.

New log output

I followed these instructions to configure my application for brokers and believe that I have made all of the necessary config/code changes.

MS Docs

Any help most appreciated.

Thanks

@trwalke
Copy link
Member

trwalke commented Jan 18, 2022

@stevendwebster this error seems to be unrelated to MSAL.NET. There is currently an ongoing investigation in the Xamarin.Forms repo where many people are reporting the same issue with other apps. I would inform them that you have the same issue there and follow the investigation.

xamarin/Xamarin.Forms#13016

@bgavrilMS bgavrilMS closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2022
@bgavrilMS
Copy link
Member

Consider moving to Maui.

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

3 participants