[Bug] iOS crashes on AppCenter.Start in Visual Studio 2022 using hot restart #14976
Comments
Could you share the line where is crashing?. |
Does it give you any logs or exception information? A stack trace maybe? |
@jsuarezruiz Note: This is the only line I added after creating a fresh xamarin.forms project. Besides of course installing AppCenter nuget packages. @jfversluis here is the output it generates when I debug Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:403 [0x00000]. Right before it stops debugging it generates this warning in the output. I don't know what this means. 2021-12-13 10:46:49.964 Xamarin.PreBuilt.iOS[3786:720343] Xamarin.iOS: Unable to locate assembly 'System.Collections.Immutable' (culture: '') 2021-12-13 10:46:49.965 Xamarin.PreBuilt.iOS[3786:720343] Xamarin.iOS: Unable to locate assembly 'System.Collections.Immutable' (culture: '') 2021-12-13 10:46:49.982 Xamarin.PreBuilt.iOS[3786:720343] Xamarin.iOS: Unable to locate assembly 'System.Collections.Immutable' (culture: '') 2021-12-13 10:46:49.983 Xamarin.PreBuilt.iOS[3786:720343] Xamarin.iOS: Unable to locate assembly 'System.Collections.Immutable' (culture: '') 2021-12-13 10:46:50.163 Xamarin.PreBuilt.iOS[3786:720343] Xamarin.iOS: Unable to locate assembly 'System.Runtime.CompilerServices.Unsafe' (culture: '') 2021-12-13 10:46:50.163 Xamarin.PreBuilt.iOS[3786:720343] Xamarin.iOS: Unable to locate assembly 'System.Runtime.CompilerServices.Unsafe' (culture: '') Thank you for looking into it! |
Any update on this? |
I had this exact same issue. I was able to solve this problem by reverting my Microsoft.AppCenter packages to 4.1.0. As of writing this, the latest version of AppCenter is 4.5.0. |
So for me it turns out this only happens when debugging. When we used app center to build a release version of the app, there were no issues. So to avoid the error when debugging I added the following: ObjCRuntime.Class.ThrowOnInitFailure = false; as the first line to the "FinishedLaunching" method in AppDelegate.cs. Note that this means when debugging any crashes errors or events will not go to app center. |
Thank you so much for this tip! Been spending days (if not a week) to figure out what caused the crash on iOS. It would probably be a good idea for the appcenter team to look into this issue! |
Description
I installed latest version of Visual Studio 2022 (17.0.2). Created a brand new Xamarin.Forms project. Wanted to test AppCenter Analytics and Crashes.
AppCenter.Start("android={android key};" +
"ios={iOS key}",
typeof(Analytics), typeof(Crashes));
Installed Microsoft.AppCenter.Analytics and Microsoft.AppCenter.Crashes nuget packages in all three (shared, android, iOS) projects.
Works fine in Android..
Crashes on this line in iOS. I am trying to debug in iPhone physical device using hot restart. When I remove the above line it works just fine.
I tried this on multiple computers but no luck.
Steps to Reproduce
Expected Behavior
Should not crash and start appcenter so it can be used in both Android and iOS
Actual Behavior
Works fine in Android but crashes on iOS
Basic Information
Workaround
May be it will work if I build using Mac instead of relying on Hot Restart. Didn't try that
The text was updated successfully, but these errors were encountered: