FaultContractExceptionHandler doesn't supply HandlingInstanceId via mappings [solved]

Topics: Exception Handling Application Block, Logging Application Block
Oct 23, 2010 at 10:13 AM

My FaultContractExceptionHandler is nearly working.  I've set up some mappings and all bar one work fine: I'm not getting the HandlingInstanceId.

The CHM file page Shielding Exceptions at WCF Service Boundaries says "You can also specify a Source value of {HandlingInstanceId} to add the current handling instance ID to a Fault Contract property."  The MSDN version Shielding Exceptions at WCF Service Boundaries says "You can also specify a Source of "{Guid}" to add the current Handling Instance ID to the Fault Contract property."  I presume the MSDN one is more up to date but I've tried both and neither works for me.

Here's an extract from my config:

<mappings>
  <add source="{HandlingInstanceId}" name="HandlingId" />
  <add source="TankSpecification" name="Details" />
  <add source="Source" name="ProblemSource" />
  <add source="TankNumber" name="MessageID" />
  <add source="Data" name="Data" />
</mappings>

where HandlingId is a property on the service fault contract class I've created.  I know others have this working.  What am I missing?

Oct 24, 2010 at 7:18 AM
Edited Oct 24, 2010 at 7:56 AM

How a good night's sleep can help.  I took one look at the code this morning and realised that I was expecting a string and should probably be expecting a Guid.  So, I changed that part of service fault to look like this

    [DataMember]
    public Guid HandlingInstanceId { get; set; }

and with

    <add source="{Guid}" name="HandlingId" />

it worked.  I'll just shuffle off to the left, looking a bit sheepish.

Baa!