I am introduction the use of FaultException in to our WCF services.
To test this is I created the following function on the server:
public void ThrowException()
{
try
{
throw new ApplicationException("This is a test exception");
}
catch (ApplicationException ex)
{
throw new FaultException<ApplicationException>(ex, "Test reason");
}
}
Skipping ahead a step. If I run through this it works fine.
However if I use the debugger (VS2008), and allow the code to break in the catch block (by enabling break on exception, or by stepping in to it), my client generates a CommunicationException.
Investigating this I found this forum post: http://social.msdn.microsoft.com/forums/en-US/wcf/thread/d1ae669f-9a62-4628-86c1-c15ff4068843/
Question: Why am I seeing this behaviour, only when debugging (I assume others are not)? AND how can I avoid this behaviour?