You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ExecutionTask and IsRunning of the AsyncRelayCommand is only set after the execute returns a Task, so on the first real async function.
As long as it's running synchronously, the ExecutionTask is still the previous task and IsRunning is based on that one
Regression
No response
Steps to reproduce
Create an AsyncRelayCommand with an async function that returns a Task
relayCommand = AsyncRelayCommand(Execute);
Check if is IsRunning in the synchronous part of the execution method
async Task Execute()
{
Debug.Assert(relayCommand.IsRunnung); // Fails
Debug.Assert(relayCommand.AsyncRelayCommand == null); // at least not be the previous task?
await Task.Wait(1000);
}
Expected behavior
That AsyncRelayCommand is set to null and IsRunning is true before the execute method is called.
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
CommunityToolkit.Common
CommunityToolkit.Diagnostics
CommunityToolkit.HighPerformance
CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.2.0
Additional context
Ideally, you'd not call the IsRunning inside the Execute call, but I've done it by accident already that I run setup that I wanted to skip when a command is running, that is called from the Execute function before any network calls.
Workaround is just doing
await Task.Yield();
as the first line in the Execute method.
Help us help you
Yes, I'd like to be assigned to work on this item
The text was updated successfully, but these errors were encountered:
Describe the bug
The ExecutionTask and IsRunning of the AsyncRelayCommand is only set after the execute returns a Task, so on the first real async function.
As long as it's running synchronously, the ExecutionTask is still the previous task and IsRunning is based on that one
Regression
No response
Steps to reproduce
Expected behavior
That AsyncRelayCommand is set to null and IsRunning is true before the execute method is called.
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
Nuget package version(s)
8.2.0
Additional context
Ideally, you'd not call the IsRunning inside the Execute call, but I've done it by accident already that I run setup that I wanted to skip when a command is running, that is called from the Execute function before any network calls.
Workaround is just doing
as the first line in the Execute method.
Help us help you
Yes, I'd like to be assigned to work on this item
The text was updated successfully, but these errors were encountered: