Relative Content

Tag Archive for c#async-awaitiprogress

Unable to catch exceptions thrown by inner functions

I used IProgress and Task to upload asynchronously and display the upload progress, supporting asynchronous cancellation.
Create the inner function UploadFileViaSftp and call it in the outer function via await Task.Run(() => UploadFileViaSftp(…)) . The outer function already has a catch block, but the OperationCanceledException error still occurs.