C# port from Unity - Exceptions in Win11 crashes demo

Godot Version

Version: Godot 4.2.1.stable.mono Windows
Windows 11
Microsoft .NET SDK 8.0.100 (x64)

Version: Godot 4.2.1.stable.mono Linux
Manjaro Linux (KDE - Kernel 6.6.8-2)
The .NET Core SDK 8.0.0.sdk100-3

Question

I am porting a small multi platform (Win/Linux) demo from Unity to Godot but I am running into exceptions on Windows that crashes the demo.

The demo use a autoloaded “singleton/node” that handles scenes and persistence. One scene use some imported blender models and some pretty basic FSM (Finite State Machines).

The demo runs fine on Linux but I get random crashes on Windows. It think it is a garbage collection issue in the Godot C# Windows version but needs more info.

My question is, as a Godot novice, how can I track down the problem on Window? Is it a Godot Windows bug or my code that does not work on a multiplatform setup?

E 0:02:52:0407 DisposablesTracker.cs:86 @ void Godot.DisposablesTracker.UnregisterGodotObject(Godot.GodotObject, System.WeakReference1[Godot.GodotObject]): System.ArgumentException: Godot Object not registered. (Parameter 'weakReferenceToSelf') <C# Error> System.ArgumentException <C# Source> /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs:86 @ void Godot.DisposablesTracker.UnregisterGodotObject(Godot.GodotObject, System.WeakReference1[Godot.GodotObject])
DisposablesTracker.cs:86 @ void Godot.DisposablesTracker.UnregisterGodotObject(Godot.GodotObject, System.WeakReference`1[Godot.GodotObject])
GodotObject.base.cs:130 @ void Godot.GodotObject.Dispose(bool)
GodotObject.base.cs:80 @ void Godot.GodotObject.Finalize()

E 0:02:52:0411 GD.cs:366 @ void Godot.GD.PushError(string): Unhandled exception
System.ArgumentException: Godot Object not registered. (Parameter ‘weakReferenceToSelf’)
at Godot.DisposablesTracker.UnregisterGodotObject(GodotObject godotObject, WeakReference1 weakReferenceToSelf) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs:line 86 at Godot.GodotObject.Dispose(Boolean disposing) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:line 130 at Godot.GodotObject.Finalize() in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:line 80 <C# Source> /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:131 @ void Godot.NativeInterop.ExceptionUtils.LogUnhandledException(System.Exception) <Stack Trace> GD.cs:366 @ void Godot.GD.PushError(string) ExceptionUtils.cs:131 @ void Godot.NativeInterop.ExceptionUtils.LogUnhandledException(System.Exception) GodotUnhandledExceptionEvent.cs:23 @ void Godot.GD+<>c.<OnCoreApiAssemblyLoaded>b__39_0(object, System.UnhandledExceptionEventArgs) DisposablesTracker.cs:86 @ void Godot.DisposablesTracker.UnregisterGodotObject(Godot.GodotObject, System.WeakReference1[Godot.GodotObject])
GodotObject.base.cs:130 @ void Godot.GodotObject.Dispose(bool)
GodotObject.base.cs:80 @ void Godot.GodotObject.Finalize()