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

.NET: TryDeserializeSingleDelegate throws when deserializing overloaded 0-parameter method. #78886

Closed
mattdiener opened this issue Jun 30, 2023 · 0 comments · Fixed by #78877
Closed

Comments

@mattdiener
Copy link
Contributor

Godot version

v4.0.2.stable.mono.official [7a0977c]

System information

Windows 10 - Godot v4.0.2.stable

Issue description

Part of the process of reloading assemblies involves deserializing delgates - presumably as a way to recover editor state. When that's happening, if a 0-parameter method has overloads, attempts to uniquely acquire that method with System.Type.GetMethod will throw System.Reflection.AmbiguousMatchException: Ambiguous match found.

 modules\mono\glue\runtime_interop.cpp:1324 - System.Reflection.AmbiguousMatchException: Ambiguous match found.
     at System.RuntimeType.GetMethodImplCommon(String name, Int32 genericParameterCount, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
     at System.Type.GetMethod(String name, BindingFlags bindingAttr)
     at Godot.DelegateUtils.TryDeserializeMethodInfo(BinaryReader reader, MethodInfo& methodInfo) in E:\src\godot\modules\mono\glue\GodotSharp\GodotSharp\Core\DelegateUtils.cs:line 520
     at Godot.DelegateUtils.TryDeserializeSingleDelegate(Byte[] buffer, Delegate& delegate) in E:\src\godot\modules\mono\glue\GodotSharp\GodotSharp\Core\DelegateUtils.cs:line 425
     at Godot.DelegateUtils.TryDeserializeDelegate(Array serializedData, Delegate& delegate) in E:\src\godot\modules\mono\glue\GodotSharp\GodotSharp\Core\DelegateUtils.cs:line 355
     at Godot.DelegateUtils.TryDeserializeDelegateWithGCHandle(godot_array* nSerializedData, IntPtr* delegateGCHandle) in E:\src\godot\modules\mono\glue\GodotSharp\GodotSharp\Core\DelegateUtils.cs:line 321

Steps to reproduce

In the minimal repro project:

  1. Compile C# code.
  2. Ensure the GetMethodRepro plugin is enabled.
  3. Restart Godot and open the project.
  4. Make any change to the non-plugin code Anything.cs.
  5. Recompile while the editor is still running.

Minimal reproduction project

GetMethodBug.zip

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

Successfully merging a pull request may close this issue.

2 participants