难道当建于.NET 4 HyperDescriptor工作? [英] Does HyperDescriptor work when built in .NET 4?

查看:239
本文介绍了难道当建于.NET 4 HyperDescriptor工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个.NET 4项目,将能够从动态属性访问的的 HyperDescriptor 提供,但它似乎并没有正常工作时,内置的.NET 4我下载的来源从$ C $的CProject,转换解决方案的项目,VS2010,并更新了目标框架到4.0。而它建立,并将样品正确执行,将正时表明,与HyperDescriptor动态属性访问是获取/设置对象值的的最慢的可能方法。

I'm working on a .NET 4 project, and would be able to benefit from the dynamic property access that HyperDescriptor provides, but it doesn't seem to be working properly when built in .NET 4. I downloaded the source from CodeProject, converted the solution an projects to VS2010, and updated the target framework to 4.0. While it builds, and the sample executes correctly, the timings show that dynamic property access with HyperDescriptor is the slowest possible way of getting/setting object values.

这问题只有当你从源代码与.NET 4构建HyperDescriptor如果从你的.NET 4中的项目,您添加的引用HyperDescriptor构建与.NET 2,它工作正常。这是现在是一个可接受的解决方案,但会不会有一些潜在的优势,使用.NET 4的构建?任何人想利用裂缝HyperDescriptor,为什么这是一个.NET 4构建这么慢?

This problem is only when you build HyperDescriptor from source with .NET 4. If from your .NET 4 project, you add a reference to HyperDescriptor built with .NET 2, it works fine. This is an acceptable solution for now, but would there be some potential advantage to using a .NET 4 build? Anyone want to take a crack at HyperDescriptor, see why it's so slow with a .NET 4 build?

推荐答案

我下载的源$ C ​​$ c和运行测试与.NET 4有 InvalidOperationException异常的IM pressive数量抛出并捕捉,造成进展缓慢。

I downloaded the source code and ran the test with .NET 4. There's an impressive number of InvalidOperationException thrown and caught, causing the slowness.

HyperTypeDescriptionProvider.BuildDescriptor 并替换:

[ReflectionPermission(SecurityAction.Assert, Flags = ReflectionPermissionFlag.AllFlags)]

是:

[SecuritySafeCritical]
[ReflectionPermission(SecurityAction.Assert, Unrestricted = true)]

AllFlags是德precated,仅会导致发出警告,但是从安全透明的方法主张是无效的.NET 4.看的安全性更改在.NET Framework 4 了解详情。

这篇关于难道当建于.NET 4 HyperDescriptor工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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