views:

27

answers:

1

Hi

I have a WCF service that is called by a Windows Mobile application running on a PDA. I've set up the server code to send WCF faults if there is a problem. This is the code that I think I am supposed to be using on the client:

try
{
    var data = myService.GetSomeData();
}
catch (FaultException<Service.CustomFault> fault)
{
    messagebox.show(fault.customMessage);
}

The problem is that "FaultException" can't be found. Is this part of the Compact Framework? Am I missing a reference? Has anyone else done this using the CF?

Update: I've been looking at the .Net namespaces and FaultException is in System.ServiceModel. I can see that it exists in the desktop version but it's not there in the Compact Framework. It has stuff like FaultCode and FaultReason but I don't know how they are used.

Cheers
Mark

+1  A: 

The FaultException class is not available in the Compact Framework. But good news is you can use the CFFaultException class instead.

Johann Blais
Thanks for the reply Johann. I read somewhere about the CFFaultException but I couldn't find how to use it. Anyway I had to keep going and ended up doing something like this at the server: throw new FaultException("Server Fault ID: " + id.ToString(), null);. The error contains an ID that I send to the client. This can be used to find the full error message in the server logs. Maybe I'll come back to the CFFaultException later...
Mark Evans