When finalizing the C# language every C# instance is disposed and the instance bindings callbacks are no longer valid. Clearing the instance bindings ensures these callbacks are not called, and since we dispose of every C# instance there should be no leaks.
Defaults to "Auto", which detects the casing based on the
preference of the currently selected language (C# for example
prefers PascalCase whereas GDScript prefers snake_case).
- Unify documentation, hoping to clear misconcepctions about about propagation of the cache mode across dependant loads.
- Clarify in docs that `CACHE_MODE_REPLACE` now also works on the main resource (from #87008).
- Add two recursive modes, counterparts of `CACHE_MODE_REPLACE` and `CACHE_MODE_IGNORE`, since it seems some need them (see #59669, #82830).
- Let resources, even loaded with one of the ignore-cache modes, get a path, which is useful for tools.
fixes: #88543fixes: #88160
Because of the limitations of compiled programming languages like C#, when a newly created *.cs file hasn't been compiled, we don't have any information about its `Path` or `Type` in the `assemply`. This means we end up creating an invalid instance of this file whenever there's a request. Consequently, multiple instances of the script can exist. When a new instance takes over the path, it clears the `path_cache` of the previous instance, leading to undefined behavior.
- Create CSharpScript for generic C# types.
- `ScriptPathAttributeGenerator` registers the path for the generic type definition.
- `ScriptManagerBridge` lookup uses the generic type definition that was registered by the generator.
- Constructed generic types use a virtual `csharp://` path so they can be registered in the map and loaded as if there was a different file for each constructed type, even though they all share the same real path.
- This allows getting the base type for a C# type that derives from a generic type.
- Shows base scripts in the _Add Node_ and _Create Resource_ dialogs even when they are generic types.
- `get_global_class_name` implementation was moved to C# and now always returns the base type even if the script is not a global class (this behavior matches GDScript).
- Create `CSharpScript::TypeInfo` struct to hold all the type information about the C# type that corresponds to the `CSharpScript`, and use it as the parameter in `UpdateScriptClassInfo` to avoid adding more parameters.
The crash cond was accidentally moved to the `reload_scripts` method when it was only meant to be in the `reload_tool_script` method. Same about restarting the HotReloadAssemblyWatcher timer.
Also removed the loop that checks if the script array contains a C# script because if we're in CSharpLanguage we can assume that at least one of them is.
When exporting a game that contains a C# solution, a feature is added so the exported game can check if it should initialize the .NET module. Otherwise, the module initialization is skipped so games without C# won't check for the assemblies and won't show alerts when they're missing.