Mar 12

Getting exception error message in Silverlight

Posted in Silverlight WCF      Comments Off on Getting exception error message in Silverlight

One of the things I needed to do in a recent project is get the error message returned from a WCF service in a Silverlight user control. The MSDN docs have a nice article which explains the changes you need to perform in order to get the server generated exception in your SL app (basically, you need to change the status code from 500 to 200 so that SL can access the body of the returned message).

It won’t be long until you notice that there’s a bug in WCF and that you need to use the full assembly name (yes, the one which takes type, assembly, version, etc, etc) so that WCF is able to get the custom behavior extension element you’ve written. What I did find out (the hard way – ie, after several lost minutes trying to check the name of the service) is that it won’t work if you’re using a strongly typed or versioned assembly.

There’s an entry in connect which says that this will be fixed in .NET 4.0, but this is not really good enough if you’re still in .NET 3.5 land…