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

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

Open
Ali-Bueno opened this issue Jul 2, 2020 · 14 comments
Open

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

Ali-Bueno opened this issue Jul 2, 2020 · 14 comments

Comments

@Ali-Bueno
Copy link

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
Copy link

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 ̂̂

@fire fire changed the title Invalid cast esception when using C# and GD Script Invalid cast exception when using C# and GD Script Jul 2, 2020
@Calinou
Copy link
Member

Calinou commented Jul 2, 2020

cc @neikeq

@MichaelBelousov
Copy link
Contributor

MichaelBelousov commented Jul 2, 2020

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
Copy link
Author

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

@MichaelBelousov
Copy link
Contributor

@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
Copy link
Contributor

neikeq commented Jul 21, 2020

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

@neikeq neikeq added this to the 4.0 milestone Jul 21, 2020
@neikeq neikeq added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jul 21, 2020
@aaronfranke aaronfranke removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jul 21, 2020
@aaronfranke
Copy link
Member

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

@akien-mga
Copy link
Member

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

@sanslash332
Copy link

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
Copy link
Member

Calinou commented Jul 22, 2020

@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.)

@akien-mga akien-mga modified the milestones: 4.0, 3.2 Jul 22, 2020
@akien-mga akien-mga reopened this Jul 22, 2020
@ndarilek
Copy link
Contributor

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 akien-mga modified the milestones: 3.2, 3.3 Mar 17, 2021
@akien-mga akien-mga modified the milestones: 3.3, 3.5 Oct 25, 2021
@akien-mga
Copy link
Member

Is this still reproducible in 3.4 RC 1 or later?

@Maveyyl
Copy link

Maveyyl commented Dec 3, 2021

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
Copy link

ghost commented Nov 11, 2022

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.

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

No branches or pull requests

10 participants