Quick and dirty hack to resolve dll conflicts

This commit is contained in:
Brant Martin
2019-10-31 18:18:19 -04:00
parent cc91fa3653
commit 5780cf7c95

View File

@@ -330,6 +330,8 @@ namespace Torch.Managers
private void LoadPlugin(PluginItem item)
{
var assemblies = new List<Assembly>();
var loaded = AppDomain.CurrentDomain.GetAssemblies();
if (item.IsZip)
{
@@ -340,6 +342,9 @@ namespace Torch.Managers
if (!entry.Name.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase))
continue;
if (loaded.Any(a => entry.Name.Contains(a.GetName().Name)))
continue;
using (var stream = entry.Open())
{
@@ -375,6 +380,9 @@ namespace Torch.Managers
if (!file.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase))
continue;
if (loaded.Any(a => file.Contains(a.GetName().Name)))
continue;
using (var stream = File.OpenRead(file))
{
var data = stream.ReadToEnd();
@@ -391,7 +399,7 @@ namespace Torch.Managers
{
_log.Warn(e, $"Failed to read debugging symbols from {symbolPath}");
}
assemblies.Add(symbol != null ? Assembly.Load(data, symbol) : Assembly.Load(data));
}
}