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

C#: Crash when unreferencing RDShaderSpirV object #72199

Closed
pkdawson opened this issue Jan 27, 2023 · 3 comments · Fixed by #72205
Closed

C#: Crash when unreferencing RDShaderSpirV object #72199

pkdawson opened this issue Jan 27, 2023 · 3 comments · Fixed by #72205

Comments

@pkdawson
Copy link
Contributor

pkdawson commented Jan 27, 2023

Godot version

v4.0.beta.mono.custom_build [0f8f0ab]

System information

Windows 11 22H2

Issue description

Creating an RDShaderSpirV object in C# causes a crash.

This is a regression from beta 15, presumably related to the C# renames. The issue does not occur in GDScript.

Godot Engine v4.0.beta.mono.custom_build.0f8f0ab12 - https://godotengine.org
Vulkan API 1.3.224 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1060 3GB

ERROR: Parameter "strong_gchandle.value" is null.
   at: CSharpLanguage::setup_csharp_script_binding (modules\mono\csharp_script.cpp:1229)
ERROR: Condition "!script_binding.inited" is true. Returning: { nullptr }
   at: godotsharp_internal_unmanaged_get_instance_binding_managed (modules\mono\glue\runtime_interop.cpp:234)
ERROR: Parameter "strong_gchandle.value" is null.
   at: CSharpLanguage::setup_csharp_script_binding (modules\mono\csharp_script.cpp:1229)
ERROR: Condition "!script_binding.inited" is true. Returning: { nullptr }
   at: godotsharp_internal_unmanaged_instance_binding_create_managed (modules\mono\glue\runtime_interop.cpp:247)
ERROR: FATAL: Condition "!rc_owner" is true.
   at: CSharpLanguage::_instance_binding_reference_callback (modules\mono\csharp_script.cpp:1315)

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.0.beta.mono.custom_build (0f8f0ab126437ed593e6463b85a6ee25af9ee5d4)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] CSharpLanguage::_instance_binding_reference_callback (C:\git\godot\modules\mono\csharp_script.cpp:1315)
[1] CSharpLanguage::_instance_binding_reference_callback (C:\git\godot\modules\mono\csharp_script.cpp:1315)
[2] Object::_instance_binding_reference (C:\git\godot\core\object\object.h:655)
[3] RefCounted::unreference (C:\git\godot\core\object\ref_counted.cpp:89)
[4] Ref<RefCounted>::unref (C:\git\godot\core\object\ref_counted.h:220)
[5] Ref<RefCounted>::~Ref<RefCounted> (C:\git\godot\core\object\ref_counted.h:233)
[6] Ref<RefCounted>::`scalar deleting destructor'
[7] godotsharp_ref_destroy (C:\git\godot\modules\mono\glue\runtime_interop.cpp:351)
[8] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================

Steps to reproduce

Create a C# RDShaderSpirV object by using RenderingDevice.ShaderCompileSpirVFromSource or ResourceLoader.Load (with a SPIR-V bytecode resource).

The attached MRP is just:

        RenderingDevice rd = RenderingServer.GetRenderingDevice();
        using var spirv = rd.ShaderCompileSpirVFromSource(new RDShaderSource());

Minimal reproduction project

spirv-crash.zip

@raulsntos
Copy link
Member

Did you remove the .godot/mono folder before opening the project in the new beta?

@pkdawson
Copy link
Contributor Author

Did you remove the .godot/mono folder before opening the project in the new beta?

Yes. The MRP was created from scratch in beta 16, and I also cleared out the GodotNuGetFallbackFolder.

@Krater107a
Copy link

Krater107a commented Jan 27, 2023

I am getting the same error message thrown but when trying to execute this line of code: player.audio.Stream = ResourceLoader.Load<AudioStream>("res://asset/audio/whoosh.wav");
The error message is:
Godot.NativeInterop.NativeFuncs.generated.cs:129 @ IntPtr Godot.NativeInterop.NativeFuncs.godotsharp_internal_unmanaged_get_instance_binding_managed(IntPtr ): Parameter "strong_gchandle.value" is null.

modules/mono/csharp_script.cpp:1229 @ setup_csharp_script_binding()

Windows 11 21H2 -- Godot v4.0.beta16.mono.official [518b9e5] -- .NET SDK 6.0.400
If this is not related to this issue, i will delete this comment.

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

Successfully merging a pull request may close this issue.

4 participants