mercredi 24 juin 2015

Async web request: Unexpected cancellation

This is my snippet:

        using (HttpClient client = new HttpClient())
        {
            Task<HttpResponseMessage> task = client.GetAsync(<Some url>);
            task.ContinueWith(t =>
            {
                    if (t.IsCanceled)
                    {
                        // always true
                        return;
                    }

            });
        }

What I don't undersatnd is why cancellation is always fired whatever the url I am using. Of course the target is not invoked.

What is wrong?




Aucun commentaire:

Enregistrer un commentaire