1
Fork 0
mirror of https://gitlab.com/Kwoth/nadekobot.git synced 2024-10-02 20:13:13 +00:00

fix: Fixed medusa dependency loading. In case your medusa has other dependencies they will be correctly loaded now. Note: Make sure to not publish any other DLLs besides the ones you are sure you will need, as there can be version conflicts which didn't happen before. For example if you have a NadekoMedusa.dll which is a different version in the data/medusa/mymedusa folder, your medusa will now break, as this fix will now (correctly) try to load it and there will be a version mismatch between the attributes. In a future patch i'll try to mitigate this by not loading dlls which are already loaded by the bot (even if their versions are different) but this might cause new issues as sometimes you do need different version of libraries for medusa... The best option is to just keep what you need, and make sure to remove any other dlls

This commit is contained in:
Kwoth 2024-09-21 20:11:36 +00:00
parent 2c3e5fe507
commit f473014fe9

View file

@ -330,9 +330,9 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
throw new FileNotFoundException($"Medusa dll not found: {path}");
strings = MedusaStrings.CreateDefault(dir);
var ctx = new MedusaAssemblyLoadContext(Path.GetDirectoryName(path)!);
var ctx = new MedusaAssemblyLoadContext(path);
var a = ctx.LoadFromAssemblyPath(Path.GetFullPath(path));
ctx.LoadDependencies(a);
// ctx.LoadDependencies(a);
// load services
iocModule = new MedusaNinjectIocModule(_cont, a, safeName);