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

AyncCommand throws on the UI-Thread #28

Open
bitbonk opened this issue Feb 14, 2020 · 0 comments · May be fixed by #29
Open

AyncCommand throws on the UI-Thread #28

bitbonk opened this issue Feb 14, 2020 · 0 comments · May be fixed by #29
Assignees

Comments

@bitbonk
Copy link

bitbonk commented Feb 14, 2020

The current version of the AsyncCommand rethrows any exception that occurs in the task run by the command.

In the following code

public AsyncCommandsDemoViewModel(IDataClient dataClient)
{
    this.CancelGetData = new CancelCommand();
    this.GetData = new AsyncCommand(
        this.CancelGetData.Wrap(
            async cancellationToken =>
                this.Data = await dataClient.GetDataAsync(cancellationToken)));
}

If the GetDataAsync throws any exception it will be propagated to the UI thread causing the application to crash.

bitbonk added a commit to bitbonk/Mvvm.Async that referenced this issue Feb 14, 2020
bitbonk added a commit to bitbonk/Mvvm.Async that referenced this issue Feb 14, 2020
@bitbonk bitbonk linked a pull request Feb 14, 2020 that will close this issue
@StephenCleary StephenCleary self-assigned this Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants