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] Stop Reloading Scripts that have Empty Paths #98097

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Delsin-Yu
Copy link
Contributor

@Delsin-Yu Delsin-Yu commented Oct 11, 2024

fixes #98094

Before this PR, Godot Editor will try to reload scripts that do not have a path but are valid, that is, scripts from an external source such as ProjectReferences or Nuget Packages.
These external types are never visible to Godot Editor; they are only registered to GodotSharp when they are the ancestors of scripts under the Project Directory.

However, during an Assembly Unloading & Loading, the mono module will queue these types to the to_reload list and attempt to reload them, which causes duplicate key exceptions in the ScriptTypeBiMap as they are already registered by GodotSharp when loading children types.

This PR adds a check to avoid a valid script instance with no script path from entering the to_reload list, which resolves the issue.

This PR also improves the robustness of ScriptTypeBiMap by ensuring that dirty data does not enter the internal dictionaries when the Add and Remove methods fail.

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

Successfully merging this pull request may close these issues.

[.Net] Duplicate Key Exceptions from ScriptTypeBiMap.Add
2 participants