Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I think this is an easy one - I am using a DataServiceContext in a C# client application - if there is an exception, for example when calling SaveChanges, is there any function I can call client-side to get the details of the exception?

when using a WP7 client I noticed the debugger seems to show more info - for example 'Failed because Property X cannot be null',

Any ideas?

Thanks in advance!
Posted

1 solution

Hi All,

In case anyone has the same problem, decorate the service class with the following attribute:


[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]


For further info you can also add the following to the web.config file:

XML
<system.diagnostics>
  <sources>
    <source name="System.ServiceModel"
            switchValue="Information, ActivityTracing"


            propagateActivity="true">
      <listeners>
        <add name="traceListener"
            type="System.Diagnostics.XmlWriterTraceListener"
            initializeData= "c:\log\Traces.svclog" />
      </listeners>
    </source>
  </sources>
</system.diagnostics>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900