如何获得 Resharper 中止测试的原因? [英] How can I get reason of Resharper's aborted tests?

查看:49
本文介绍了如何获得 Resharper 中止测试的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Resharper 9.2 和 NUnit 2.6.4 以及 ~120 个单元测试.有时,当我开始运行测试时,resharper 会随机停止测试并将其状态设置为中止并跳过其他测试.这非常不方便,因为我手动运行了其余的测试.有什么方法可以获取流产的原因、一些重新锐化的测试运行日志或 NUnit 中的其他内容来帮助解决我的问题?

I'm using Resharper 9.2 and NUnit 2.6.4 and ~120 unit tests. Sometimes when I start run tests resharper stops at random test and set it status to Aborted and skip the others. It is very inconvenient because I have manually run rest of tests. Are there any ways to get reason of Abortion, some resharper test run logs or something in NUnit to help solve my problem?

我也尝试使用本机 NUnit 运行器,但它有时会抛出不包含任何有用信息的异常(一些远程处理异常,没有任何有用的信息)

I also tried to use native NUnit runner but it sometimes throws exception which doesn't contain any useful info (some remoting exception which tells nothing useful)

我尝试设置最多并行运行 1 个程序集"和对每个程序集使用单独的 AppDomain 进行测试",但没有帮助.

I've tried to set "Run up to 1 assemblies in parallel" and "Use separate AppDomain for each assembly with tests" but it doesn't help.

UPD

我在调试模式下复制了这个,调试单元测试刚刚关闭,在输出窗口中我发现:

I've reproduced this in debug mode, debug unit test just shut down and in output window I've found:

The program '[4572] JetBrains.ReSharper.TaskRunner.CLR4.exe: Program Trace' has exited with code 0 (0x0).
The program '[4572] JetBrains.ReSharper.TaskRunner.CLR4.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'.

问题似乎是外部库的不安全代码.

It seems that problem is external's library unsafe code.

推荐答案

在这种情况下,resharper 似乎无能为力.我有访问冲突错误,在这种情况下,测试程序进程将被关闭..net 中无法处理此错误,因为它不在托管级别.如果错误消息类似于:程序'[4572] JetBrains.ReSharper.TaskRunner.CLR4.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access违规'",当您的测试无故中止时.如果您有权访问本机代码,则可以进行调试.

It seems that resharper has nothing to do in this case. I've got Access Violation error and in this case tester process will be shut down. There is no way in .net to process this error because it is not on managed level. The only thing is to check in output window if error message is like: "The program '[4572] JetBrains.ReSharper.TaskRunner.CLR4.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'" when your tests are aborted for no reason. If you have access to native code you can debug.

就我而言,问题在于 COM 对象和 Dispose() 方法的使用不当.我已经修复了它,现在一切正常 - 没有无声"流产.

In my case the problem was in improper use of COM object and Dispose() method. I've fixed it and everything is ok now - no "silent" abortion.

这篇关于如何获得 Resharper 中止测试的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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