Wrap Handler and handlingInstanceID in a Property

Topics: Exception Handling Application Block
Oct 14, 2008 at 4:31 PM
Is there any way to populate the Exception.Data dictionary, or some other property with the handlingInstanceID that is generated?

I am using a wrap handler.  If I use the {handlingInstanceID} token in the exception message, it is displayed fine, but is there any way to also populate a property with this ID so that string parsing isn't necessary?

Oct 16, 2008 at 6:14 AM
Hi, I don't think you can retrieve the handlingInstanceID anywhere but from the generated exception message.  You can check out the source code,  it doesn't expose that guid in any property; it only uses that within the formatting of the exception message.
Oct 16, 2008 at 11:29 AM
Hi Lefty,

You could create your own version of the wrap handler to store the handling instance ID in the new exception, or create a custom handler that just stores the value in the current exception and configure it after the wrap handler in the list of handlers for your exception policy.

Oct 22, 2008 at 1:47 PM
Thanks for the ideas.  I'm going to let the GUID slide in the string message only for now... if it becomes a problem later, then I'll have to investigate these ideas to work around it.  Thanks.