Silverlight 4 101: Debugging WCF RIA Services

By default, he error messages that are generated from WCF RIA Services are less than useful. They are often generic messages that do little to help you understand the root of the problem.

Fortunately, there is a great tool, called Fiddler ( that provides solid, detailed information on your errors.

After downloading and installing Fiddler, do the following:

1. Open your Web project’s web.config file and look within the <system.serviceModel> node to make sure the following <serviceBehaviors> node exists beneath the <behaviors> element:

      <behavior name=“WCF_ReaderQuotaIssue.Web.ServiceBehavior”>
        <serviceMetadata httpGetEnabled=”true”/>
        <serviceDebug includeExceptionDetailInFaults=”true”/>
        <dataContractSerializer maxItemsInObjectGraph=”6553600″/>

2. Launch Fiddler. Select the menu option Tools | Fiddler Options. In the General tab unselect the Enable IPv6 check box, then click OK to save changes (you only have to do this the first time you run Fiddler)

3. Close Fiddler and reopen it again so it picks up the change you made in the previous step

4. Re-launch Fiddler

5. Run your Silverlight application. After the web page loads, go to your browser’s address bar and add a period after “localhost” and before the colon as shown here, then press Enter to reload the page:


6. Now peform the action that is causing the error in your application

7. After the error occurs, ALT+Tab over to Fiddler and select the error (usually displayed in red) on the left side of the dialog. Then, go to the right side of the dialog, and click the Inspectors tab at the top and the TextView tab at the bottom to display the detailed error text

Best Regards,
Kevin McNeish
INETA Speaker
Eight-Time Recipient .NET MVP
Chief Software Architect, MM .NET Application Framework

Getting your Silverlight Assemblies to Appear in the VS 2010 Add References Dialog

If you are creating custom Silverlight assemblies you want to reference from multiple projects, it’s great for those assemblies to appear in Visual Studio’s Add References dialog. It’s easy to do this, although I didn’t see documentation anywhere on how to do it.

All you need to do is add a key below the following Windows Registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Silverlight\v4.0\AssemblyFoldersEx

or for 64-bit Windows machines:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Silverlight\v4.0\AssemblyFoldersEx

Simply add a new key with a name that is descriptive of your assembly, then set the default value of the key to the folder that contains your .NET assembly.

For example, if your assembly is located in the folder C:\Acme\Silverlight controls, you could add a new registry key under the node listed above:

Acme Silverlight Controls – (Default)    REG_SZ   C:\Acme\Silverlight Controls

Best Regards,
Kevin McNeish
Eight-Time .NET MVP Recipient
INETA Speaker
Chief Architect, MM .NET Application Framework

Getting a project’s GUID

OK, this was much harder than it should have been. I was in the process of creating my own custom Silverlight project templates (I don’t consider the default template usable since it requires you to put your business entities in the host web project!).

Anyway, the host web project needs to get a reference to the Silverlight project–specifically the project’s GUID. Here are the steps you need to take to get this information:

  1. Install the Visual Studio 2010 SDK:
  2. Add these assemblies to your project:

    – Microsoft.VisualStudio.Shell.Interop
    – Microsoft.VisualStudio.OLE.Interop

  3. Now you can use the following code to retrieve a project’s GUID:


    Guid projectGuid= Guid.Empty;


    IVsHierarchy hierarchy;


    IServiceProvider serviceProvider = new ServiceProvider(project.DTE as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);


    IVsSolution solution = serviceProvider.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsSolution)) as IVsSolution;


    out hierarchy);


    if (hierarchy != null)
    out projectGuid);

Kevin McNeish
President, Oak Leaf Enterprises, Inc.
INETA Speaker
Eight-time recipient Microsoft .NET MVP Award
Chief Software Architect, MM .NET Application Framework