开发者

How to get a stack trace when exception handling in Windows Workflow 3.5?

I am trying to figure out how to access a stack trace when a Fault Handler is invoked in Windows Workflow 3.5. The fault handler is hooked up to the following function:

private void onGeneralFault(object sender, EventArgs e)

but I am having troub开发者_开发技巧le finding how to get to the exception that leads to this. The fault handlers container has a Fault object but that seems to be set to null when I step through the code in the debugger. Also, there is an individual "Fault" property in the workflow designer in Visual Studio for the individual fault handler, but this is greyed out, so I cannot set it.


I figured it out. These casts are not the prettiest thing, but this is what I ended up doing:

private void onGeneralFault(object sender, EventArgs e)
{
    CodeActivity thisActivity = (CodeActivity)sender;
    Exception exception = ((FaultHandlerActivity)thisActivity.Parent).Fault;
...

Any better solutions are welcome.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜