I am throwing an exception in a Silverlight enabled service and catching it in my silverlight client. I have done everything as per the manual, but still getting what I think is unexpected behavior.
Code from Client
try { client.ThrowFaultExceptionCompleted += (s, args) => { DoCallback(args); }; client.ThrowFaultExceptionAsync(new ThrowFaultExceptionRequest()); } catch (FaultException<MyFaultException> myFex) { } catch (FaultException fex) { } Here is the code from the service
My Custom Fault Exception class
[DataContract] public class MyFaultException { private string _reason; private string _myExceptionStackTrace; [DataMember] public string Reason { get { return _reason; } set { _reason = value; } } [DataMember] public string MyExceptionStackTrace { get { return _myExceptionStackTrace; } set { _myExceptionStackTrace = value; } } } The bit of service side code that throws the fault exception. For testing purposes I am calling this method from the client.
[OperationContract] [FaultContract(typeof(MyFaultException))] public void ThrowFaultException() { MyFaultException mfex = new MyFaultException(); mfex.Reason = "No Reason!"; mfex.MyExceptionStackTrace = "Long stack trace here"; System.ServiceModel.Web.WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK; //throw new FaultException<MyFaultException>(mfex ,new FaultReason(new FaultReasonText("My Fault Reason Text here!")), new FaultCode("my fault code here")); throw new FaultException<MyFaultException>(mfex); } no matter if I throw the FaultException with a single param or those three params in the commented line I get an error in my Reference.cs file in the silverlight proxy class like the one below

and it doesnt ever go to either of the catch blocks.. Is this normal behavior? I have to now catch the error in the callback method DoCallback(args) and in that method check for (args.Error == null). Why doesnt the catch block get hit?
Thanks for your time...
throw new FaultException<MyFaultException>(mfex ,new FaultReason(...the exception message will be different. Try to do this and update your question with information about changes.