简体   繁体   English

UWP应用程序的单元测试无法在Visual Studio 2015上运行

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

I have trouble running unit test on one of my machine, the test app just shut down after few seconds. 我在我的一台机器上运行单元测试时遇到问题,测试应用程序几秒后才关闭。 Here is the output show when debugging the test: 以下是调试测试时的输出显示:

Exception thrown at 0x7525D8A8 in UnitTestProject1.exe: Microsoft C++ exception: EETypeLoadException at memory location 0x0A17C5F0. UnitTestProject1.exe中的0x7525D8A8抛出异常:Microsoft C ++异常:内存位置0x0A17C5F0处的EETypeLoadException。

Exception thrown at 0x7525D8A8 in UnitTestProject1.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. UnitTestProject1.exe中的0x7525D8A8抛出异常:Microsoft C ++异常:[rethrow]在内存位置0x00000000。

Exception thrown at 0x7525D8A8 (KernelBase.dll) in UnitTestProject1.exe: 0x40080201: WinRT originate error (parameters: 0x8007274C, 0x000000B9, 0x0EE4F6AC). UnitTestProject1.exe中0x7525D8A8(KernelBase.dll)抛出异常:0x40080201:WinRT发起错误(参数:0x8007274C,0x000000B9,0x0EE4F6AC)。

Exception thrown: 'System.Exception' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的“System.Exception”

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. WinRT信息:连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接主机无法响应而建立连接失败。

Exception thrown: 'System.Net.Sockets.SocketException' in System.Private.ServiceModel.dll 抛出异常:System.Private.ServiceModel.dll中的“System.Net.Sockets.SocketException”

Exception thrown: 'System.Net.Sockets.SocketException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的“System.Net.Sockets.SocketException”

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in System.Private.ServiceModel.dll 抛出异常:System.Private.ServiceModel.dll中的“System.ServiceModel.EndpointNotFoundException”

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.ServiceModel.EndpointNotFoundException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的'System.ServiceModel.EndpointNotFoundException'

Exception thrown: 'System.Reflection.TargetInvocationException' in mscorlib.ni.dll 抛出异常:mscorlib.ni.dll中的“System.Reflection.TargetInvocationException”

Those exceptions is not related to my app at all, as my app dont need internet and the code in test method is not reached. 这些例外根本与我的应用程序无关,因为我的应用程序不需要互联网,并且未达到测试方法中的代码。 They are from the test framework. 它们来自测试框架。

The same solution run test fine on every other machine (same Windows 10 build). 相同的解决方案在每台其他计算机上运行测试(同样的Windows 10版本)。 I think the problem is that the system on troubled machine turn off some services required for unit testing. 我认为问题在于故障机器上的系统关闭了单元测试所需的一些服务。 I cant find any thing related anywhere. 我找不到任何相关的东西。 What should I do to fix that, I dont want to re-install Windows. 我该怎么做才能解决这个问题,我不想重新安装Windows。

Seems like the connection with the Test Emulator can't be established. 似乎无法建立与Test Emulator的连接。 When you build the TestApp make sure that you have set the Build configuration to Debug - Any CPU (not ARM) Also, you shouldn't run the test project by hitting F5 but run the tests from the TestExplorer. 构建TestApp时,请确保已将Build配置设置为Debug - 任何CPU(而不是ARM)此外,您不应通过按F5运行测试项目,而是从TestExplorer运行测试。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM