WebClient Upload CancelAsync problem

DavidLambert.7023DavidLambert.7023 David LambertUSMember ✭✭

Hi,

So I'm trying to send a file like the following under OSX.

var webClient = new WebClient(); webClient.Credentials = session.SessionToken; var waitHandle = new ManualResetEvent(false); webClient.UploadFileCompleted += (sender, args) => waitHandle.Set(); cancellationToken.Register(webClient.CancelAsync, false); webClient.UploadFileAsync(new Uri(url), "PUT", filePath); waitHandle.WaitOne();

When I trigger cancellation on the cancellation token, CancelAsync is called but the upload goes on and the UploadfileCompleted is also not fired at cancellation.

Can anyone reproduce this as well?

Best regards,

David

Posts

  • DavidLambert.7023DavidLambert.7023 David Lambert USMember ✭✭

    What up?

  • AshokGelalAshokGelal Ashok Gelal USMember, Beta ✭✭

    Can anyone reproduce this as well?

    It'd be helpful if you can attach a sample project so that we can try, fix, and play with it.

  • DavidLambert.7023DavidLambert.7023 David Lambert USMember ✭✭

    I thought copying this code was quite easy already. Make your own cancellationToken and take away the credentials...

    Anyways I went around the problem. I'm sick of those Mono/MS.Net differences.

Sign In or Register to comment.