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

Exception: Start may not be called on a continuation task #118

Closed
JeremyBP opened this issue Jun 23, 2020 · 2 comments
Closed

Exception: Start may not be called on a continuation task #118

JeremyBP opened this issue Jun 23, 2020 · 2 comments

Comments

@JeremyBP
Copy link
Contributor

JeremyBP commented Jun 23, 2020

I'm getting this exception when using ExecutionAwareCommand.FromTask< MyObject >(MyMethod);
No problem with ExecutionAwareCommand.FromTask(MyMethod).
So I digged into the source code of the ExecutionAwareCommand< T > class and found a Start() call wich throws the exception.
Then, if I just remove the Start call like it is into the ExecutionAwareCommand, no more exception and task just runs like it should...
Any reason of this Start call that I miss?

@dansiegel
Copy link
Owner

can you provide a reproduction of the issue?

@JeremyBP
Copy link
Contributor Author

JeremyBP commented Jul 6, 2020

I started with the fresh latest master commit.
On the provided sample, I just added a button on the MainPage like so:

<Button Text="Command with param" Command="{Binding WithParamCommand}" CommandParameter="p1"/>

Then on the MainPageViewModel :

public ICommand WithParamCommand { get; }

private async Task WithParamAsync(string param)
{
// Whatever awaitable stuff here doesn't matter
}

and finally into the construtor:

WithParamCommand = ExecutionAwareCommand.FromTask<string>(WithParamAsync);

From there, clicking on the button throws the InvalidOperationException: Start may not be called on a continuation task.

If you remove the .Start(); call, then no more exception.

Maybe I'm doing something wrong or missing something.

dansiegel added a commit that referenced this issue Aug 10, 2020
Fix #118 Exception: Start may not be called on a continuation task
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

No branches or pull requests

2 participants