Pārlūkot izejas kodu

update mono unhandled exception handler

Luke Pulverenti 8 gadi atpakaļ
vecāks
revīzija
ffb935700c

+ 4 - 2
Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs

@@ -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);
         }
         }
     }
     }
 }
 }

+ 6 - 1
MediaBrowser.Server.Mono/Program.cs

@@ -258,7 +258,12 @@ namespace MediaBrowser.Server.Mono
 
 
             if (!Debugger.IsAttached)
             if (!Debugger.IsAttached)
             {
             {
-                Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception));
+                var message = LogHelper.GetLogMessage(exception).ToString();
+
+                if (message.IndexOf("InotifyWatcher", StringComparison.OrdinalIgnoreCase) == -1)
+                {
+                    Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception));
+                }
             }
             }
         }
         }
 
 

+ 2 - 0
MediaBrowser.Server.Mono/app.config

@@ -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" />