summaryrefslogtreecommitdiff
path: root/modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs
diff options
context:
space:
mode:
authorIgnacio Roldán Etcheverry <ignalfonsore@gmail.com>2022-10-16 23:55:54 +0200
committerIgnacio Roldán Etcheverry <ignalfonsore@gmail.com>2022-10-17 00:22:48 +0200
commit2303c267831cdeaec8240a5ac5aca61379a376a1 (patch)
tree26d4d64599f29b6aa03d57f6ffb654d71d09060b /modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs
parent3a59c833f1b7e34ddef57522800288a0dee8562d (diff)
C#: Load assemblies as collectible only in the Godot editor
We use collectible AssemblyLoadContexts as that's the only way to allow reloading assemblies after building. However, collectible assemblies have some restrictions: - https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/collectible-assemblies#restrictions-on-collectible-assemblies Those restrictions can cause issues with third-party code, such as some mocking libraries. In order to work around this problem, we're going to load assemblies as collectible only in Godot editor, and not when running games. These issues will still exist in the editor, but this will be enough for some users.
Diffstat (limited to 'modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs')
-rw-r--r--modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs b/modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs
index dcd572c65e..344b76a202 100644
--- a/modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs
+++ b/modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs
@@ -15,8 +15,8 @@ namespace GodotPlugins
public string? AssemblyLoadedPath { get; private set; }
public PluginLoadContext(string pluginPath, ICollection<string> sharedAssemblies,
- AssemblyLoadContext mainLoadContext)
- : base(isCollectible: true)
+ AssemblyLoadContext mainLoadContext, bool isCollectible)
+ : base(isCollectible)
{
_resolver = new AssemblyDependencyResolver(pluginPath);
_sharedAssemblies = sharedAssemblies;