Add exception handling.
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -395,16 +395,25 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
Observable.FromEventPattern<SmartCoin>(Global.WalletService.TransactionProcessor, nameof(Global.WalletService.TransactionProcessor.CoinReceived))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(coin =>
+ {
+ try
{
var newCoinVm = new CoinViewModel(this, coin.EventArgs);
newCoinVm.SubscribeEvents();
RootList.Add(newCoinVm);
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(ex);
+ }
})
.DisposeWith(Disposables);
Observable.FromEventPattern<SmartCoin>(Global.WalletService.TransactionProcessor, nameof(Global.WalletService.TransactionProcessor.CoinSpent))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(coin =>
+ {
+ try
{
CoinViewModel toRemove = RootList.Items.FirstOrDefault(cvm => cvm.Model == coin.EventArgs);
if (toRemove != default)
@@ -413,27 +422,46 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
RootList.Remove(toRemove);
toRemove.UnsubscribeEvents();
}
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(ex);
+ }
})
.DisposeWith(Disposables);
Observable.FromEventPattern<ReplaceTransactionReceivedEventArgs>(Global.WalletService.TransactionProcessor, nameof(Global.WalletService.TransactionProcessor.ReplaceTransactionReceived))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(args =>
+ {
+ try
{
var toRemove = args.EventArgs.DestroyedCoins;
RemoveCoins(RootList.Items.Where(cvm => toRemove.Any(sm => cvm.Model == sm)));
var toRestore = args.EventArgs.RestoredCoins;
AddCoins(toRestore);
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(ex);
+ }
})
.DisposeWith(Disposables);
Observable.FromEventPattern<DoubleSpendReceivedEventArgs>(Global.WalletService.TransactionProcessor, nameof(Global.WalletService.TransactionProcessor.DoubleSpendReceived))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(args =>
+ {
+ try
{
var toRemove = args.EventArgs.Remove;
RemoveCoins(RootList.Items.Where(cvm => toRemove.Any(sm => cvm.Model == sm)));
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(ex);
+ }
})
.DisposeWith(Disposables);

Add exception handling.