Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Exception in calling service during application_exit
1 replies. Latest Post by jackbond on May 9, 2008.
(0)
codism
Member
372 points
121 Posts
05-08-2008 3:32 PM |
Hi, I am calling a WCF method to save user's change in the current "page" in Application_Exit method. An exception occurs:
An exception of type 'System.NullReferenceException' occurred in System.ServiceModel.dll but was not handled in user codeAdditional information: Object reference not set to an instance of an object.
inside the "Reference.cs":
System.IAsyncResult _result = base.BeginInvoke("SaveClientList", _args, callback, asyncState);
I have a simple navigation framework in my application and the current "page" does no difference between navigation to another page and closing of the IE window. The exception appears to me like the asynchronous call needs some object that was released due to the closing of IE window. Can any one confirm me if this is a bug in Silverlight or I did something wrong?
Thanks in advance.
jackbond
Contributor
2820 points
725 Posts
05-09-2008 4:01 PM |
As web service calls are all async now, there's no clean way to specify, "don't close until this service call has completed". Your options are:
Use the XmlHttpWrapper to make the call sync (doesn't work on older browsers that do not support xmlhttp)
Try putting the thread to sleep for x amount of time (Truly ugly, and just how long should x be?)