-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Description
Description
I see incorrect behavior when using the following code in an iOS or Mac Catalyst app:
var v = new Vector2 (1, 1);
var t = typeof (GKGraphNode2D);
using var mesh = new GKMeshGraph<GKGraphNode2D> (0, v, v, t);
Reproduction Steps
Test project: maccatalyst-plain-48cc852.zip
Run like this:
dotnet build
./bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain
Expected behavior
The test should print:
✅ Tapped (false) Success!
✅ Tapped (true) Success!
Note that the test does basically the same thing twice, the first time there's an unexpected NullReferenceException, the second time the test does a Console.WriteLine at some point, which causes the process to crash around the same time the NullReferenceException was thrown the first time.
Actual behavior
❌ Tapped (False) Failure: exception: System.NullReferenceException: Object reference not set to an instance of an object.
at ObjCRuntime.Class.GetClassHandle(Type type, Boolean throw_if_failure, Boolean& is_custom_type) in /Users/builder/azdo/_work/13/s/xamarin-macios/src/ObjCRuntime/Class.cs:line 161
at ObjCRuntime.Class.GetHandle(Type type) in /Users/builder/azdo/_work/13/s/xamarin-macios/src/ObjCRuntime/Class.cs:line 153
at ObjCRuntime.Class..ctor(Type type) in /Users/builder/azdo/_work/13/s/xamarin-macios/src/ObjCRuntime/Class.cs:line 84
at GameplayKit.GKMeshGraph`1[[GameplayKit.GKGraphNode2D, Microsoft.MacCatalyst, Version=18.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]]..ctor(Single bufferRadius, Vector2 min, Vector2 max, Type nodeType) in /Users/builder/azdo/_work/13/s/xamarin-macios/src/build/dotnet/maccatalyst/generated-sources/GameplayKit/GKMeshGraph_1.g.cs:line 181
at maccatalyst_plain.AppDelegate.Tapped(Boolean cwl) in /Users/rolf/test/dotnet/maccatalyst-plain/AppDelegate.cs:line 61
Tapped (False)!
Tapping (True)...
typeof(GKGraphNode2D): GameplayKit.GKGraphNode2D
=================================================================
Native Crash Reporting
=================================================================
Got a SIGSEGV 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:
=================================================================
0x10188cd1c - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_dump_native_crash_info
0x10184120c - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_handle_native_crash
0x1017cd5bc - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_sigsegv_signal_handler_debug
0x18ef4e584 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x10189097c - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_interp_exec_method
0x10189097c - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_interp_exec_method
0x10188e294 - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : interp_runtime_invoke
0x1017d0754 - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_jit_runtime_invoke
0x1017711ec - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_runtime_invoke_checked
0x1017776b0 - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_runtime_exec_main_checked
0x1018248b4 - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : mono_jit_exec
0x1015e4ac0 - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : xamarin_main
0x101984e2c - /Users/rolf/test/dotnet/maccatalyst-plain/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/maccatalyst-plain.app/Contents/MacOS/maccatalyst-plain : main
0x18eb93154 - /usr/lib/dyld : start
Regression?
Not sure
Known Workarounds
Don't use the interpreter
Configuration
.NET 9
Other information
No response