Skip to content

Illegal Instruction An attempt was made to execute an illegal instruction. #112943

@valkyrienyanko

Description

@valkyrienyanko

Tested versions

  • Reproducible in: v4.5.stable.mono.official [876b290], v4.0.beta16.mono.official [518b9e5]

System information

Godot v4.5.stable.mono - Windows 11 (build 22631) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 32.0.21033.2001) - Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz (12 threads) - 15.92 GiB memory

Issue description

An EXCEPTION popup appears randomly during game development. The game still runs without issue in the background. I can still control my player ship and shoot. But I cannot stop the game or select any nodes in the UI. Clicking "OK" on the popup closes the editor but the game remains playing. As soon as I click on the console window, the game immediately closes and the console outputted some more text but I didn't get a chance to read it. This issue has been happening to me whenever I spend 1 to 6 hours of development time on my game. I am not sure if it because of my C# code or because of the Godot engine itself or a combination of both. At first I thought it was because I was not disposing of public static events, but before writing this issue, I have removed all public static events from my entire project. I'm not sure what else to check.

I have created an issue about this before (which was caused in a completely separate project) and closed it because I thought the problem was solved but looks like that is no longer the case. I have experienced this bug multiple times in the past two years and I'm only reporting it now because it's become a major annoyance to me.

Another project with this issue. CSharpGodotTools/Template#160

Image Image Image

Error as Plain Text

Godot Engine v4.5.stable.mono.official.876b29033 - https://godotengine.org
Vulkan 1.4.315 - Forward+ - Using Device #0: AMD - AMD Radeon RX 6600
ERROR: FATAL: Condition "gchandle.is_released()" is true.
ERROR:   at: mono_object_disposed_baseref (modules/mono/csharp_script.cpp:1790)
 System.InvalidOperationException: Handle is not initialized.
   at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
   at Godot.Bridge.CSharpInstanceBridge.SerializeState(IntPtr godotObjectGCHandle, godot_dictionary* propertiesState, godot_dictionary* signalEventsState) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:line 222
   C# backtrace (most recent call first):
       [0] void Godot.GodotObject.Dispose(bool) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:137)
       [1] void Godot.GodotObject.Finalize() (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:100)
       [2] uint System.GC.RunFinalizers()
   at: void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:113)
   C# backtrace (most recent call first):
       [0] void Godot.GD.PushError(string) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs:366)
       [1] void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:113)
       [2] void Godot.Bridge.CSharpInstanceBridge.SerializeState(nint, Godot.NativeInterop.godot_dictionary*, Godot.NativeInterop.godot_dictionary*) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:222)
ERROR: System.InvalidOperationException: Handle is not initialized.
   at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
   at Godot.Bridge.CSharpInstanceBridge.SerializeState(IntPtr godotObjectGCHandle, godot_dictionary* propertiesState, godot_dictionary* signalEventsState) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:line 222
Fatal error.    at: void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:113)
   C# backtrace (most recent call first):
       [0] void Godot.GD.PushError(string) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs:366)
       [1] void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:113)
       [2] void Godot.Bridge.CSharpInstanceBridge.SerializeState(nint, Godot.NativeInterop.godot_dictionary*, Godot.NativeInterop.godot_dictionary*) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:222)
0xC000001D
Unloading assembly load context...
   at Godot.NativeInterop.NativeFuncs.godotsharp_internal_refcounted_disposed(IntPtr, IntPtr, Godot.NativeInterop.godot_bool)
   at Godot.GodotObject.Dispose(Boolean)
   at Godot.GodotObject.Finalize()
   at System.GC.RunFinalizers()

Steps to reproduce

Happens randomly after about 1 to 6 hours of development.

Minimal reproduction project (MRP)

Only reproduced in my private project. Have yet to try and reproduce it in an MRP on latest stable version.

But if you want MRP for v4.0.beta16.mono.official [518b9e5] look at the MRP in this issue #72298

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions