do not crash when other threads failed

This commit is contained in:
Paddy Xu
2017-10-22 16:34:19 +03:00
parent 778c578656
commit c15f589a8f
2 changed files with 8 additions and 2 deletions
+1
View File
@@ -14,6 +14,7 @@
</startup>
<runtime>
<legacyCorruptedStateExceptionsPolicy enabled="true" />
<legacyUnhandledExceptionPolicy enabled="1" />
</runtime>
<userSettings>
<QuickLook.Properties.Settings>
+7 -2
View File
@@ -16,6 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -44,9 +45,13 @@ namespace QuickLook
{
AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
{
MessageBox.Show(((Exception) args.ExceptionObject).ToString());
//MessageBox.Show(((Exception) args.ExceptionObject).ToString());
Shutdown();
const string source = "QuickLook Application Error";
if (!EventLog.SourceExists(source))
EventLog.CreateEventSource(source, "Application");
EventLog.WriteEntry(source, ((Exception) args.ExceptionObject).ToString(),
EventLogEntryType.Error);
};
base.OnStartup(e);