处理Biztalk中不会被Scope形状捕获的异常 [英] Handling Exceptions in Biztalk which don't get caught by Scope shape

查看:46
本文介绍了处理Biztalk中不会被Scope形状捕获的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们考虑一下编排.主要活动在具有2个关联的Catch Exception形状的作用域形状内进行:1个代表System.Exception,另外1个代表通用异常.该业务流程利用辅助" C#类库,并且BizTalk范围/捕获捕获库中引发的异常以及其中发生的未处理异常.

我想知道的我能创建的问题是:说一个帮助程序库的版本被发布,突然之间以前缺少一个方法,业务流程尝试调用它.不可避免地会抛出 MissingMethodException ,这似乎会在达到Scope形状后立即发生.

业务流程未捕获 MissingMethodException ,因此消息被挂起.我意识到通过适当的测试这是永远不会发生的,但是我只是想涵盖所有可能发生的基础(实际上只是出于好奇).

是否有办法捕获这些异常,或者因为它似乎发生在调用作用域之前的某个级别?

解决方案

我知道了.我不得不包装包含形状的整个范围,同时在另一个范围中利用我的帮助程序库.看来,到达作用域后,.dll(用于帮助程序类库)必须已经被加载和评估.

如果您查看附件中的图像,我的帮助程序库将用于"ValidateWrapper"表达式形状,但是在调用 MissingMethodException 之前,业务流程甚至还没有实现(由于助手类库中缺少的方法),"GeneralScope"形状无法捕获 MissingMethodException ,但是只要将GeneralScope包装在另一个范围中, MissingMethodException 被那个抓住了并且可以处理.

这一切都是因为我通过BizTalk管理控制台更新了助手类资源,因此编译器无法警告缺少的方法...但是至少现在我知道如果再次发生该异常,我可以捕获该异常./p>

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.

这篇关于处理Biztalk中不会被Scope形状捕获的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆