Sometime its working fine, but some getting this unknown exception
Object reference not set to an instance of an object. System.Collections.ListDictionaryInternal at BusinessClass.videosInsertRequest_ProgressChanged(IUploadProgress progress) at Google.Apis.Upload.ResumableUpload'1.d__84.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at...d__102.MoveNext() Object reference not set to an instance of an object. Void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress)
using (var fileStream = new FileStream(filePath, FileMode.Open))
{
const int KB = 0x400;
var minimumChunkSize = 256 * KB;
var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", fileStream, "video/*");
videosInsertRequest.ProgressChanged += videosInsertRequest_ProgressChanged;
videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived;
videosInsertRequest.ChunkSize = minimumChunkSize * 4;
//videosInsertRequest.Upload();
await videosInsertRequest.UploadAsync();
}
void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
{
switch (progress.Status)
{
case UploadStatus.Uploading:
//Console.WriteLine("{0} bytes sent.", progress.BytesSent);
break;
case UploadStatus.Failed:
BusinessClass objBusiness = new BusinessClass();
objBusiness.writeExceptionLog("videosInsertRequest_ProgressChanged", progress.Exception.InnerException.ToString());
//Console.WriteLine("An error prevented the upload from completing.\n{0}", progress.Exception);
break;
}
}
void videosInsertRequest_ResponseReceived(Video video)
{
getVideoID = video.Id;
//string getVideoID = video.Id;
//Console.WriteLine("Video id '{0}' was successfully uploaded.", video.Id);
}