NUnit的在发布版本:"通用语言运行时检测到一个无效的程序" [英] nunit on release build: "Common Language Runtime detected an invalid program."

查看:373
本文介绍了NUnit的在发布版本:"通用语言运行时检测到一个无效的程序"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我我们的软件/ .NET 3.5升级从VS2008到VS2010 / .NET 4.0。所有第三方库(最相关的:NHibernate的2.1.2或3.0.0,2.5.2 NUnit的)仍然编译使用VS2008。当我运行单元测试我们的软件的调试版本,一切工作正常。在发布版本,NUnit的异常报告33 228的测试: System.InvalidProgramException:公共语言运行库检测到无效的程序它总是发生在相同的测试,这两个NUnit的。 -console和ReSharper的5.0测试运行。当我运行他们使用ReSharper的调试单元测试命令,通过了所有测试。这没有什么区别,我是否运行单独或批量测试。唯一的例外总是发生近NHibernate的查询电话,但我不能肯定地说,因为发布版本堆栈跟踪是有点稀疏。它不依赖于NHibernate的字节code发生器,出现城堡和李林甫同样的异常。有没有人有一个想法如何调试呢?

I upgraded our software from vs2008/.net 3.5 to vs2010/.net 4.0. All third party libraries (most relevant: nhibernate 2.1.2 or 3.0.0, nunit 2.5.2) are still compiled using vs2008. When I run the unit tests for the debug build of our software, everything works fine. On the release build, nunit reports exceptions on 33 of 228 tests: System.InvalidProgramException : Common Language Runtime detected an invalid program. It always happens on the same tests, for both nunit-console and the Resharper 5.0 test runner. When I run them using the Resharper "debug unit-tests" command, all tests pass. It makes no difference whether I run the tests individually or batched. The exception always happens near nhibernate query calls, but I can't say for sure since the release build stack trace is somewhat sparse. It does not depend on the nhibernate bytecode generator, the same exception appears for castle and linfu. Does anyone have an idea how to debug this?

编辑:删除Spring.NET对这个问题没有影响

Removing Spring.NET had no effect on this issue.

编辑:当我切换版本配置调试输出到的完全的而不是 PDB只有的和停用的优化code 的复选框,异常消失。这两个设置是必需的,如果我只能改变一个人的错误依然存在。然而,一组不同的测试失败,如果我只改变一个。所有的类库编译的任何CPU 的。

When I switch the release config debug output to full instead of pdb only and deactivate the optimize code checkbox, the exception disappears. Both settings are required, if I change only one of them the bug remains. However, a different set of tests fail if I only change one. All class libraries are compiled for Any CPU.

推荐答案

<一个href="http://www.outsystems.com/NetworkForums/ViewTopic.aspx?Topic=Common-Language-Runtime-detected-an-invalid-program" rel="nofollow">http://www.outsystems.com/NetworkForums/ViewTopic.aspx?Topic=Common-Language-Runtime-detected-an-invalid-program

这篇关于NUnit的在发布版本:&QUOT;通用语言运行时检测到一个无效的程序&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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