Is the Callback supposed to be called on a different thread?
Using this code:
client.ExecuteAsync<List<IngredientDto>>(request, Response =>
{
textBox1.Text += Response.Data.Count;
});
I get a “InvalidOperationException”:
“The calling thread cannot access this object because a different thread owns it.”
Shouldn’t the callback be on the UI thread, or am I wrong?
Actually, if you look at source code, you’ll see
That leads to:
You can’t update ui objects from non-ui thread. In case of WPF you can use
DispatcherIn general case see syncronization context