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

App crash at startup after migrating from .Net7 to .Net8 and from VS For Mac to VS Code #20421

Closed
espritm opened this issue Apr 10, 2024 · 3 comments
Labels
need-attention An issue requires our attention/response
Milestone

Comments

@espritm
Copy link

espritm commented Apr 10, 2024

Steps to Reproduce

I'm building a MAUI application for ios simulator on mac m2 with a project dependancy to a binding project (native binded library).

  1. All builds fine with .Net 7 : the binded library is OK and the app runs fine on simulator as well as on physical device.

  2. Change the TargetFrameworks from net7.0xxx to net8.0xxx (and all followed https://github.com/dotnet/maui/wiki/Upgrading-.NET-MAUI-from-.NET-7-to-.NET-8)

  3. Build the native binding library > it fails. Looks like I was not alone in that case and I followed the workaround and it builds fine : .NET MAUI project doesnt build on VS Code but does on VS4Mac #19596 (comment)
    Regarding this changes the binded native library was indeed providing iossimulator-x64 only :

SecurIDLibFramework.xcframework % ls
Info.plist		ios-arm64		ios-x86_64-simulator
  1. Build the app for simulator : it crashes at startup, but the debugger still alive. No breakpoint hitten, no more logs than :
SDB 127.0.0.1:64729S -> [Maxime.Mobile.MyApp.MAUI (ios)] /Users/Maxime/Workspace/MyApp/MyApp/Maxime.Mobile.MyApp/Maxime.Mobile.MyApp.MAUI/Maxime.Mobile.MyApp.MAUI.csproj
Debugger is ready and listening...
xcrun simctl launch --console --terminate-running-process DA14641F-5BB0-4F8F-87E3-FACD2081C91C com.Maxime.ebanking-EV2 -monodevelop-port 64729
xcrun simctl launch --console --terminate-running-process DA14641F-5BB0-4F8F-87E3-FACD2081C91C com.Maxime.ebanking-EV2 -monodevelop-port 64729
com.maxime.ebanking-EV2: 53191
com.maxime.ebanking-EV2: 53191
objc[53191]: Class RTHangsMetrics is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreRoutine.framework/CoreRoutine (0x174f13128) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/SafetyMonitor.framework/SafetyMonitor (0x1704596a8). One of the two will be used. Which one is undefined.
objc[53191]: Class CDPRecoveryKeyStatusProvider is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal (0x1774b8710) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDP.framework/CoreCDP (0x16f3178b0). One of the two will be used. Which one is undefined.
objc[53191]: Class CDPKeychainItemDescriptor is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal (0x1774b7810) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDP.framework/CoreCDP (0x16f317a40). One of the two will be used. Which one is undefined.
objc[53191]: Class CDPCAReporter is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal (0x1774b7e50) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDP.framework/CoreCDP (0x16f317db0). One of the two will be used. Which one is undefined.
objc[53191]: Class CDPRecoveryKeyCache is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal (0x1774b7bd0) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDP.framework/CoreCDP (0x16f317e50). One of the two will be used. Which one is undefined.
objc[53191]: Class MicaPlayer is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AppleMediaServicesUI.framework/AppleMediaServicesUI (0x17a831548) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GameCenterUI.framework/GameCenterUI (0x16c0398a0). One of the two will be used. Which one is undefined.
objc[53191]: Class AKAlertImageURLProvider is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKitUI.framework/AuthKitUI (0x162f21dd8) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKit.framework/AuthKit (0x13f1a2218). One of the two will be used. Which one is undefined.
objc[53191]: Class AKBiometricRatchetUtility is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKitUI.framework/AuthKitUI (0x162f21e50) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKit.framework/AuthKit (0x13f1a3820). One of the two will be used. Which one is undefined.
objc[53191]: Class Overlay is implemented in both /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Frameworks/DXEditors.framework/DXEditors (0x10cccab60) and /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Frameworks/DXListView.framework/DXListView (0x10c975098). One of the two will be used. Which one is undefined.
objc[53191]: Class OTDefaultAudioDevice is implemented in both /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Frameworks/UnbluProxy.framework/UnbluProxy (0x1106c1938) and /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Maxime.Mobile.MyApp.MAUI (0x102e8bf70). One of the two will be used. Which one is undefined.
objc[53191]: Class _TtC15UnbluCallModule23TokBoxPublisherDelegate is implemented in both /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Frameworks/UnbluProxy.framework/UnbluProxy (0x1106c1a78) and /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Maxime.Mobile.MyApp.MAUI (0x102e8c0b0). One of the two will be used. Which one is undefined.
objc[53191]: Class _TtC15UnbluCallModule24TokBoxSubscriberDelegate is implemented in both /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Frameworks/UnbluProxy.framework/UnbluProxy (0x1106c1fb0) and /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Maxime.Mobile.MyApp.MAUI (0x102e8c5e8). One of the two will be used. Which one is undefined.
objc[53191]: Class _TtC15UnbluCallModule10CallModule is implemented in both /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Frameworks/UnbluProxy.framework/UnbluProxy (0x1106d5dd8) and /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Maxime.Mobile.MyApp.MAUI (0x102ebc310). One of the two will be used. Which one is undefined.
objc[53191]: Class _TtC15UnbluCallModule13TokBoxSession is implemented in both /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Frameworks/UnbluProxy.framework/UnbluProxy (0x1106c25d8) and /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Maxime.Mobile.MyApp.MAUI (0x102e8cc10). One of the two will be used. Which one is undefined.
objc[53191]: Class DXDataFormXamarinDataProvider is implemented in both /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Frameworks/DXEditors.framework/DXEditors (0x10cccaa98) and /Users/Maxime/Library/Developer/CoreSimulator/Devices/DA14641F-5BB0-4F8F-87E3-FACD2081C91C/data/Containers/Bundle/Application/0336F409-3727-45AA-BAA1-683CBF021D1F/Maxime.Mobile.MyApp.MAUI.app/Maxime.Mobile.MyApp.MAUI (0x102e938c8). One of the two will be used. Which one is undefined.

In .Net7, I didn't have all those duplicated class messages, only six on them concerning "UnbluProxy".

Targeting Android simulator, the app builds and run fine with .Net7 as well as .Net8.

Expected Behavior

The app should build and run on iOS simulator

Actual Behavior

The app crashes at startup and the debuger is still alive. We see a white screen for 1 second, illustrating the app starting and displaying the splashscreen, but it closes.

Environment

Version information
Visual Studio Code
Version: 1.88.0 (Universal)
Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
Date: 2024-04-03T13:28:18.899Z (6 days ago)
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.1.0

.NET MAUI extension v0.9.7

C# extension v2.23.15

C# Dev Kit v1.4.29

dotnet 8.0.203

VS For Mac 17.6.10 (build 428)

xCode 15.3

iOS SDK 17.4

Build Logs

msbuild.binlog.zip

Crash Logs from macos "send report"

crash log.txt.zip

Example Project (If Possible)

@rolfbjarne
Copy link
Member

From the crash report:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   ???                           	       0x105e8fa78 ???
1   <translation info unavailable>	       0x1068c215c ???
2   libsystem_pthread.dylib       	       0x12cce9f30 pthread_kill + 262
3   libsystem_c.dylib             	       0x12cdbcd1c abort + 133
4   libsystem_malloc.dylib        	       0x12ce268b0 malloc_vreport + 926
5   libsystem_malloc.dylib        	       0x12ce26ab2 malloc_report + 158
6   libicucore.A.dylib            	       0x12f145d6f icu::Locale::setToBogus() + 43
7   libicucore.A.dylib            	       0x12f14784a icu::Locale::operator=(icu::Locale const&) + 30
8   libicucore.A.dylib            	       0x12f2b3590 icu::number::UnlocalizedNumberFormatter::locale(icu::Locale const&) && + 14
9   libicucore.A.dylib            	       0x12f261eb7 icu::DecimalFormat::touch(UErrorCode&) + 257
10  libicucore.A.dylib            	       0x12f26252b icu::DecimalFormat::DecimalFormat(icu::UnicodeString const&, icu::DecimalFormatSymbols*, UNumberFormatStyle, UErrorCode&) + 297
11  libicucore.A.dylib            	       0x12f2cf93f icu::NumberFormat::makeInstance(icu::Locale const&, UNumberFormatStyle, signed char, UErrorCode&) + 1339
12  libicucore.A.dylib            	       0x12f2cf2ad icu::LocaleCacheKey<icu::SharedNumberFormat>::createObject(void const*, UErrorCode&) const + 81
13  libicucore.A.dylib            	       0x12f1f58dc icu::UnifiedCache::_get(icu::CacheKeyBase const&, icu::SharedObject const*&, void const*, UErrorCode&) const + 106
14  libicucore.A.dylib            	       0x12f2cfe78 0x12f144000 + 1621624
15  libicucore.A.dylib            	       0x12f2cf3ad 0x12f144000 + 1618861
16  libicucore.A.dylib            	       0x12f2cef56 icu::NumberFormat::createInstance(icu::Locale const&, UNumberFormatStyle, UErrorCode&) + 42
17  libicucore.A.dylib            	       0x12f152394 icu::SimpleDateFormat::initialize(icu::Locale const&, UErrorCode&) + 656
18  libicucore.A.dylib            	       0x12f152ed3 icu::SimpleDateFormat::SimpleDateFormat(icu::Locale const&, UErrorCode&) + 317
19  libicucore.A.dylib            	       0x12f14c25a icu::DateFormat::create(icu::DateFormat::EStyle, icu::DateFormat::EStyle, icu::Locale const&) + 230
20  libicucore.A.dylib            	       0x12f14c05e udat_open + 377
21  CoreFoundation                	       0x11aa14a8b __cficu_udat_open + 48
22  CoreFoundation                	       0x11a935508 __ResetUDateFormat + 510
23  CoreFoundation                	       0x11a934e59 __CreateCFDateFormatter + 320
24  Foundation                    	       0x115dc6093 -[NSDateFormatter _regenerateFormatter] + 259

This is due to dotnet/runtime#98941 - basically Xcode 15.3 broke us in the simulator.

The easiest workaround is to either use Xcode 15.2, or the an iOS 17.2 simulator (as opposed to iOS 17.4 simulator).

Can you try that and see if it works for you then?

See also #20257.

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Apr 10, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Apr 10, 2024
@espritm
Copy link
Author

espritm commented Apr 10, 2024

Thanks a lot @rolfbjarne !
Using xCode 15.3 but deploying on simulator 17.2 works fine ! Even with VS Code.

I've had another crash because of the following error :
Dynamic code generation is not supported on this platform fails in .net 8

By setting <UseInterpreter>true</UseInterpreter> in my csproj, the app starts and I can navigate in it.

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Apr 10, 2024
@rolfbjarne
Copy link
Member

Using xCode 15.3 but deploying on simulator 17.2 works fine ! Even with VS Code.

Great! I'll close this as a duplicate of dotnet/runtime#98941 then.

Dynamic code generation is not supported on this platform

You're using some feature the AOT compiler doesn't support (System.Reflection.Emit probably).

You'll either have to enable the interpreter, or find an alternative way of doing what you're doing that doesn't require dynamic code generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-attention An issue requires our attention/response
Projects
None yet
Development

No branches or pull requests

2 participants