diff --git a/sources/Google.Solutions.IapDesktop.Application/Windows/WaitDialog.cs b/sources/Google.Solutions.IapDesktop.Application/Windows/WaitDialog.cs index 201e52402..0ea1bcb9f 100644 --- a/sources/Google.Solutions.IapDesktop.Application/Windows/WaitDialog.cs +++ b/sources/Google.Solutions.IapDesktop.Application/Windows/WaitDialog.cs @@ -21,7 +21,6 @@ using System; using System.Diagnostics; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -50,7 +49,18 @@ public WaitDialog( private void cancelButton_Click(object sender, EventArgs e) { - this.cancellationSource.Cancel(); + try + { + this.cancellationSource.Cancel(); + } + catch + { + // + // Canceallation may fail if the task has been completed + // or cancelled already. + // + } + Close(); }