catch exceptions on UI thread tasks
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
@@ -362,7 +362,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
WarningMessage = message;
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
await Task.Delay(7000);
if (WarningMessage == message)

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -320,7 +320,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private void Coins_CollectionGlobalChanged(object sender, NotifyCollectionChangedEventArgs e)
{
- Dispatcher.UIThread.Post(() =>
+ Dispatcher.UIThread.PostLogException(() =>
{
switch (e.Action)
{
@@ -376,7 +376,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private void Coin_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
- Dispatcher.UIThread.Post(() =>
+ Dispatcher.UIThread.PostLogException(() =>
{
if (e.PropertyName == nameof(CoinViewModel.IsSelected))
{

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -70,7 +70,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
ClipboardNotificationVisible = true;
ClipboardNotificationOpacity = 1;
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
await Task.Delay(1000);
ClipboardNotificationOpacity = 0;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -52,7 +52,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
LabelRequiredNotificationVisible = true;
LabelRequiredNotificationOpacity = 1;
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
await Task.Delay(1000);
LabelRequiredNotificationOpacity = 0;
@@ -61,7 +61,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
return;
}
- Dispatcher.UIThread.Post(() =>
+ Dispatcher.UIThread.PostLogException(() =>
{
var label = Label;
HdPubKey newKey = Global.WalletService.GetReceiveKey(label, Addresses.Select(x => x.Model).Take(7)); // Never touch the first 7 keys.
@@ -92,7 +92,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
ClipboardNotificationVisible = true;
ClipboardNotificationOpacity = 1;
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
await Task.Delay(1000);
ClipboardNotificationOpacity = 0;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -118,7 +118,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
if (betterAmount != amount)
{
- Dispatcher.UIThread.Post(() =>
+ Dispatcher.UIThread.PostLogException(() =>
{
Amount = betterAmount;
});
@@ -538,7 +538,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SuccessMessage = "";
WarningMessage = message;
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
await Task.Delay(7000);
if (WarningMessage == message)
@@ -553,7 +553,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SuccessMessage = message;
WarningMessage = "";
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
await Task.Delay(7000);
if (SuccessMessage == message)

MODIFY
WalletWasabi.Gui/Dialogs/CannotCloseDialogViewModel.cs
WalletWasabi.Gui/Dialogs/CannotCloseDialogViewModel.cs
@@ -179,13 +179,16 @@ namespace WalletWasabi.Gui.Dialogs
{
WarningMessage = message;
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
try
{
await Task.Delay(7000, token);
}
- catch (Exception) { }
+ catch (TaskCanceledException ex)
+ {
+ Logging.Logger.LogTrace<CannotCloseDialogViewModel>(ex);
+ }
if (WarningMessage == message)
{

MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -143,7 +143,7 @@ namespace WalletWasabi.Gui
e.Cancel = true;
Logger.LogWarning("Process was signaled for killing.", nameof(Global));
await TryDesperateDequeueAllCoinsAsync();
- Dispatcher.UIThread.Post(() =>
+ Dispatcher.UIThread.PostLogException(() =>
{
Application.Current.MainWindow.Close();
});

MODIFY
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
@@ -25,7 +25,7 @@ namespace WalletWasabi.Gui.Tabs
this.WhenAnyValue(x => x.Network, x => x.TorHost, x => x.TorPort).Subscribe(x => Save());
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
await config.LoadFileAsync();
@@ -86,7 +86,7 @@ namespace WalletWasabi.Gui.Tabs
var config = new Config(Global.Config.FilePath);
- Dispatcher.UIThread.Post(async () =>
+ Dispatcher.UIThread.PostLogException(async () =>
{
await config.LoadFileAsync();

MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -178,7 +178,7 @@ namespace WalletWasabi.Gui.ViewModels
() =>
{
Interlocked.Exchange(ref _backendIncompatible, 1);
- Dispatcher.UIThread.Post(() =>
+ Dispatcher.UIThread.PostLogException(() =>
{
SetStatusAndDoUpdateActions();
});
@@ -187,7 +187,7 @@ namespace WalletWasabi.Gui.ViewModels
() =>
{
Interlocked.Exchange(ref _clientOutOfDate, 1);
- Dispatcher.UIThread.Post(() =>
+ Dispatcher.UIThread.PostLogException(() =>
{
SetStatusAndDoUpdateActions();
});

catch exceptions on UI thread tasks