Tuesday, November 30, 2010

System.ServiceModel.FaultException`1 was unhandled by user code

System.ServiceModel.FaultException`1 was unhandled by user code


Handling WCF SOAP Fault exception in Silverlight:
http://msdn.microsoft.com/en-us/library/ee844556(VS.95).aspx

The above specified article helps us on handling WCF SOAP exceptions in Silverlight. In that article it is clearly specified that in order to consume the SOAP faults, we need to adopt either of the following options.

  • HTTP status code modification 
  • Using alternate client HTTP stack

Similarly the faults are of two types. 
  • Declared faults 
  • Undeclared faults

In one of my project, I was about to handle faults in Silverlight whose sole purpose is for debugging. To achieve that, among the above, I used HTTP status code modification with undeclared fault type.

Upon implementing the endpoint behavior extensions(as specified in the msdn article) , I was eager to view the exception in Silverlight but resulted in the exception "System.ServiceModel.FaultException`1 was unhandled by user code" at my client(Silverlight app).

After having searched a lot, I found out a solution in a blog. It simply advised to change the following debugging option in the visual studio environment.

Under the Tools> Options menu, uncheck the following: 
  • Enable the exception assistant
  • Enable Just My Code(Managed only)





REFERENCE

1 comment:

  1. http://connect.microsoft.com/VisualStudio/feedback/details/302017/wcf-misleading-exception-in-debugger-faultexception-was-unhandled-by-user-code

    ReplyDelete

Creative Commons License
This work by Tito is licensed under a Creative Commons Attribution 3.0 Unported License.