Skip to content

AyncCommand throws on the UI-Thread #28

@bitbonk

Description

@bitbonk

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions