本文介绍了为什么我的测试与System.Security.VerificationException失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在移植我的项目从VS2008到VS2010的一个过程。现在,我转换我的所有项目的解决方案,以.NET 4.0(客户端配置文件),当我运行测试,几乎所有的测试失败,出现以下异常:

I'm in the process of migrating one of my projects from VS2008 to VS2010. Now that I converted all of my projects in the solution to .NET 4.0 (Client Profile) when I run the test harness, almost all tests fail with the following exception:

System.Security.VerificationException:  操作可能动摇  运行时。

我一直无法确定为什么这种异常发生。测试运行所有罚款当我在调试模式下运行它们。

I've been unable to determine why this exception occurs. The tests run all fine when I run them in debug mode.

整个解决方案可供下载这里

The entire solution is available for download here.

任何人都可以点我朝着正确的方向?

Can anyone point me in the right direction?

推荐答案

这个问题似乎是与您激活code覆盖。禁用code覆盖解决了这个问题。你可以把你的AssemblyInfo.cs以下内容:

The problem seems to be related to the Code Coverage you activated. Disabling code coverage solves the issue. You could put the following in your AssemblyInfo.cs:

[assembly: SecurityRules(SecurityRuleSet.Level1, SkipVerificationInFullTrust = true)]

和激活code覆盖。

这篇关于为什么我的测试与System.Security.VerificationException失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 17:50