I have a WCF Service that I'm accessing in Silverlight. The Silverlight application requires authentication (authentication happens through a call to the service.)
I've noticed that when the authenticated session times out and the user does something application-side that would make a call to the service, the application just hangs waiting for the service to respond. My service is designed to output an exception in these cases, however nothing on the Silverlight side is assigned, and instead an exception is thrown:
CommunicationException was unhandled by user code
The remote server returned an error: NotFound.
In my service methods, I check to see if the user is still authenticated, and if so I continue with the operation. If not, I assign a value to an out parameter (of type Exception). On the Silverlight side, I check to see if this exception is null, and otherwise take the appropriate action. When I execute, the out parameter is given the proper exception, but then Silverlight throws the above exception (in Reference.cs) before it even gets to the point where I can handle it...
Has anyone else seen this? Any suggestions?
Edit: It seems that having any kind of Exception, including inheriting and containing them, causes the above exception. The simplest way I've found to get around this is just by passing the exception information inside my own custom Exception object (which again, cannot include the System.Exception object)