Let's think about an orchestration. The main activities takes place within a scope shape with 2 associated Catch Exception shapes: 1 for System.Exception and 1 General Exception. This orchestration makes use of a "helper" C# class library and the BizTalk scope/catch catches exceptions that are thrown within the library, as well as unhandled exceptions that occur within them.

The issue that I'm wondering about that I'm able to create is this: Say a version of the helper library gets published and suddenly there is a method missing that was previously there and the orchestration tries to call it. Inevitably a MissingMethodException is thrown, which seems to happen as soon as the Scope shape is reached.

The MissingMethodException is not caught by the orchestration and therefore the message is suspended. I realize that with proper testing this should never happen, but I'm just trying to cover all the bases should they happen (and really just out of curiosity).

Is there a way to catch these exceptions, or since it seems to happen at a level before the scope is called?

有帮助吗?

解决方案

I figured it out. I had to wrap the entire scope which contained shapes there were utilizing my helper libraries in another scope as well. It appears that the .dlls (for the helper class library) must have been getting loaded and evaluated as soon as the scope is reached.

If you look at the attached image, my helper libraries are used in the "ValidateWrapper" expression shape, but the orchestration wasn't even making it there before a MissingMethodException was being called (due to a missing method in the helper class library), the "GeneralScope" shape was not able to catch the MissingMethodException but as soon as I wrapped the GeneralScope in another scope, the MissingMethodException was caught by that and could be handled.

This all happened because I updated the helper class resource through BizTalk admin console so the compiler wasn't able to warn of the missing method...but at least now I know I can catch the exception should it happen again.

enter image description here

其他提示

You should know that exceptions in orchestrations within BizTalk are handled in a same way as in .NET: exceptions always inherit from the base class System.Exception.

Say for example you have a custom MissingMethodException (which inherits from System.Exception), then you can either catch MissingMethodException (to have any specific data) or System.Exception. Both will trigger the System.Exception exception handler if there is no specific MissingMethodException exception handler.

For more information, I would suggest reading http://www.codeproject.com/Articles/125470/Exception-Handling-for-C-Beginners

BizTalk orchestrations are no different than any other exceptions in .NET for that part.

Hope this helps.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top