Closed gentledepp closed 1 month ago
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: https://github.com/solid-software/flutter_vlc_player/issues/476
FWIW the apps work fine on device.
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 https://github.com/dotnet/runtime/issues/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.
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!
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] })
.
@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.
Steps to Reproduce
Expected Behavior
The app starts and shows "hello avalonia" or the like
Actual Behavior
We get a native crash:
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
to the *.iOScsproj but that did not help