Skip to content

Commit d0164fb

Browse files
committed
Fix | log unhandled and task
1 parent 32e55dc commit d0164fb

6 files changed

Lines changed: 21 additions & 4 deletions

File tree

ShadowViewer.Sdk

ShadowViewer/App.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@
99
using Windows.ApplicationModel.Activation;
1010
using Windows.Storage;
1111
using DryIoc;
12+
using Serilog;
1213

1314
namespace ShadowViewer
1415
{
1516
public partial class App
1617
{
1718
public App()
1819
{
20+
this.UnhandledException += (s, e) =>
21+
{
22+
Log.Fatal(e.Exception, "Application UnhandledException");
23+
Log.CloseAndFlush();
24+
};
1925
ApplicationExtensionHost.Initialize(this);
2026
this.InitializeComponent();
2127
ShadowObservableConfig.GlobalSetting.Init(

ShadowViewer/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Identity
1212
Name="kitUIN.ShadowViewer"
1313
Publisher="CN=kitUIN"
14-
Version="0.5.6.0" />
14+
Version="0.5.7.0" />
1515

1616
<Properties>
1717
<DisplayName>ShadowViewer</DisplayName>

ShadowViewer/Program.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.UI.Dispatching;
22
using Microsoft.UI.Xaml;
33
using Microsoft.Windows.AppLifecycle;
4+
using Serilog;
45
using System;
56
using System.Diagnostics;
67
using System.Linq;
@@ -27,6 +28,16 @@ public class Program
2728
[STAThread]
2829
static int Main(string[] args)
2930
{
31+
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
32+
{
33+
Log.Fatal(e.ExceptionObject as Exception, "AppDomain UnhandledException");
34+
Log.CloseAndFlush();
35+
};
36+
TaskScheduler.UnobservedTaskException += (s, e) =>
37+
{
38+
Log.Fatal(e.Exception, "TaskScheduler UnobservedTaskException");
39+
Log.CloseAndFlush();
40+
};
3041
WinRT.ComWrappersSupport.InitializeComWrappers();
3142
var isRedirect = DecideRedirection();
3243

0 commit comments

Comments
 (0)