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# callable regression after #67987 #68349

Closed
geowarin opened this issue Nov 6, 2022 · 3 comments
Closed

C# callable regression after #67987 #68349

geowarin opened this issue Nov 6, 2022 · 3 comments

Comments

@geowarin
Copy link
Contributor

geowarin commented Nov 6, 2022

Godot version

v4.0.beta.mono.custom_build [256c007]

System information

Arch Linux

Issue description

Trying to attach a C# method to an event causes an exception.
I identified 256c007 to be the culprit.


E 0:00:00:0771   Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(IntPtr , Godot.NativeInterop.godot_string_name* , Godot.NativeInterop.godot_variant** , Int32 , Godot.NativeInterop.godot_variant_call_error* , Godot.NativeInterop.godot_variant* ): System.TypeLoadException: Could not load type 'PressedEventHandler' from assembly 'GodotSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.
  <C++ Error>    Exception
  <C++ Source>   :0 @ void control._Ready()()
  <Stack Trace>  :0 @ void control._Ready()()
                 Node.cs:1815 @ Boolean Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )()
                 CanvasItem.cs:1259 @ Boolean Godot.CanvasItem.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )()
                 Control.cs:3080 @ Boolean Godot.Control.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name& , Godot.NativeInterop.NativeVariantPtrArgs , Godot.NativeInterop.godot_variant& )()
                 CSharpInstanceBridge.cs:24 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(IntPtr , Godot.NativeInterop.godot_string_name* , Godot.NativeInterop.godot_variant** , Int32 , Godot.NativeInterop.godot_variant_call_error* , Godot.NativeInterop.godot_variant* )()

Steps to reproduce

public partial class control : Control
{
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		GetNode<Button>("Button").Pressed += () =>
		{
			GD.Print("Pressed");
		};
	}
}

Minimal reproduction project

Repro link: https://github.com/geowarin/CallableBug

CallableBug-main.zip

@raulsntos
Copy link
Member

Since you are using a custom build, make sure to clean the GodotNuGetFallbackFolder directory to make sure the newly built packages are used.

@geowarin
Copy link
Contributor Author

geowarin commented Nov 7, 2022

@raulsntos Yes that was it, thank you and sorry for the false positive!

Maybe this should be added to the C# readme?

@geowarin geowarin closed this as completed Nov 7, 2022
@raulsntos
Copy link
Member

raulsntos commented Nov 7, 2022

We'll likely get rid of GodotNuGetFallbackFolder with the editor unification, but I guess adding a note in the meantime could be useful for users building from source.

Edit: We got rid of GodotNuGetFallbackFolder in 4.1 (see #73984).

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

2 participants