问题
I am using Google Storage Client to upload the File.
However, it never uploads. Suddenly this throwing exception always-TaskCanceledException. Even the CancellationTokenSource never cancelled.
IProgress<IUploadProgress> UploadProgress = new Progress<IUploadProgress>(OnUploadProgress);
using (FileStream fileStream = File.OpenRead(localpath))
{
if (null != await StorageClient.UploadObjectAsync(bucketname, objectname, null, fileStream, null, CancellationTokenSource.Token, UploadProgress))
{
result = true;
}
}
private void OnUploadProgress(IUploadProgress googleProgress)
{
case Google.Apis.Upload.UploadStatus.Failed:
{
//always come inside this...
googleProgress.Exception is TaskCanceledException
}
break;
}
来源:https://stackoverflow.com/questions/55831013/storageclient-uploadobjectasync-periodically-throws-exception-taskwascancelled