Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless awaits that cause application crashes #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Nito.Mvvm.Async/AsyncCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public override async Task ExecuteAsync(object parameter)
await Execution.TaskCompleted;
OnCanExecuteChanged();
PropertyChanged?.Invoke(this, PropertyChangedEventArgsCache.Instance.Get("IsExecuting"));
await Execution.Task;
}

/// <summary>
Expand Down
9 changes: 1 addition & 8 deletions src/Nito.Mvvm.Async/CancelCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,7 @@ public Func<object, Task> Wrap(Func<object, CancellationToken, Task> executeAsyn
{
using (StartOperation())
{
try
{
await executeAsync(parameter, _context.Token);
}
catch (OperationCanceledException)
{
// We cannot use `when (ex.CancellationToken == cancellationToken)` on the catch block because the user delegate may be cancelled by a linked CancellationToken.
}
await executeAsync(parameter, _context.Token);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you accidentally included this code change in the wrong PR. This looks like a copy of the changes in #31, which are not relevant here

}
};
}
Expand Down
1 change: 0 additions & 1 deletion src/Nito.Mvvm.Async/CustomAsyncCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public override async Task ExecuteAsync(object parameter)
tcs.SetResult(null);
await Execution.TaskCompleted;
PropertyChanged?.Invoke(this, PropertyChangedEventArgsCache.Instance.Get("IsExecuting"));
await Execution.Task;
}

/// <summary>
Expand Down