UWP 应用的单元测试在 Visual Studio 2015 年 运行 失败

Unit test for UWP app failed to run on Visual Studio 2015

我在我的一台机器上进行单元测试时遇到问题 运行,测试应用程序在几秒钟后就关闭了。这是调试测试时的输出显示:

Exception thrown at 0x7525D8A8 in UnitTestProject1.exe: Microsoft C++ exception: EETypeLoadException at memory location 0x0A17C5F0.

Exception thrown at 0x7525D8A8 in UnitTestProject1.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

Exception thrown at 0x7525D8A8 (KernelBase.dll) in UnitTestProject1.exe: 0x40080201: WinRT originate error (parameters: 0x8007274C, 0x000000B9, 0x0EE4F6AC).

Exception thrown: 'System.Exception' in mscorlib.ni.dll

WinRT information: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Exception thrown: 'System.Net.Sockets.SocketException' in System.Private.ServiceModel.dll

Exception thrown: 'System.Net.Sockets.SocketException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in System.Private.ServiceModel.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll

Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.ni.dll

这些异常与我的应用程序完全无关,因为我的应用程序不需要互联网并且未达到测试方法中的代码。它们来自测试框架。

相同的解决方案 运行 在所有其他机器上测试都很好(相同的 Windows 10 版本)。我认为问题是有问题的机器上的系统关闭了单元测试所需的一些服务。我在任何地方都找不到任何相关的东西。我应该怎么做才能解决这个问题,我不想重新安装 Windows。

似乎无法与测试模拟器建立连接。构建 TestApp 时,请确保已将构建配置设置为调试 - 任何 CPU(不是 ARM) 此外,您不应该通过按 F5 运行 测试项目,而应该 运行 来自 TestExplorer 的测试。

我最终重新安装了 VS 2015,现在问题消失了。