Home > English > WCF Services and System.Type

WCF Services and System.Type

This is going to be a very short post on something that took much too long to debug.  I have been working on a dynamic framework for Dashboarding in Silverlight.  Silverlight, currently, does not support DataSet or DataTable objects.  So, I decided that I wanted to mimic basically what the rest of the .NET world had access to in Silverlight.  It turns out that one of the property in the DataColumn class exposes a DataType property of System.Type.   This was a very nasty problem because if I debugged the WCF Service on the server, everything worked fine but as soon as I tried to return the service to the client…everything went wrong and the browser blurted out the wise and sagacious message “Server not found!”.  Now this is not very helpful but it turns out a very good friend of mine had a suggestion of trying to serialize my result in my service method before actually returning it.  This, basically, gave me the opportunity to see what was happening black box from WCF.  Viola!  The culprit was my friendly System.Type public property.  WCF does not allow serialization of this type and I had to serialize the name of the type and the create the type on the client in order for my DataTable implementation to work.

The simple solutions is a washout compared to the length of time I spent trying to troubleshoot the browser messages I was getting.  So, if you see a funny error and you know that the code is working correctly on the server…chances are that you have a serialization error or a size limit being met if it is a big object graph.

Advertisements
Categories: English Tags: ,
  1. shoeb
    September 30, 2011 at 6:28 am

    i came across this situation today 🙂

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: