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

iOS crashes on iossimulator-arm64 with OpenGLES rendering #14933

Closed
sotikouk opened this issue Mar 12, 2024 · 35 comments
Closed

iOS crashes on iossimulator-arm64 with OpenGLES rendering #14933

sotikouk opened this issue Mar 12, 2024 · 35 comments

Comments

@sotikouk
Copy link

sotikouk commented Mar 12, 2024

Describe the bug

Its my first AvaloniaUI mobile app. I use Rider while the app runs on every other platform (desktop, android) on ios it crashes.
This is the output of run :

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8004/tools/bin/mlaunch --launchsim /Volumes/data/Code/avalonia/AvaloniaApplication1/AvaloniaApplication1/AvaloniaApplication1.iOS/bin/Debug/net8.0-ios/iossimulator-arm64/AvaloniaApplication1.iOS.app --device=:v2:udid=A4071EDD-C1C8-4871-9200-116246D734B3 -sdk 17.4 --sdkroot /Applications/Xcode.app/Contents/Developer
xcrun simctl launch --console --terminate-running-process A4071EDD-C1C8-4871-9200-116246D734B3 companyName.AvaloniaApplication1
companyName.AvaloniaApplication1: 10212
2024-03-12 17:07:46.534120+0200 AvaloniaApplication1.iOS[10212:142019] Microsoft.iOS: Socket error while connecting to IDE on 127.0.0.1:10000: Connection refused

=================================================================
	Native Crash Reporting
=================================================================
Got a SIGBUS while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Native stacktrace:
=================================================================
	0x1276701a0 - /Users/sotirioskoukoumtzis/Library/Developer/CoreSimulator/Devices/A4071EDD-C1C8-4871-9200-116246D734B3/data/Containers/Bundle/Application/DDCDB4A5-1FAF-4790-AE91-9D45B4A0C6B4/AvaloniaApplication1.iOS.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
	0x1276201c0 - /Users/sotirioskoukoumtzis/Library/Developer/CoreSimulator/Devices/A4071EDD-C1C8-4871-9200-116246D734B3/data/Containers/Bundle/Application/DDCDB4A5-1FAF-4790-AE91-9D45B4A0C6B4/AvaloniaApplication1.iOS.app/libmonosgen-2.0.dylib : mono_handle_native_crash
	0x1275876d8 - /Users/sotirioskoukoumtzis/Library/Developer/CoreSimulator/Devices/A4071EDD-C1C8-4871-9200-116246D734B3/data/Containers/Bundle/Application/DDCDB4A5-1FAF-4790-AE91-9D45B4A0C6B4/AvaloniaApplication1.iOS.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
	0x1251077e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
	0x1b8650ff8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvmsServerElementBuild
	0x1b864ce34 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvms_element_build_from_source
	0x1b8643854 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib : _Z26cvm_deferred_build_modularPv
	0x180171978 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_client_callout
	0x180179b10 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_serial_drain
	0x18017a688 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_invoke
	0x180185a84 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_root_queue_drain_deferred_wlh
	0x1801850d0 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_workloop_worker_thread
	0x125e73814 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
	0x125e725d4 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

=================================================================
	Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x125107410):0x125107400  28 24 40 a8 2a 2c 41 a8 21 80 00 91 42 00 05 cb  ($@.*,A.!...B...
0x125107410  0c 34 00 a9 0e 3c 01 a9 42 00 01 f1 29 01 00 54  .4...<..B...)..T
0x125107420  68 24 00 a9 6a 2c 01 a9 63 80 00 91 28 24 40 a8  h$..j,..c...($@.
0x125107430  2a 2c 41 a8 21 80 00 91 42 80 00 f1 28 ff ff 54  *,A.!...B...(..T

=================================================================
	Native Crash Reporting
=================================================================
Got a SIGBUS while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

An error has occurred in the native fault reporting. Some diagnostic information will be unavailable.

=================================================================
	Native stacktrace:
=================================================================
	0x1276701a0 - /Users/sotirioskoukoumtzis/Library/Developer/CoreSimulator/Devices/A4071EDD-C1C8-4871-9200-116246D734B3/data/Containers/Bundle/Application/DDCDB4A5-1FAF-4790-AE91-9D45B4A0C6B4/AvaloniaApplication1.iOS.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
	0x1276201c0 - /Users/sotirioskoukoumtzis/Library/Developer/CoreSimulator/Devices/A4071EDD-C1C8-4871-9200-116246D734B3/data/Containers/Bundle/Application/DDCDB4A5-1FAF-4790-AE91-9D45B4A0C6B4/AvaloniaApplication1.iOS.app/libmonosgen-2.0.dylib : mono_handle_native_crash
	0x1275876d8 - /Users/sotirioskoukoumtzis/Library/Developer/CoreSimulator/Devices/A4071EDD-C1C8-4871-9200-116246D734B3/data/Containers/Bundle/Application/DDCDB4A5-1FAF-4790-AE91-9D45B4A0C6B4/AvaloniaApplication1.iOS.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
	0x1251077e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
	0x1b8650ff8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvmsServerElementBuild
	0x1b864ce34 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvms_element_build_from_source
	0x1b8643854 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib : _Z26cvm_deferred_build_modularPv
	0x180171978 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_client_callout
	0x180179b10 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_serial_drain
	0x18017a688 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_invoke
	0x180185a84 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_root_queue_drain_deferred_wlh
	0x1801850d0 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_workloop_worker_thread
	0x125e73814 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
	0x125e725d4 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

Exiting early due to double fault.

To Reproduce

open a new project in Rider.
Run or Debug the application in ios.

Expected behavior

Expected to run on ios.

Avalonia version

1.3.0

OS

Mac OS

Additional context

No response

@sotikouk sotikouk added the bug label Mar 12, 2024
@sotikouk sotikouk changed the title First mobile app in Avalonia UI. It build succeeded but run crashes First mobile app in Avalonia UI. Build succeeded but run crashes Mar 12, 2024
@maxkatz6
Copy link
Member

Can't reproduce here, error isn't as informative either.
Can you try to run with "dotnet run"?

@sotikouk
Copy link
Author

Can't reproduce here, error isn't as informative either. Can you try to run with "dotnet run"?

I have try it with "dotnet run" and it works perfectly. It runs the desktop app. I can't run it on ios though... The app crashes shows nothing on screen.

@maxkatz6
Copy link
Member

@sotikouk "dotnet run" from the iOS project/folder, it shouldn't run desktop app from there.

@sotikouk
Copy link
Author

@sotikouk "dotnet run" from the iOS project/folder, it shouldn't run desktop app from there.

i have tried this also ... The result is exactly the same ... I believe that is a problem about the M1 apple processor... luckily i don't need the ios app for my job.

@albilaga
Copy link

@sotikouk "dotnet run" from the iOS project/folder, it shouldn't run desktop app from there.

@maxkatz6 I already did dotnet run from iOS project and also remove obj folder but still got same error also

@gentledepp
Copy link
Contributor

Same here. We also use an M1 as build server.

I am currently evaluating avalonia for a project, but I simply cannot get iOS to run.
Also: even if dotnet run would work fine, not being able to deploy and debug from Visual Studio 2022 or Rider 2024.x is a game stopper :-|

@timunie
Copy link
Contributor

timunie commented Apr 30, 2024

which Avalonia version? Anyone having a minimal sample and steps to reproduce?

@gentledepp
Copy link
Contributor

Create new AvaloniaUI XPAT project for C# using

  • either Visual Studio 2022
  • or Rider 2023/2024
    Run it on an iOS Simulator

Visual Studio System Info:

Microsoft Visual Studio Community 2022
Version 17.9.6
VisualStudio.17.Release/17.9.6+34728.123
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

Visual C++ 2022 00482-90000-00000-AA988
Microsoft Visual C++ 2022

ASP.NET and Web Tools 17.9.199.22661
ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.9.199.22661
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 17.9.199.22661
Azure Functions and Web Jobs Tools

C# Tools 4.9.0-3.24121.1+a98c90d56455379836dd5c845b35fa932b00cfa3
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.4.39 (main@e8108eb)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

GitHub Copilot 1.156.0.0 (v1.156.0.0@82fafb995)
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

GitHub Copilot Agent 1.156.0

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio 17.9.0 (b3bca6f)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 6.9.2
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core) 17.9.2.2412004+684740676513b3b208d5bd5b7f8786dab8d287b7
Provides languages services for ASP.NET Core Razor.

ResX Resource Manager ResXManager
Manage localization of all ResX-based resources in one place. Shows all resources of a solution and lets you edit the strings and their localizations in a well-arranged data grid.

SQL Server Data Tools 17.9.56.1
Microsoft SQL Server Data Tools

TypeScript Tools 17.0.30103.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.9.0-3.24121.1+a98c90d56455379836dd5c845b35fa932b00cfa3
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.9.0-beta.23614.3+a521e1cd420beb56c15faf6836184fadd2b7937a
Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog 1.0
Information about my package

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

WiX Toolset Visual Studio Extension 1.0.0.18
WiX Toolset Visual Studio Extension version 1.0.0.18
Copyright (c) .NET Foundation and contributors. All rights reserved.

Xamarin 17.9.0.140 (d17-9@7ca5d58)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.9.3.0 (remotes/origin/d17-9@f174974f91)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.9.0 (38e87ba)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Xamarin.iOS and Xamarin.Mac SDK 16.4.0.23 (9defd91b3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

I created 3 repros here:
https://github.com/gentledepp/Repro_AvaloniaiOSCrash

@maxkatz6
Copy link
Member

maxkatz6 commented May 1, 2024

@gentledepp what XCode version and iOS simulator version are you using?
You might be hitting: dotnet/runtime#98941
In which case either using older simulator or .NET 9 helps.

@gentledepp
Copy link
Contributor

XCode 15.3,
Simulator 15.3

I do not think we are hitting dotnet/runtime#98941, because

  1. our error log is different
  2. their solution was updating to .net 8 and "it works", and we are already running .net8 (dotnet new project)

Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Private.CoreLib.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Threading.Thread.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/Avalonia.Fonts.Inter.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/Avalonia.ReactiveUI.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/AvaloniaiOSCrash03.iOS.dll
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/AvaloniaiOSCrash03.dll
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Numerics.Vectors.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.Loader.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Reflection.Emit.ILGeneration.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Reflection.Emit.Lightweight.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Reflection.Primitives.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Diagnostics.Tracing.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.Intrinsics.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/Microsoft.Win32.Primitives.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Text.Encoding.Extensions.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Threading.ThreadPool.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Resources.Writer.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Xml.XDocument.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Reflection.Emit.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.CompilerServices.Unsafe.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.InteropServices.RuntimeInformation.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Security.Cryptography.Algorithms.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Xml.ReaderWriter.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Security.Cryptography.Primitives.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Linq.Queryable.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Resources.ResourceManager.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.Extensions.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Diagnostics.Debug.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Threading.Tasks.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.IO.FileSystem.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Xml.XPath.XDocument.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Diagnostics.StackTrace.dll [External]
Thread started: #2
Thread started: .NET Timer #3
[0:] LogHost: Initializing to normal mode (.cctor)

=================================================================
Native Crash Reporting

Got a SIGBUS while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

=================================================================
Native stacktrace:

0x1271b40a0 - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
0x12716428c - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_handle_native_crash
0x1270cb798 - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
0x124ae37e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x1b8650ff8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Fr
ameworks/OpenGLES.framework/libCoreVMClient.dylib : cvmsServerElementBuild
0x1b864ce34 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvms_element_build_from_source
0x1b8643854 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib : _Z26cvm_deferred_build_modularPv
0x180171978 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_client_callout
0x180179b10 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/sy
stem/libdispatch.dylib : _dispatch_lane_serial_drain
0x18017a688 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_invoke
0x180185a84 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_root_queue_drain_deferred_wlh
0x1801850d0 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_workloop_worker_thread
0x124b57814 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
0x124b565d4 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

=================================================================
Basic Fault Address Reporting

===========================================
Memory around native instruction pointer (0x124ae3410):0x124ae3400 28 24 40 a8 2a 2c 41 a8 21 80 00 91 42 00 05 cb ($@.*,A.!...B...
0x124ae3410 0c 34 00 a9 0e 3c 01 a9 42 00 01 f1 29 01 00 54 .4...<..B...)..T
0x124ae3420 68 24 00 a9 6a 2c 01 a9 63 80 00 91 28 24 40 a8 h$..j
,..c...($@.
0x124ae3430 2a 2c 41 a8 21 80 00 91 42 80 00 f1 28 ff ff 54 *,A.!...B...(..T

=================================================================
Native Crash Reporting

Got a SIGBUS while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

An error has occurred in the native fault reporting. Some diagnostic information will be unavailable.

=================================================================
Native stacktrace:

0x1271b40a0 - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
0x12716428c - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_handle_native_crash
0x1270cb798 - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
0x124ae37e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x1b8650ff8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvmsServerElementBuild
0x1b864ce34 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvms_element_build_from_source
0x1b8643854 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib : _Z26cvm_deferred_build_modularPv
0x180171978 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_client_callout
0x180179b10 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_serial_drain
0x18017a688 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_invoke
0x180185a84 - /Library/Developer/CoreSimulator/Volumes/iOS_21E21
3/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_root_queue_drain_deferred_wlh
0x1801850d0 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_workloop_worker_thread
0x124b57814 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
0x124b565d4 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

Exiting early due to double fault.

We just updated our build server, because as of April 29th, we cannot sip iOS Apps anymore if not built with iOS 17 SDK, that comes with XCode 15. So porting back is no option I'm afraid.

Sidenote:
Directly deploying to my IPad from Windows (no mac build server, just "local device") doesn't work either, but fails with some other error ("no class inheriting AppDelegate was found")
This is quite frustrating :-(

@timunie
Copy link
Contributor

timunie commented May 2, 2024

I thought that one is not allowed to build an iOS app using Windows? Afaik this is an Apple limitation which we cannot solve. You can scan the internet for several blogs complaining about this, for example: https://stackoverflow.com/questions/40587265/react-native-how-to-build-for-ios-from-windows

@gentledepp
Copy link
Contributor

gentledepp commented May 2, 2024

It is supported (kind of) just for development purposes and id also works with AvaloniaUI.
But only, if I run the AvaloniaMauiHybrid MauiSample.

see here: https://learn.microsoft.com/en-us/dotnet/maui/ios/hot-restart?view=net-maui-8.0

I apologize for not being specific enough.

This is the error I get:
image

@gentledepp
Copy link
Contributor

XCode 15.3, Simulator 15.3

I do not think we are hitting dotnet/runtime#98941, because

  1. our error log is different
  2. their solution was updating to .net 8 and "it works", and we are already running .net8 (dotnet new project)

Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Private.CoreLib.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Threading.Thread.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/Avalonia.Fonts.Inter.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/Avalonia.ReactiveUI.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/AvaloniaiOSCrash03.iOS.dll
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/AvaloniaiOSCrash03.dll
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Numerics.Vectors.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.Loader.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Reflection.Emit.ILGeneration.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Reflection.Emit.Lightweight.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Reflection.Primitives.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Diagnostics.Tracing.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.Intrinsics.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/Microsoft.Win32.Primitives.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Text.Encoding.Extensions.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Threading.ThreadPool.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Resources.Writer.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Xml.XDocument.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Reflection.Emit.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.CompilerServices.Unsafe.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.InteropServices.RuntimeInformation.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Security.Cryptography.Algorithms.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Xml.ReaderWriter.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Security.Cryptography.Primitives.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Linq.Queryable.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Resources.ResourceManager.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Runtime.Extensions.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Diagnostics.Debug.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Threading.Tasks.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.IO.FileSystem.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Xml.XPath.XDocument.dll [External]
Loaded assembly: /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/System.Diagnostics.StackTrace.dll [External]
Thread started: #2
Thread started: .NET Timer #3
[0:] LogHost: Initializing to normal mode (.cctor)

=================================================================

Native Crash Reporting

Got a SIGBUS while executing native code. This usually indicates

a fatal error in the mono runtime or one of the native libraries
used by your application.

=================================================================

Native stacktrace:
0x1271b40a0 - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
0x12716428c - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_handle_native_crash
0x1270cb798 - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
0x124ae37e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x1b8650ff8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Fr
ameworks/OpenGLES.framework/libCoreVMClient.dylib : cvmsServerElementBuild
0x1b864ce34 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvms_element_build_from_source
0x1b8643854 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib : _Z26cvm_deferred_build_modularPv
0x180171978 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_client_callout
0x180179b10 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/sy
stem/libdispatch.dylib : _dispatch_lane_serial_drain
0x18017a688 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_invoke
0x180185a84 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_root_queue_drain_deferred_wlh
0x1801850d0 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_workloop_worker_thread
0x124b57814 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
0x124b565d4 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

=================================================================

Basic Fault Address Reporting

Memory around native instruction pointer (0x124ae3410):0x124ae3400 28 24 40 a8 2a 2c 41 a8 21 80 00 91 42 00 05 cb ($@.*,A.!...B...
0x124ae3410 0c 34 00 a9 0e 3c 01 a9 42 00 01 f1 29 01 00 54 .4...<..B...)..T
0x124ae3420 68 24 00 a9 6a 2c 01 a9 63 80 00 91 28 24 40 a8 h$..j
,..c...($@.
0x124ae3430 2a 2c 41 a8 21 80 00 91 42 80 00 f1 28 ff ff 54 *,A.!...B...(..T

=================================================================

Native Crash Reporting

Got a SIGBUS while executing native code. This usually indicates

a fatal error in the mono runtime or one of the native libraries
used by your application.
An error has occurred in the native fault reporting. Some diagnostic information will be unavailable.

=================================================================

Native stacktrace:
0x1271b40a0 - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
0x12716428c - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_handle_native_crash
0x1270cb798 - /Users/admin/Library/Developer/CoreSimulator/Devices/8340112E-F1CF-4793-82AB-C015D4F70148/data/Containers/Bundle/Application/DE6F2B96-16F1-4BD8-99EB-09BECD4D51CF/AvaloniaiOSCrash03.iOS.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
0x124ae37e0 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x1b8650ff8 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvmsServerElementBuild
0x1b864ce34 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib : cvms_element_build_from_source
0x1b8643854 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib : _Z26cvm_deferred_build_modularPv
0x180171978 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_client_callout
0x180179b10 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_serial_drain
0x18017a688 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_lane_invoke
0x180185a84 - /Library/Developer/CoreSimulator/Volumes/iOS_21E21
3/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_root_queue_drain_deferred_wlh
0x1801850d0 - /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_workloop_worker_thread
0x124b57814 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
0x124b565d4 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread
Exiting early due to double fault.

We just updated our build server, because as of April 29th, we cannot sip iOS Apps anymore if not built with iOS 17 SDK, that comes with XCode 15. So porting back is no option I'm afraid.

Sidenote: Directly deploying to my IPad from Windows (no mac build server, just "local device") doesn't work either, but fails with some other error ("no class inheriting AppDelegate was found") This is quite frustrating :-(

We now updated from XCode/Simulator from 15.3 to 15.4 - still the very same issue.

Is anybody investigating this?

@gentledepp
Copy link
Contributor

gentledepp commented May 22, 2024

I played around with the sample solutions of [AvaloniaHybrid]

The AvaloniaMauiHybrid MauiSample can be deployed and started just fine on iOS. (XCode 15.3, Simulator 15.3, iOS SDK 17.4)

(To be honest, though, since updating to XCode 15.4, Simulatore 15.4 and iOS SDK 17.5 as well as updating VS 17.9.7
I actually get a build error...


2>Done building project "MauiSample.csproj" -- FAILED.
2>
2>Build FAILED.
2>
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.2.8053\targets\Xamarin.Shared.Sdk.targets(1560,3): error : clang++ exited with code 1:
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.2.8053\targets\Xamarin.Shared.Sdk.targets(1560,3): error : ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/admin/Library/Caches/Xamarin/mtbs/builds/MauiSample/60c704f377d779be18e3c806e50126d2e7b959f0c3f47892f865467994323c5c/C:/Users/alexa/.nuget/packages/harfbuzzsharp.nativeassets.ios/2.8.2.3/runtimes/ios/native/libHarfBuzzSharp.framework/libHarfBuzzSharp' for architecture arm64
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.2.8053\targets\Xamarin.Shared.Sdk.targets(1560,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation)
2>    0 Warning(s)
2>    1 Error(s)
2>
2>Time Elapsed 00:01:26.63
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
========== Rebuild completed at 13:55 and took 01:44,853 minutes ==========

If I run the AvaloniaMauiHybrid AvaloniaSymple.iOS I get the very same crash as reported above.

Interestingly, having configured the VS debugger to stop on all exceptions, before the crash I get a weird "System.IO.FileNotFoundException: ''"
image

The stack trace is

 	0x26 in System.Reflection.Assembly.Load	C#
 	0x55 in System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly	C#
 	0x4 in System.Resources.ManifestBasedResourceGroveler.InternalGetSatelliteAssembly	C#
 	0x4D in System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly	C#
 	0x31 in System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet	C#
 	0xA4 in System.Resources.ResourceManager.InternalGetResourceSet	C#
 	0x5A in System.Resources.ResourceManager.GetString	C#
 	0x12B in System.SR.InternalGetResourceString	C#
 	0xC in System.SR.GetResourceString	C#
 	0x5 in System.SR.get_Globalization_cp_1200	C#
 	0x60 in System.Text.EncodingTable.GetDisplayName	C#
 	0x4A in System.Text.EncodingTable.InternalGetCodePageDataItem	C#
 	0xBF in System.Text.EncodingTable.GetCodePageDataItem	C#
 	0xF in System.Text.Encoding.GetDataItem	C#
 	0x9 in System.Text.Encoding.get_WebName	C#
 	0x17 in System.Runtime.Serialization.Json.XmlJsonWriter.SetOutput	C#
 	0xD in System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonWriter	C#
 	0x9 in System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonWriter	C#
 	0x4 in System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonWriter	C#
 	0x3B in Microsoft.VisualStudio.DesignTools.TapContract.Networking.Message.SerializeToBuffer	C#
 	0xA in Microsoft.VisualStudio.DesignTools.TapContract.Networking.Message..ctor	C#
 	0x2 in Microsoft.VisualStudio.DesignTools.TapContract.Networking.ProtocolHandler.PostMessage	C#
 	0x9E in Microsoft.XamlHotReload.VisualTreeService.VisualTreeService.RegisterProtocolHandlers at D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\VisualTreeService.cs:83,4	C#
 	0x6D in Microsoft.XamlHotReload.VisualTreeService.DiagnosticVisualTreeService.RegisterProtocolHandlers at D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\DiagnosticVisualTreeService.cs:86,4	C#
 	0x1 in Microsoft.Maui.Controls.HotReload.Forms.MauiVisualTreeService.RegisterProtocolHandlers at D:\a\_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiVisualTreeService.cs:33,4	C#
 	0x3F in Microsoft.XamlHotReload.VisualTreeService.VisualTreeService.Initialize at D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\VisualTreeService.cs:60,4	C#
 	0x95 in Microsoft.XamlHotReload.VisualTreeService.DiagnosticVisualTreeService.Initialize at D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Xaml\VisualTreeService\DiagnosticVisualTreeService.cs:47,4	C#
 	0x8F in Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.SetupAgent at D:\a\_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:97,6	C#
 	0x29 in Microsoft.Maui.Controls.HotReload.Forms.MauiAgent.VisualTreeChanged at D:\a\_work\1\s\HotReload\Source\Microsoft.Maui.Controls.HotReload.Forms\MauiAgent.cs:66,7	C#
 	0x11 in Microsoft.Maui.VisualDiagnostics.OnVisualTreeChanged	C#
 	0x15 in Microsoft.Maui.VisualDiagnostics.OnChildAdded	C#
 	0x22 in Microsoft.Maui.VisualDiagnostics.OnChildAdded	C#
 	0x29 in Microsoft.Maui.Controls.Element.OnChildAdded	C#
 	0x18 in Microsoft.Maui.Controls.Element.AddLogicalChild	C#
 	0x75 in Microsoft.Maui.Controls.Window.OnPageChanged	C#
 	0x12 in Microsoft.Maui.Controls.Window.<>c.<.cctor>b__211_0	C#
 	0x186 in Microsoft.Maui.Controls.BindableObject.SetValueActual	C#
 	0x162 in Microsoft.Maui.Controls.BindableObject.SetValueCore	C#
 	0x5F in Microsoft.Maui.Controls.BindableObject.SetValue	C#
 	0x7 in Microsoft.Maui.Controls.Window.set_Page	C#
>	0x3D in Avalonia.Maui.AvaloniaAppBuilderExtensions.CreateVirtualWindow at C:\Code_gh\AvaloniaMauiHybrid\Avalonia.Maui\AvaloniaAppBuilderExtensions.cs:125,9	C#
 	0x11F in Avalonia.Maui.AvaloniaAppBuilderExtensions.InitializeMauiEmbeddingApp at C:\Code_gh\AvaloniaMauiHybrid\Avalonia.Maui\AvaloniaAppBuilderExtensions.cs:102,13	C#
 	0x7C in Avalonia.Maui.AvaloniaAppBuilderExtensions.<>c__DisplayClass0_0<AvaloniaSample.Maui. at C:\Code_gh\AvaloniaMauiHybrid\Avalonia.Maui\AvaloniaAppBuilderExtensions.cs:55,17	C#
 	0xB6 in Avalonia.AppBuilder.SetupUnsafe	C#
 	0x65 in Avalonia.AppBuilder.Setup	C#
 	0x8 in Avalonia.AppBuilder.SetupWithLifetime	C#
 	0x46 in Avalonia.iOS.AvaloniaAppDelegate<AvaloniaSample.App>.FinishedLaunching	C#
 	0x38 in UIKit.UIApplication.xamarin_UIApplicationMain	C#
 	0xE in UIKit.UIApplication.UIApplicationMain at /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:58,4	C#
 	0x51 in UIKit.UIApplication.Main at /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:94,4	C#
 	0xD in AvaloniaSample.iOS.Application.Main at C:\Code_gh\AvaloniaMauiHybrid\AvaloniaSample\AvaloniaSample.iOS\Main.cs:12,9	C#

@maxkatz6
Copy link
Member

@gentledepp you can try to disable MAUI/Xamarin Hot Reload in Visual Studio. But that exception is likely unrelated to the original problem.

For me personally switching from "iossimulator-arm64" (which is used by default) to "iossimulator-x64" has fixed simulator problem with 17.2-17.5.
But some users reported that it now crashes even on a real device with 17.5.

@gentledepp
Copy link
Contributor

I'll try that out fist thing on tuesday when I am back in the office. Thank you so much!

@gentledepp
Copy link
Contributor

@maxkatz6 I am really sorry for having to ask that, but where exactly do I change the iossimulator?
Is this a rider setting or vs setting?
I could not find anything about that :-|

@gentledepp
Copy link
Contributor

Opened two issues
xamarin/xamarin-macios#20657
xamarin/xamarin-macios#20658

@gentledepp
Copy link
Contributor

gentledepp commented May 28, 2024

@gentledepp you can try to disable MAUI/Xamarin Hot Reload in Visual Studio. But that exception is likely unrelated to the original problem.

For me personally switching from "iossimulator-arm64" (which is used by default) to "iossimulator-x64" has fixed simulator problem with 17.2-17.5. But some users reported that it now crashes even on a real device with 17.5.

like this?
dotnet/maui#20349 (comment)

add

<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>

in my .csproj and vscode builds it for iossimulator-x64

@maxkatz6
Copy link
Member

I am really sorry for having to ask that, but where exactly do I change the iossimulator?

I should have mentioned that. Just add:
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
in your csproj PropertyGroup.

Alternatively, if you build from command line, you can use -r iossimulator-x64 flag.
Note, this runtime identifier is not compatible with device builds.

@maxkatz6
Copy link
Member

ForceSimulatorX64ArchitectureInIDE

I actually didn't know about this property. If it works for you, that's great.

@gentledepp
Copy link
Contributor

ForceSimulatorX64ArchitectureInIDE

I actually didn't know about this property. If it works for you, that's great.

no - it had no effect whatsoever

@gentledepp
Copy link
Contributor

I am really sorry for having to ask that, but where exactly do I change the iossimulator?

I should have mentioned that. Just add: <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier> in your csproj PropertyGroup.

Alternatively, if you build from command line, you can use -r iossimulator-x64 flag. Note, this runtime identifier is not compatible with device builds.

this did not help neither :-|
Let's hope the guys of xamarin-ios can fix it then

@daniel-carr-3000
Copy link

daniel-carr-3000 commented May 31, 2024

I've also encountered this issue on an M3 Pro MacBook Pro, dotnet 8.0.300, XCode 15.4. Adding <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier> to my csproj at least allowed the simulator to load the app, but I did get a lot of warnings.

objc[45575]: Class RTHangsMetrics is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreRoutine.framework/CoreRoutine (0x171609138) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/SafetyMonitor.framework/SafetyMonitor (0x16aeaa6b8). One of the two will be used. Which one is undefined.
objc[45575]: Class CDPRecoveryKeyStatusProvider is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal (0x176077768) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDP.framework/CoreCDP (0x169ad68c0). One of the two will be used. Which one is undefined.
objc[45575]: Class CDPKeychainItemDescriptor is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal (0x176076818) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDP.framework/CoreCDP (0x169ad6a50). One of the two will be used. Which one is undefined.
objc[45575]: Class CDPCAReporter is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal (0x176076ea8) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDP.framework/CoreCDP (0x169ad6dc0). One of the two will be used. Which one is undefined.
objc[45575]: Class CDPRecoveryKeyCache is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDPInternal.framework/CoreCDPInternal (0x176076c28) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreCDP.framework/CoreCDP (0x169ad6e60). One of the two will be used. Which one is undefined.
objc[45575]: Class MicaPlayer is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AppleMediaServicesUI.framework/AppleMediaServicesUI (0x178713548) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GameCenterUI.framework/GameCenterUI (0x167fd58a0). One of the two will be used. Which one is undefined.
objc[45575]: Class AKAlertImageURLProvider is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKitUI.framework/AuthKitUI (0x14e0e5e28) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKit.framework/AuthKit (0x13feb6238). One of the two will be used. Which one is undefined.
objc[45575]: Class AKBiometricRatchetUtility is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKitUI.framework/AuthKitUI (0x14e0e5ea0) and /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKit.framework/AuthKit (0x13feb7840). One of the two will be used. Which one is undefined.
2024-05-31 12:19:11.743988-0700 OMAX.Pendant.iOS[45575:602754] Microsoft.iOS: Socket error while connecting to IDE on 127.0.0.1:10000: Connection refused
2024-05-31 12:19:12.563368-0700 OMAX.Pendant.iOS[45575:602398] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=45575
2024-05-31 12:19:12.564132-0700 OMAX.Pendant.iOS[45575:602398] SecTaskCopyDebugDescription: OMAX.Pendant.iOS[45575]/0#-1 LF=0
2024-05-31 12:19:12.718477-0700 OMAX.Pendant.iOS[45575:602398] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=45575
2024-05-31 12:19:12.718709-0700 OMAX.Pendant.iOS[45575:602398] SecTaskCopyDebugDescription: OMAX.Pendant.iOS[45575]/0#-1 LF=0
2024-05-31 12:19:12.718828-0700 OMAX.Pendant.iOS[45575:602398] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=45575
2024-05-31 12:19:12.718932-0700 OMAX.Pendant.iOS[45575:602398] SecTaskCopyDebugDescription: OMAX.Pendant.iOS[45575]/0#-1 LF=0
2024-05-31 12:19:13.099164-0700 OMAX.Pendant.iOS[45575:602770] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=45575
2024-05-31 12:19:13.099271-0700 OMAX.Pendant.iOS[45575:602770] SecTaskCopyDebugDescription: OMAX.Pendant.iOS[45575]/0#-1 LF=0
2024-05-31 12:19:16.519785-0700 OMAX.Pendant.iOS[45575:602398] [TraitCollection] Class CKBrowserSwitcherViewController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.

Seems like this might be related to an XCode issue though.

@maxkatz6
Copy link
Member

maxkatz6 commented Jun 1, 2024

As per xamarin/xamarin-macios#20657, it seems to be a bug in iOS Apple simulator. And might be worked-around by using Metal rendering instead of OpenGL:

.With(new iOSPlatformOptions { RenderingMode = [Metal] })

in the AppBuilder

@gentledepp
Copy link
Contributor

I will verify this tomorrow in the office and ping back here

@daniel-carr-3000
Copy link

How do you use the AppBuilder with iOS? The xplat template uses UIApplication.Main(args, null, typeof(AppDelegate));. The Application Lifetimes page seems to point to using StartLinuxFramebuffer but I can't seem to find that either.

@maxkatz6
Copy link
Member

maxkatz6 commented Jun 3, 2024

@daniel-carr-3000 https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog.iOS/AppDelegate.cs#L18

@daniel-carr-3000
Copy link

As per xamarin/xamarin-macios#20657, it seems to be a bug in iOS Apple simulator. And might be worked-around by using Metal rendering instead of OpenGL:

.With(new iOSPlatformOptions { RenderingMode = [Metal] })

in the AppBuilder

Switching to Metal Rendering doesn't seem to stop the crashing. Only adding <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier> to the csproj seems to help.

AppDelegate.cs

using Foundation;
using Avalonia;
using Avalonia.iOS;

namespace OMAX.Pendant.iOS;

// The UIApplicationDelegate for the application. This class is responsible for launching the 
// User Interface of the application, as well as listening (and optionally responding) to 
// application events from iOS.
[Register("AppDelegate")]
#pragma warning disable CA1711 // Identifiers should not have incorrect suffix
public partial class AppDelegate : AvaloniaAppDelegate<App>
#pragma warning restore CA1711 // Identifiers should not have incorrect suffix
{
    protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
    {
        return base.CustomizeAppBuilder(builder)
            .With(new iOSPlatformOptions {RenderingMode = [iOSRenderingMode.Metal]})
            .WithInterFont();
    }
}

csproj

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0-ios</TargetFramework>
        <SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
        <Nullable>enable</Nullable>
        <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
    </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
      <CodesignKey>iPhone Developer</CodesignKey>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Avalonia.iOS" Version="11.1.0-beta2" />
    </ItemGroup>

    <ItemGroup>
        <ProjectReference Include="..\OMAX.Pendant\OMAX.Pendant.csproj"/>
    </ItemGroup>
</Project>

@gentledepp
Copy link
Contributor

  1. I can confirm, that downgrading the iOS Simulator to 15.2 solved the issue for us
  2. However,switching to Metal as @daniel-carr-3000 proposed does not change anything. We still get the very same crash at startup on iOS Simulator 15.4!

@gentledepp
Copy link
Contributor

gentledepp commented Jun 5, 2024

I have to apologize: I overlooked a very important part of @daniel-carr-3000 s comment:

  1. I can confirm, that downgrading the iOS Simulator to 15.2 solved the issue for us
  2. As @daniel-carr-3000 mentioned, switching to Metal alone still gives us the very same crash (which is weird since we do not sue OpenGL anmyore, do we?)
  3. *However **switching to Metal and specifying the <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier> resolved the issue!

@maxkatz6 I guess this information should be made as public as possible, since a bunch of devs that try out avaloniaui on iOS will face this right away.
Do you have the contacts to get this done? Or are you just another helpful open source developer?

@albilaga
Copy link

albilaga commented Jun 7, 2024

Btw I think this is also fixed with pinning .net to 8.0.301 and also switching to Metal. No crash anymore even without trick of runtime identifier 🎉🎉🎉

@maxkatz6
Copy link
Member

11.2 has metal enabled by default. And we should make it default for 11.1.1 (unfortunately, too late for 11.1.0, I think, will double check).
@gentledepp it will be more difficult to affect dev's RuntimeIdentifier from the framework itself. Hopefully combination of Metal + latest .NET alone (pinned) is enough to make it work for you too.

maxkatz6 added a commit that referenced this issue Jun 11, 2024
Backport of 11.2 changes into 11.1.
See #14933 (comment)
@maxkatz6
Copy link
Member

Another hack on how to enable iossimulator-x64 without breaking real-device builds:

    <PropertyGroup Condition="'$(RuntimeIdentifier)' != 'ios-arm64'">
        <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
    </PropertyGroup>

@maxkatz6 maxkatz6 changed the title First mobile app in Avalonia UI. Build succeeded but run crashes iOS crashes on iossimulator-arm64 with OpenGLES rendering Jul 31, 2024
maxkatz6 added a commit that referenced this issue Aug 6, 2024
Backport of 11.2 changes into 11.1.
See #14933 (comment)
@maxkatz6
Copy link
Member

maxkatz6 commented Sep 1, 2024

Closing this issue, as OpenGL and Simulator related bugs should be resolved now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants