godotengine / godotengine/godot-dotnet

Lots of `Unreferenced static string to 0:` errors when closing a scene

Open
#20 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
228
Forks
30
PR merge metrics
No merged PRs in 30d

Description

### Godot version

Godot v4.4.dev (7c383767a)

### Godot .NET packages version

master (9cb7becfd4d5ec535d52ed1c8958216130beb88c)

### System information

Godot v4.4.dev (7c383767a) - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 32.0.15.6094) - AMD Ryzen 9 3900X 12-Core Processor (24 Threads)

### .NET information

.NET SDK: Version: 8.0.400 Commit: 36fe6dda56 Workload version: 8.0.400-manifests.56cd0383 MSBuild version: 17.11.3+0c8610977

### Issue description

When closing a project which has an instance of a class, that's defined in a C# GDExtension, a lot of `ERROR: BUG: Unreferenced static string to 0: {_process | _enter_tree | _ready | _input | ...}` messages are printed in between `Disposing tracked instances` and `Finished disposing tracked instances` to the console. When explicitly overriding these methods in GDScript they will no longer be included in that list.

### Steps to reproduce

1. Declare a basic class on the C# side:
```csharp
[GodotClass]
public partial class SampleNode : Node3D
{

}
```
2. Register that class as a runtime class in the ClassDB
3. Create a node of the type created in step 1 in a scene and attach an empty script written in GDScript that extends this type to it.
4. Either run the scene and exit it from the editor or export the scene and run the exported version.

When running the scene from the editor, error message are only printed sporadically, sometimes there are none at all and everything seems to work just fine. Exporting the project however should print these errors every time you close the scene.

You can also notice that the amount of error messages become fewer the more methods you override in GDScript. When overriding _ready, _process, _physics_process, _enter_tree, _exit_tree, _unhandled_input, _input, _shortcut_input and _unhhandled_key_input no error messages should remain.

### Minimal reproduction project

N/A

Contributor guide

Open the contributing guide

Research direction

Start with the minimal reproduction steps and inspect shutdown logging between “Disposing tracked instances” and “Finished disposing tracked instances.” Compare an empty C# GDExtension class with the same class overriding the listed GDScript methods; done means closing or exporting the scene no longer reports unreferenced static strings.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.