I am working on an application that need to do asynchronous tasks. I use two times the code given at http://msdn.microsoft.com/fr-fr/library/system.web.ui.page.executeregisteredasynctasks.aspx
I simply copy and paste it in my application. Unfortunately I have an error thrown on one time while the other one works perfectly.
The error is :
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 46:
Line 47: _taskprogress = "Asynchronous task completed."
Line 48: _dlgt.EndInvoke(ar)
Line 49:
Line 50: End Sub
Source File: clsFormAsync.vb Line: 48
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Samples.AspNet.VB.Controls.MyAsyncTask.OnEnd(IAsyncResult ar) in clsFormAsync.vb:48
System.Web.UI.PageAsyncTask.CompleteTask(Boolean timedOut, Boolean syncTimeoutCaller) +365
[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
System.Web.UI.Page.ExecuteRegisteredAsyncTasks() +11440805
ViewProtocols.btnRefreshForm_Click(Object sender, EventArgs e) in ViewProtocols.aspx.vb:98
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707
I really don't know how to get out of this error, help will be welcome.