update mono unhandled exception handler

This commit is contained in:
Luke Pulverenti 2017-04-27 14:11:56 -04:00
parent f13696868f
commit ffb935700c
3 changed files with 12 additions and 3 deletions

View File

@ -35,9 +35,11 @@ namespace Emby.Server.Implementations.Logging
// Write to console just in case file logging fails // Write to console just in case file logging fails
_console.WriteLine("UnhandledException"); _console.WriteLine("UnhandledException");
_console.WriteLine(builder.ToString());
_fileSystem.WriteAllText(path, builder.ToString()); var logMessage = builder.ToString();
_console.WriteLine(logMessage);
_fileSystem.WriteAllText(path, logMessage);
} }
} }
} }

View File

@ -257,10 +257,15 @@ namespace MediaBrowser.Server.Mono
new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager, FileSystem, new ConsoleLogger()).Log(exception); new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager, FileSystem, new ConsoleLogger()).Log(exception);
if (!Debugger.IsAttached) if (!Debugger.IsAttached)
{
var message = LogHelper.GetLogMessage(exception).ToString();
if (message.IndexOf("InotifyWatcher", StringComparison.OrdinalIgnoreCase) == -1)
{ {
Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception)); Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception));
} }
} }
}
public static void Shutdown() public static void Shutdown()
{ {

View File

@ -11,6 +11,8 @@
<add key="ReleaseProgramDataPath" value="ProgramData-Server" /> <add key="ReleaseProgramDataPath" value="ProgramData-Server" />
</appSettings> </appSettings>
<runtime> <runtime>
<legacyUnhandledExceptionPolicy enabled="1" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" /> <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />