Bug in Enterprise Library

TNND,最近在用Enterprise Library的时候,需要自己实现他的IAuthorizationProvider接口,然后在用他的配置工具(EntLibConfig.exe)进行配置的时候,老是提示:

The type name XXX is not valid.

但是我看了几百遍,还是觉得应该实现方式没有什么问题。好在Enterprise Library带有源码,我直接把他配置工具的下面行注释掉:

// errors.Add(instance, name, SR.ExceptionTypeNotValid(typeName));

于是一切使用正常,说明确实没有问题。但心中总是不爽。

今天在网上翻,终于发现,果然是微软的一个bug….

The problem is that some of the configuration settings have the [TypeValidation] attribute, which will attempt to check that the assembly qualified name of the type is a valid type. Unfortunately, this is running in an App Domain which is rooted in the EntLibConfig.exe directory, and so will only be able to resolves types in assemblies in that directory, or in the GAC.

而且提供的暂时解决方案居然就是直接注释掉那一行,他还友情提醒,因为没有检测,自己注意类型不要弄错了- –

唉…郁闷- –

所以,如果确实不想改动源码,可以直接把生成的DLL,用生成后事件copy到EntLibConfig.exe目录下就行了。

《Bug in Enterprise Library》有13个想法

回复 卷毛 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据