godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.12k stars 21.16k forks source link

Invalid cast exception when using C# and GD Script #40069

Open Ali-Bueno opened 4 years ago

Ali-Bueno commented 4 years ago

Godot version: 3.2.2

OS/device including version: Windows 10 64 bits

Issue description: error when trying to conbine this accessibility plugin (that is in gdScript) with c# scripts that i want to use on my Project. I got a invalid cast exception when I try to compyle a simple hello world Project with a empty c# script. If I don't add any c# script to the Project, the plugin Works fine. and no, isn't a option dont use the plugin, because that plugin brings accessibility to all the Godot ecosystem, the editor itself and the result game. On this post we got some more details. I am using Godot 3.2, but if I downgrade to 3.1 it Works fine. ERROR: debug_send_unhandled_exception_error: System.InvalidCastException: Specified cast is not valid. At: modules/mono/mono_gd/gd_mono_utils.cpp:357 ERROR: call_build: An EditorPlugin build callback failed. At: editor/editor_node.cpp:5268 ERROR: debug_send_unhandled_exception_error: System.InvalidCastException: Specified cast is not valid. At: modules/mono/mono_gd/gd_mono_utils.cpp:357

Steps to reproduce:

  1. download or clone this project and atach a c# script into it.
  2. Run the project.
sanslash332 commented 4 years ago

Same here; i got the same error when I trying to use the accessibility plugin with a c# scripts.

Obvious all things was tested with the mono version of the godot, and the error appear on version 3.2 and above.

And well, we need use that accessibility plugin for use godot, because we are blind, and are interested on use the c# capavilities of the godot :)

please take a look to that error ̂̂

Calinou commented 4 years ago

cc @neikeq

MichaelBelousov commented 4 years ago

sounds like it's related to #39629 and #39739

EDIT: I believe the fixes of #39739 were never cherrypicked onto 3.2.2, so #39629 is in 3.2.2, both are in master, but #39739 is not in 3.2.2 so it still has this bug.

Ali-Bueno commented 4 years ago

Hi. Will this issue be fixed in the upcoming godot 3.2.3? ive tried the first beta and still get this error.

MichaelBelousov commented 4 years ago

@akien-mga @aaronfranke sorry to mention, but can someone cherry-pick #39739 into 3.2.3? I can put up a PR tomorrow if not

neikeq commented 4 years ago

The cherry-pick of the original PR. #39629, was reverted and was not included in 3.2.2 so it cannot be the cause.

aaronfranke commented 4 years ago

This has been fixed on master and can't be easily cherry-picked as it breaks compatibility, so I'm closing this.

akien-mga commented 4 years ago

Well it's still something for which a non-compat breaking fix would be welcome in 3.2. It's a nasty bug.

sanslash332 commented 4 years ago

Hum, so checking the current situation is totally discarded see this bugfix in any new version of the 3.x branch, and for now the option is wait to 4.0, or compile directly from master. This is right?

Or exist a small chance to see this patch applied on an future 3.3 version?

Thanks for your effort, guys :)

Calinou commented 4 years ago

@sanslash332 There won't be a 3.3 version, but this kind of fix can be merged in a 3.2.x point release. (3.2.3 will be released quite soon, so I think this fix is more likely to be in 3.2.4 or later.)

ndarilek commented 4 years ago

Is there any workaround, or anything I can do in godot-accessibility to not trigger this?

Wanted to experiment with C# in an upcoming game jam, but I'm seeing this error in 3.2.2 in a project with no C# scripts when I just click the Build button. If my own plugin is doing something that breaks this, then I'll try fixing it, but I don't even know what that might be right now. Also not sure why an empty project with no C# in it at all would throw this error.

akien-mga commented 2 years ago

Is this still reproducible in 3.4 RC 1 or later?

Maveyyl commented 2 years ago

I got the same error message when I try to run a "tool" script in the editor in 3.4 mono, it bugs at my first line of _Ready function when calling "GetNode". Can't say that is the same issue though.

ghost commented 1 year ago

I am getting the same error on one of my scripts in 4.0.beta4.mono, but other scripts, even in the same scene, are able to call GetNode without issue.