Fixed plugin deletion

This commit is contained in:
2025-04-23 12:21:44 +03:00
parent f10d72d704
commit 2cb868d747
7 changed files with 66 additions and 53 deletions

View File

@@ -1,15 +1,21 @@
using System.Reflection;
using System.Runtime.Loader;
using DiscordBotCore.Logging;
namespace DiscordBotCore.PluginManagement.Loading;
public class PluginLoaderContext : AssemblyLoadContext
{
public PluginLoaderContext(string name) : base(name: name, isCollectible: true) {}
private readonly ILogger _logger;
public PluginLoaderContext(ILogger logger, string name) : base(name: name, isCollectible: true)
{
_logger = logger;
}
protected override Assembly? Load(AssemblyName assemblyName)
{
_logger.Log("Assembly load requested: " + assemblyName.Name, this);
return base.Load(assemblyName);
}
}