Does HyperDescriptor work when built in .NET 4?

后端 未结 1 522
情歌与酒
情歌与酒 2021-02-04 16:04

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 b

相关标签:
1条回答
  • 2021-02-04 16:45

    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.

    Go to HyperTypeDescriptionProvider.BuildDescriptor and replace:

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

    by:

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

    AllFlags is deprecated and only causes a warning, but asserting from a security transparent method isn't valid in .NET 4. See Security Changes in the .NET Framework 4 for more information.

    0 讨论(0)
提交回复
热议问题