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

Simple net8.0-ios app - native crash at startup (Avalonia XPAT project) #20657

Closed
gentledepp opened this issue May 28, 2024 · 7 comments
Closed

Comments

@gentledepp
Copy link

gentledepp commented May 28, 2024

Steps to Reproduce

  1. I created 3 repros here: https://github.com/gentledepp/Repro_AvaloniaiOSCrash
  2. Run any of the iOS projects on an iOSSimulator (XCode/Simulator 15.3 or 15.4) - Visual Studio 17.9.7

Expected Behavior

The app starts and shows "hello avalonia" or the like

Actual Behavior

We get a native crash:


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.

Environment

Version information
Microsoft Visual Studio Community 2022
Version 17.9.7
VisualStudio.17.Release/17.9.7+34902.65
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/3.40.1@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.

Our mac buildserver is running on am M1 chipset.

Build Logs

msbuild.zip

Example Project (If Possible)

https://github.com/gentledepp/Repro_AvaloniaiOSCrash
use any of the 3 sample solutions (they are all "File-New" Avalonia XPat projects.

Note we got the tip to force the x64 ios simulator by adding

	  <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>

to the *.iOScsproj but that did not help

@gentledepp gentledepp changed the title Simple net8.0-ios app - native crash at startup Simple net8.0-ios app - native crash at startup (Avalonia XPAT project) May 28, 2024
@rolfbjarne
Copy link
Member

I can reproduce with the iOS 17.4 simulator, but not the iOS 17.2 simulator.

Looks like we're not the only ones hit by this: solid-software/flutter_vlc_player#476

@rolfbjarne
Copy link
Member

FWIW the apps work fine on device.

@rolfbjarne
Copy link
Member

Note we got the tip to force the x64 ios simulator by adding

	  <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>

to the *.iOScsproj but that did not help

This worked for me.

Note that you may still run into dotnet/runtime#98941 if you're not using the latest version of .NET (.NET 8.0.300), which behaves very similarly (it only has a different stack trace).

In any case I believe this to be a bug in the iOS Simulator, so I'm closing this issue. The crash is related to OpenGL, and Apple isn't spending much time on OpenGL (it's been deprecated for 5 years now), so I wouldn't be surprised if they introduced a bug accidentally. This also means that they're less likely to fix any bugs as well, so even if we filed an issue with Apple, I'd be surprised if they actually fixed the problem.

Feel free to reopen if you disagree and think it's a bug in xamarin-macios, but we'll need an equivalent Xcode project that works to confirm it's indeed a problem on our side, and also to compare and see where things go wrong.

However, maybe there's a way to make Avalonia use Metal instead of OpenGL? That might be a better way forward than trying to make OpenGL code work.

@gentledepp
Copy link
Author

Wow... thank you for the fast response.
We've never been let down by Apple before - so this is a great disappointment.

FYI - it seems metal support is in the making, but that does not help us now....

I'll try the simulator 15.2 and ping back here. Thanks!

@maxkatz6
Copy link

maxkatz6 commented Jun 1, 2024

However, maybe there's a way to make Avalonia use Metal instead of OpenGL

Yes, metal rendering is supported now, but disabled by default in stable versions.

@gentledepp nightly 11.2 builds have metal enabled by default. Or you can enable them in 11.1 as well via .With(new iOSPlatformOptions { RenderingMode = [Metal] }).

@maxkatz6
Copy link

@rolfbjarne I just tested this issue with and without Metal rendering. With the minimal sample, only iossimulator-x64 is important to solve the issue. And it works with both OpenGL and Metal rendering. At the same time, if arm64 is used, it will crash with both renderers.
No openGL APIs should be executed, when metal is enabled.

@rolfbjarne
Copy link
Member

However, maybe there's a way to make Avalonia use Metal instead of OpenGL

Yes, metal rendering is supported now, but disabled by default in stable versions.

@gentledepp nightly 11.2 builds have metal enabled by default. Or you can enable them in 11.1 as well via .With(new iOSPlatformOptions { RenderingMode = [Metal] }).

This works for me in the Xcode 16.1 arm64 simulator:

diff --git a/AvaloniaiOSCrash_v11.0.10/AvaloniaiOSCrash01/AvaloniaiOSCrash01.iOS/AppDelegate.cs b/AvaloniaiOSCrash_v11.0.10/AvaloniaiOSCrash01/AvaloniaiOSCrash01.iOS/AppDelegate.cs
index 55e9b6e..21a6f99 100644
--- a/AvaloniaiOSCrash_v11.0.10/AvaloniaiOSCrash01/AvaloniaiOSCrash01.iOS/AppDelegate.cs
+++ b/AvaloniaiOSCrash_v11.0.10/AvaloniaiOSCrash01/AvaloniaiOSCrash01.iOS/AppDelegate.cs
@@ -19,6 +19,7 @@ namespace AvaloniaiOSCrash01.iOS
         protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
         {
             return base.CustomizeAppBuilder(builder)
+                .With(new iOSPlatformOptions { RenderingMode = new [] { iOSRenderingMode.Metal } })
                 .WithInterFont()
                 .UseReactiveUI();
         }
diff --git a/AvaloniaiOSCrash_v11.0.10/AvaloniaiOSCrash01/Directory.Build.props b/AvaloniaiOSCrash_v11.0.10/AvaloniaiOSCrash01/Directory.Build.props
index 3a82054..48fa85e 100644
--- a/AvaloniaiOSCrash_v11.0.10/AvaloniaiOSCrash01/Directory.Build.props
+++ b/AvaloniaiOSCrash_v11.0.10/AvaloniaiOSCrash01/Directory.Build.props
@@ -1,6 +1,6 @@
 <Project>
   <PropertyGroup>
     <Nullable>enable</Nullable>
-    <AvaloniaVersion>11.0.10</AvaloniaVersion>
+    <AvaloniaVersion>11.2.0</AvaloniaVersion>
   </PropertyGroup>
 </Project>

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

No branches or pull requests

3 participants