Log LoaderException exceptions when loading plugins

This commit is contained in:
Aireil 2021-02-15 13:03:17 +01:00
parent a777c58a89
commit 34a1eb0b9c
2 changed files with 17 additions and 4 deletions

View file

@ -104,6 +104,12 @@ namespace Dalamud.Plugin
}
catch (Exception ex) {
Log.Error(ex, $"Plugin load for {dllFile.FullName} failed.");
if (ex is ReflectionTypeLoadException) {
var typeLoadException = ex as ReflectionTypeLoadException;
foreach (var exception in typeLoadException.LoaderExceptions) {
Log.Error(exception, "LoaderException:");
}
}
}
}
}

View file

@ -6,6 +6,7 @@ using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using CheapLoc;
@ -149,8 +150,14 @@ namespace Dalamud.Plugin
return this.dalamud.PluginManager.LoadPluginFromAssembly(dllFile, false, PluginLoadReason.Installer);
}
catch (Exception e) {
Log.Error(e, "Plugin download failed hard.");
catch (Exception ex) {
Log.Error(ex, "Plugin download failed hard.");
if (ex is ReflectionTypeLoadException) {
var typeLoadException = ex as ReflectionTypeLoadException;
foreach (var exception in typeLoadException.LoaderExceptions) {
Log.Error(exception, "LoaderException:");
}
}
return false;
}
}
@ -287,8 +294,8 @@ namespace Dalamud.Plugin
}
}
}
catch (Exception e) {
Log.Error(e, "Plugin update failed.");
catch (Exception ex) {
Log.Error(ex, "Plugin update failed.");
hasError = true;
}