Allow plugins to look up harmony types in other plugins/themselves
All checks were successful
Build / Compute Version (push) Successful in 5s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 1m37s
Build / Build Nuget package (NuGet) (push) Successful in 2m17s
Build / Build Nuget package (CringePlugins) (push) Successful in 2m53s
Build / Build Nuget package (SharedCringe) (push) Successful in 1m59s
Build / Build Launcher (push) Successful in 3m10s

This commit is contained in:
2024-11-03 16:45:09 -05:00
parent ed4fd11de0
commit b3ef089a70
3 changed files with 14 additions and 4 deletions

View File

@@ -1,6 +1,8 @@
using System.Runtime.Loader;
using System.Collections.Immutable;
using System.Runtime.Loader;
using CringeBootstrap.Abstractions;
using CringePlugins.Utils;
using SharedCringe.Loader;
using VRage.Plugins;
namespace CringePlugins.Loader;
@@ -26,12 +28,13 @@ internal sealed class PluginInstance
{
}
public void Instantiate()
public void Instantiate(ImmutableArray<DerivedAssemblyLoadContext>.Builder contextBuilder)
{
if (AssemblyLoadContext.GetLoadContext(typeof(PluginInstance).Assembly) is not ICoreLoadContext parentContext)
throw new NotSupportedException("Plugin instantiation is not supported in this context");
_context = new PluginAssemblyLoadContext(parentContext, _entrypointPath);
contextBuilder.Add(_context);
var entrypoint = _context.LoadEntrypoint();