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# generaic usage can cause Duplicate Key Exception when performing Assembly Reloading #87877

Closed
Delsin-Yu opened this issue Feb 2, 2024 · 0 comments · Fixed by #87890
Closed

Comments

@Delsin-Yu
Copy link
Contributor

Delsin-Yu commented Feb 2, 2024

Tested versions

Reproduced in v4.3.dev.mono.custom_build [10e1114]

System information

Godot v4.3.dev.mono (10e1114) - Windows 10.0.19044 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU (NVIDIA; 31.0.15.2802) - AMD Ryzen 9 5900HS with Radeon Graphics (16 Threads)

Issue description

It turns out that there is more to discover in addressing #79519 since this more complex MRP is still causing identical issues.

Steps to reproduce

  • Build the GodotEngine on commit 10e1114 with the Mono module enabled according to the Build from source Godot documentation.
  • Open the MRP.
  • Open every scene inside this project (optional, at least open main_panel).
  • Execute a clean dotnet project build (that is, a build process that actually executes and triggers Editor ALC reload without reusing existing MSBuild cache, you can achieve this by editing any code inside the project).
  • Based on the scenes you opened, you will get an arbitrary amount of duplicate key exceptions
  • Execute another build that triggers ALC reloading will causing .NET: Failed to unload assemblies. Please check <this issue> for more information. #78513.
Unloading assembly load context...
Assembly load context unloaded successfully.
ERROR: System.ArgumentException: An item with the same key has already been added. Key: DEYU.UI.ListControl.ListItemComponent`1[System.Int32]
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at Godot.Bridge.ScriptManagerBridge.ScriptTypeBiMap.Add(IntPtr scriptPtr, Type scriptType) in D:\Repos\godot\modules\mono\glue\GodotSharp\GodotSharp\Core\Bridge\ScriptManagerBridge.types.cs:line 23
   at Godot.Bridge.ScriptManagerBridge.TryReloadRegisteredScriptWithClass(IntPtr scriptPtr) in D:\Repos\godot\modules\mono\glue\GodotSharp\GodotSharp\Core\Bridge\ScriptManagerBridge.cs:line 594
   at: void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (D:/Repos/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:113)

Minimal reproduction project (MRP)

minimal.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.

3 participants