@@ -243,23 +243,23 @@ private void AutoUpdates()
243
243
244
244
private void RegisterExitEvents ( )
245
245
{
246
- AppDomain . CurrentDomain . ProcessExit += ( s , e ) =>
246
+ AppDomain . CurrentDomain . ProcessExit += async ( s , e ) =>
247
247
{
248
248
Log . Info ( "|App.RegisterExitEvents|Process Exit" ) ;
249
- _ = DisposeAsync ( ) ;
249
+ await DisposeAsync ( ) ;
250
250
} ;
251
251
252
- Current . Exit += ( s , e ) =>
252
+ Current . Exit += async ( s , e ) =>
253
253
{
254
254
NativeThreadCTS . Cancel ( ) ;
255
255
Log . Info ( "|App.RegisterExitEvents|Application Exit" ) ;
256
- _ = DisposeAsync ( ) ;
256
+ await DisposeAsync ( ) ;
257
257
} ;
258
258
259
- Current . SessionEnding += ( s , e ) =>
259
+ Current . SessionEnding += async ( s , e ) =>
260
260
{
261
261
Log . Info ( "|App.RegisterExitEvents|Session Ending" ) ;
262
- _ = DisposeAsync ( ) ;
262
+ await DisposeAsync ( ) ;
263
263
} ;
264
264
}
265
265
@@ -303,6 +303,8 @@ protected virtual async ValueTask DisposeAsync(bool disposing)
303
303
_disposed = true ;
304
304
}
305
305
306
+ await Task . Delay ( 10000 ) ;
307
+
306
308
await Stopwatch . NormalAsync ( "|App.Dispose|Dispose cost" , async ( ) =>
307
309
{
308
310
Log . Info ( "|App.Dispose|Begin Flow Launcher dispose ----------------------------------------------------" ) ;
@@ -313,7 +315,7 @@ await Stopwatch.NormalAsync("|App.Dispose|Dispose cost", async () =>
313
315
await PluginManager . DisposePluginsAsync ( ) ;
314
316
315
317
// Dispose needs to be called on the main Windows thread, since some resources owned by the thread need to be disposed.
316
- await _mainWindow ? . Dispatcher . InvokeAsync ( DisposeAsync ) ;
318
+ await _mainWindow ? . Dispatcher . InvokeAsync ( _mainWindow . Dispose ) ;
317
319
_mainVM ? . Dispose ( ) ;
318
320
}
319
321
0 commit comments