diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-19 23:41:03 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-19 23:41:03 -0400 |
commit | 464d6b2275f52b9db5560e242c6073fbd816bcb3 (patch) | |
tree | 1a3c44b8bb63abdc561eb5caac6a4c6ed0dc9aea /src/SMAPI/Program.cs | |
parent | 215f2a10c294d4acce771466c163bfdaccff4552 (diff) | |
download | SMAPI-464d6b2275f52b9db5560e242c6073fbd816bcb3.tar.gz SMAPI-464d6b2275f52b9db5560e242c6073fbd816bcb3.tar.bz2 SMAPI-464d6b2275f52b9db5560e242c6073fbd816bcb3.zip |
fix error handling when resolving assemblies (#582)
Diffstat (limited to 'src/SMAPI/Program.cs')
-rw-r--r-- | src/SMAPI/Program.cs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 64eeb45a..f5a32b4f 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -370,21 +370,21 @@ namespace StardewModdingAPI /// <param name="e">The event arguments.</param> private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs e) { - AssemblyName name = new AssemblyName(e.Name); - foreach (FileInfo dll in new DirectoryInfo(Program.DllSearchPath).EnumerateFiles("*.dll")) + try { - try + AssemblyName name = new AssemblyName(e.Name); + foreach (FileInfo dll in new DirectoryInfo(Program.DllSearchPath).EnumerateFiles("*.dll")) { if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.InvariantCultureIgnoreCase)) return Assembly.LoadFrom(dll.FullName); } - catch (Exception ex) - { - throw new InvalidOperationException($"Could not load dependency 'smapi-lib/{dll.Name}'. Consider deleting the smapi-lib folder and reinstalling SMAPI.", ex); - } + return null; + } + catch (Exception ex) + { + Console.WriteLine($"Error resolving assembly: {ex}"); + return null; } - - return null; } /// <summary>Assert that the minimum conditions are present to initialise SMAPI without type load exceptions.</summary> |