Closed
Description
Tested versions
Reproducible in 4.2.stable, 4.3.stable, 4.4.dev
System information
Godot v4.4.beta.mono - EndeavourOS SMP PREEMPT_DYNAMIC Sun, 02 Feb 2025 01:02:29 +0000 on Wayland - X11 display driver, Multi-window, 1 monitor - Vulkan (Mobile) - integrated AMD Radeon Graphics (RADV RENOIR) - AMD Ryzen 7 4800U with Radeon Graphics (16 threads)
Issue description
The error occurs .NET: Failed to unload assemblies. Please check #78513 for more information when using TweenMethod
/TweenCallback
in tool script and building and reloading scene several times.
Steps to reproduce
Add a node and attach the script to it ( see also MRP ). Make changes to code, build and reload scene several times.
using Godot;
[Tool]
public partial class TweenAnim : Node2D
{
public override void _Ready()
{
Position = Vector2.Zero;
var tween = CreateTween();
// with this:
tween.TweenMethod(
Callable.From((Vector2 p) => { Position = p; }), Vector2.Zero, new Vector2(200, 200), 1);
// or with this:
// tween.TweenCallback(
// Callable.From(() => { Position = new(200, 200); })
// ).SetDelay(1);
// comment out/modify the code, build, and *reload* the scene several times
// GD.Print("ready");
}
}
Error log
.NET: Reloading assemblies...
ERROR: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'TweenAnim'.
at Godot.GodotObject.GetPtr(GodotObject instance) in /home/luo/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:line 93
at Godot.GodotObject.GetInstanceId() in /home/luo/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/GodotObject.cs:line 539
at Godot.DelegateUtils.TrySerializeSingleDelegate(Delegate delegate, Byte[]& buffer) in /home/luo/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs:line 174
at Godot.DelegateUtils.TrySerializeDelegate(Delegate delegate, Array serializedData) in /home/luo/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs:line 134
at Godot.DelegateUtils.TrySerializeDelegateWithGCHandle(IntPtr delegateGCHandle, godot_array* nSerializedData) in /home/luo/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs:line 325
at: void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (/home/luo/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:113)
Failed to serialize delegate
Unloading assembly load context...
Assembly unloading is taking longer than expected...
Failed to unload assemblies. Possible causes: Strong GC handles, running threads, etc.