veron-li / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Asp.Net - request.Upload(username, newVideo) - Object reference not set to an instance of an object #550

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
While upload video gets uploaded, however the code results in an exception.
Request timeout is set to 1 hour.

1. YouTubeRequest request = new YouTubeRequest(settings);
2. ((GDataRequestFactory)request.Service.RequestFactory).Timeout = 60 * 60 * 
1000;
3. // other code title
4. request.Upload(username, newVideo)

Video gets uploaded however line 2 returns following error (Code is running 
inside a new thread) : 
"Object reference not set to an instance of an object"

Target site: {Void upload()}

Call stack:

   at Controls_YouTube.upload() in c:\inetpub\wwwroot\ELO\Controls\YouTube.ascx.cs:line 73
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Line 73 is request.Upload(username, newVideo)

Original issue reported on code.google.com by vi...@e-lo.co on 22 Oct 2011 at 2:18

GoogleCodeExporter commented 8 years ago
Please use the ResumableUploader component to upload videos to YouTube.
The YouTubeUploader project in the Samples solution shows how this component 
can be used:

http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/You
TubeUploader/

BTW, you should also code defensively and check that 
request.Service.RequestFactory is not null and RequestFactory is actually an 
instance GDataRequestFactory before you perform the cast.

Original comment by ccherub...@google.com on 22 Oct 2011 at 2:28

GoogleCodeExporter commented 8 years ago
Thanks for instant reply, however both links are not working at all.

I will try to implement what you suggested in last line.

Original comment by vi...@e-lo.co on 22 Oct 2011 at 1:43

GoogleCodeExporter commented 8 years ago
I just checked the two links and they are not broken, what do you mean by not 
working at all?

Original comment by ccherub...@google.com on 22 Oct 2011 at 7:11

GoogleCodeExporter commented 8 years ago

Original comment by ccherub...@google.com on 15 Nov 2011 at 4:12