fix errors during early startup not shown before exit

This commit is contained in:
Jesse Plamondon-Willard 2019-03-27 21:13:46 -04:00
parent 29d11a72c2
commit 20912724a0
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 13 additions and 4 deletions

View File

@ -4,6 +4,7 @@ These changes have not been released yet.
* For players:
* SMAPI now prevents invalid items from breaking menus on hover.
* Fixed errors during early startup not shown before exit.
* For modders:
* `this.Monitor.Log` now defaults to the `Trace` log level instead of `Debug`.

View File

@ -30,10 +30,18 @@ namespace StardewModdingAPI
/// <param name="args">The command-line arguments.</param>
public static void Main(string[] args)
{
AppDomain.CurrentDomain.AssemblyResolve += Program.CurrentDomain_AssemblyResolve;
Program.AssertGamePresent();
Program.AssertGameVersion();
Program.Start(args);
try
{
AppDomain.CurrentDomain.AssemblyResolve += Program.CurrentDomain_AssemblyResolve;
Program.AssertGamePresent();
Program.AssertGameVersion();
Program.Start(args);
}
catch (Exception ex)
{
Console.WriteLine($"SMAPI failed to initialise: {ex}");
Program.PressAnyKeyToExit(true);
}
}