diff --git a/NeosModLoader/ModLoader.cs b/NeosModLoader/ModLoader.cs index dadbd69..9ce1df0 100644 --- a/NeosModLoader/ModLoader.cs +++ b/NeosModLoader/ModLoader.cs @@ -4,12 +4,13 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Text; namespace NeosModLoader { public class ModLoader { - internal const string VERSION_CONSTANT = "1.11.0"; + internal const string VERSION_CONSTANT = "1.11.1"; /// /// NeosModLoader's version /// @@ -65,6 +66,25 @@ internal static void LoadMods() RegisterMod(loaded); } } + catch (ReflectionTypeLoadException reflectionTypeLoadException) + { + // this exception type has some inner exceptions we must also log to gain any insight into what went wrong + StringBuilder sb = new(); + sb.AppendLine(reflectionTypeLoadException.ToString()); + foreach (Exception loaderException in reflectionTypeLoadException.LoaderExceptions) + { + sb.AppendLine($"Loader Exception: {loaderException.Message}"); + if (loaderException is FileNotFoundException fileNotFoundException) + { + if (!string.IsNullOrEmpty(fileNotFoundException.FusionLog)) + { + sb.Append(" Fusion Log:\n "); + sb.AppendLine(fileNotFoundException.FusionLog); + } + } + } + Logger.ErrorInternal($"ReflectionTypeLoadException initializing mod from {mod.File}:\n{sb}"); + } catch (Exception e) { Logger.ErrorInternal($"Unexpected exception initializing mod from {mod.File}:\n{e}"); diff --git a/NeosModLoader/Utility/EnumerableInjector.cs b/NeosModLoader/Utility/EnumerableInjector.cs index e97de00..d70603c 100644 --- a/NeosModLoader/Utility/EnumerableInjector.cs +++ b/NeosModLoader/Utility/EnumerableInjector.cs @@ -1,9 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace NeosModLoader.Utility {