在安装Visual Studio 2015 SP1之后,VSTESTcode覆盖范围破裂 [英] VSTESTcode coverage broken after SP1 for Visual Studio 2015 installed

查看:169
本文介绍了在安装Visual Studio 2015 SP1之后,VSTESTcode覆盖范围破裂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这在安装SP1之前有效.

This worked before SP1 was installed.

namespace Test
{
    public class Adder
    {
        public int Add(int n1, int n2)
        {
            return n1 + n2;
        }    
    }
}

namespace AdderTest
{
    [TestFixture]
    public class Class1
    {
        [Test]
        public void AddTest1()
        {
            var add = new Adder();
            var res = add.Add(2, 3);
            Assert.AreEqual(5, res);
        }
    }
}

安装SP1后此命令仍然有效

This command still works after SP1 installed

vstest.console.exe/usevsixextensions:true/framework:framework45/platform:x86 AdderTest.dll

vstest.console.exe /usevsixextensions:true /framework:framework45 /platform:x86 AdderTest.dll

这不是,并且在我们团队中安装SP1的每台PC上都会失败.

This one doesn't and it fails on every PC in our team where SP1 is installed.

vstest.console.exe/enablecodecoverage/usevsixextensions:true/framework:framework45/platform:x86 AdderTest.dll

vstest.console.exe /enablecodecoverage /usevsixextensions:true /framework:framework45 /platform:x86 AdderTest.dll

错误:活动的测试运行被中止,因为执行过程意外退出.检查执行过程日志以获取更多信息.如果未启用日志,请启用日志,然后重试.

Error: The active Test Run was aborted because the execution process exited unexpectedly. Check the execution process logs for more information. If the logs are not enabled, then enable the logs and try again.

日志显示以下错误:

V,10664、11、2016/02/02、15:00:09.114、2115392201142,vstest.console.exe,TestRunRequest:SendTestRunMessage:正在启动.

V, 10664, 11, 2016/02/02, 15:00:09.114, 2115392201142, vstest.console.exe, TestRunRequest:SendTestRunMessage: Starting.

I,10664,11,2016/02/02,15:00:09.116,2115392205435,vstest.console.exe,TestRunRequest:SendTestRunMessage:已完成.

I, 10664, 11, 2016/02/02, 15:00:09.116, 2115392205435, vstest.console.exe, TestRunRequest:SendTestRunMessage: Completed.

E,10664、10、2016/02/02、15:00:23.722、2115441528953,vstest.console.exe,TAEF引擎执行:[HRESULT:0x800706BA]无法为进程外测试创建测试主机进程执行. (测试主机进程无法运行,退出代码为0xc0000005.无法建立与测试主机进程的通信.(连接尝试超时.)

E, 10664, 10, 2016/02/02, 15:00:23.722, 2115441528953, vstest.console.exe, TAEF Engine Execution: [HRESULT: 0x800706BA] Failed to create the test host process for out of process test execution. (The test host process failed to run with exit code 0xc0000005. Failed to set up communication with the test host process. (The connection attempt timed out.))

SP1似乎安装了所有新的vstest exe和DLL,尽管我正在使用Windows 7,但似乎也安装了TAEF内容

It appears SP1 installed all new vstest exe's and DLL's, also seemed to install the TAEF stuff, although I am using windows 7

使用NUnit 2.6& VS Nunit测试运行程序扩展 (也尝试过使用NUint 3.0的测试运行程序-仍然坏了)

Using NUnit 2.6 & the VS Nunit Test runner extension (also tried NUint 3.0 with it's test runner - still broke)

我们使用VSTEST是因为我们的代码是C ++/C#和64位组件的组合.我们需要团结和覆盖测试.

We are using VSTEST because our code is a combination of C++/C# and 64 bit components. We need unite and coverage tests.

更新:

使用VS 2105编写了一个智能测试-与运行coverage失败的方式相同.

Used VS 2105 to write an intellitest - that fails the same way running coverage.

推荐答案

这是VS 2015 Update 1中的回归.Wex.Communication.dll在初始化其全局变量时正在调用GetModuleFileNameExW.在Windows 7上,在收集代码覆盖率时,此API导致Wex.Communication.dll被卸载.当GetModuleFileNameExW返回时,由于DLL被卸载,进程崩溃了.我已修复此问题,直到DLL完全加载后才调用GetModuleFileNameExW,这可以防止崩溃. (我是一名在Microsoft的TAEF上工作的软件工程师.)此修复程序将在VS 2015的未来更新中发布.

This is a regression in VS 2015 Update 1. Wex.Communication.dll was calling GetModuleFileNameExW while its global variables were being initialized. On Windows 7 while collecting code coverage, this API caused Wex.Communication.dll to be unloaded. When GetModuleFileNameExW returned, the process crashed because the DLL was unloaded. I've fixed this to wait until after the DLL has fully loaded to call GetModuleFileNameExW, which prevents the crash. (I'm a Software Engineer who works on TAEF at Microsoft.) The fix will ship in a future VS 2015 update.

要解决此问题,请通过在HKEY_CURRENT_USER \ SOFTWARE \ Microsoft \ VisualStudio \ 14.0_Config \ FeatureFlags \ TestingTools \ UnitTesting \ Taef项中将名为"Value"的注册表值设置为0来禁用TAEF. (VSTest在VS 2015中有两个实现.禁用TAEF时,将使用VS 2013中的旧实现.基于TAEF的实现是VS 2015中的新增功能.)

To work around this, disable TAEF by setting the registry value named "Value" to 0 in the HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\FeatureFlags\TestingTools\UnitTesting\Taef key. (VSTest has two implementations in VS 2015. When TAEF is disabled, the old implementation from VS 2013 is used. The TAEF-based implementation is new in VS 2015.)

这篇关于在安装Visual Studio 2015 SP1之后,VSTESTcode覆盖范围破裂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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