单元测试:Microsoft.Smartdevice.Connectivity.dll中发生未处理的“System.IO.FileNotFoundException”类型异常 [英] Unit Test: unhandled exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.Smartdevice.Connectivity.dll

查看:79
本文介绍了单元测试:Microsoft.Smartdevice.Connectivity.dll中发生未处理的“System.IO.FileNotFoundException”类型异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 测试自动化无法正常工作。


Visual Studio 2008专业版


目标应用程序是运行CF3的WINCE 6.0 R2。 5


仿真器(Pocket PC 2003仿真器)和真实目标显示相同的错误。


Setps:在智能设备项目中,选择了一个选择一个函数,然后右键单击"创建单元测试"。这为我构建了Shell应用程序。


在不添加任何测试代码的情况下,我单击"在当前上下文中调试测试"。按钮然后它给我测试结果窗口但总是失败与FileNotFound异常。 (输出显示在 描述的末尾) 


因为如果我选择目标作为主机或模拟器,我会得到相同的错误,我怀疑问题出在VS2008中。我错过了什么吗?是否为SmartDevice单元测试加载了正确的测试框架?


输出:



'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \assembly\GAC_32 \mscorlib \\\ 2.0.0.0__b77a5c5619340089 \ nc \\ ncorcorlib.dll'


'vstesthost.exe'(已管理):已加载'C:\Program Files \ Microsoft Visual Studio 9.0 \ Common7 \IDE \vstesthost.exe'


'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \assembly\GAC_MSIL \System.Runtime.Remoting \2.0.0.0__b77a5c561934e089 \ System.Runtime.Remoting.dll'


'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \assembly \ GAC_MSIL \System \2.0.0.0__b77a5c561934e089 \System.dll'


'vstesthost.exe'(已管理):已加载'C:\Program Files \ Microsoft Visual Studio 9.0 \ Common7 \IDE \ PrivateComponent = \\ Microsoft.VisualStudio.Qual ityTools.Common.dll'


'vstesthost.exe'(已管理):已加载'C:\Program Files \ Microsoft Visual Studio 9.0 \ Common7 \IDE \ Private`SeadersAssemblies \\ Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll'


'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \assembly \ GAC_MSIL \ Microsoft.VisualStudio。 QualityTools.Resource\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll'


'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \ assembly \ GAC_MSIL \ System.Configuration \2.0.0.0__b03f5f7f11d50a3a \ System.Configuration.dll'


'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll'


'vstesthost.exe'(已管理):已加载'C:\\ \\ Program Program \ Microsoft Visual Studio 9.0 \Common7 \IDE \ PrivatePitsAssemblies \ Microsof t.VisualStudio.QualityTools.ControllerObject.dll'


'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \assembly\GAC_32 \ System.Data \ 2.0.0.0__b77a5c561934e089\System.Data.dll'


'vstesthost.exe'(已管理):已加载'C:\Program Files \ Microsoft Visual Studio 9.0 \ Common7 \\ \ n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ System.Web \2.0.0.0__b03f5f7f11d50a3a \ System.Web.dll'


'vstesthost.exe'(已管理):已加载'C:\Program Files \ Microsoft Visual Studio 9.0 \Common7 \IDE \ Private_Assemblies; \\ Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll'


'vstesthost.exe'(已管理):已加载' C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\9.0.0.0__b 03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll'


'vstesthost.exe'(已管理):已加载'C:\Program Files \ Microsoft Visual Studio 9.0 \ Common7 \IDE\PrivateAssemblies\Microsoft.VisualStudio.SmartDevice.TestHostAdapter.dll'


线程'< No Name>'(0x924)已退出,代码为0(0x0)。


'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \assembly \ GAC_MSIL \ Microsoft.Smartdevice.Connectivity \9.0.0.0__b03f5f7f11d50a3a \ Microsoft。 Smartdevice.Connectivity.dll'


'vstesthost.exe'(已管理):已加载'C:\ WINDOWS \assembly\GAC_MSIL \ MicroCrosual.VisualStudio.DeviceConnectivity.Interop.9.0 \9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.DeviceConnectivity.Interop.9.0.dll'


Microsoft.Smartdevice中出现"System.IO.FileNotFoundException"类型的第一次机会异常。 Connectivity.dll


A Microsoft.Smartdevice.Connectivity.dll中出现'System.IO.FileNotFoundException'类型的第一次机会异常


Microsoft.Smartdevice中出现'System.IO.FileNotFoundException'类型的第一次机会异常.Connectivity.dll


Microsoft.Smartdevice.Connectivity.dll中发生未处理的"System.IO.FileNotFoundException"类型异常


其他信息:系统找不到指定的文件。


 


程序'[3616] vstesthost.exe:Managed'已退出,代码为-532459699 (0xe0434f4d)。



 


 


  ;

解决方案

如何将Microsoft.SmartDevice.Connectivity.Dll添加到VS2008中的单元测试环境?


要检查设备(CE计算机)上是否存在问题,我创建了一个小型项目,使用Connectivity API和
bingo ,如果我添加对项目的引用它连接正常。所以我确信唯一缺少的是将DLL加载到测试框架中。我在哪里可以添加引用?


 

 DatastoreManager dsmgrObj = new DatastoreManager(1033); 

ObjectId glomationID = new ObjectId(" 81551346-886F-43a2-B707-A91FAE1B33A7");
ObjectId ce06PlatObjID = new ObjectId(" E2BECB1F-8C8C-41ba-B736-9BE7D946A398");

平台ce60Plat = dsmgrObj.GetPlatform(ce06PlatObjID);
设备glomDev = ce60Plat.GetDevice(glomationID);

Console.WriteLine("\ n \ nnConnect to the device");
//连接到设备。
glomDev.Connect();
SystemInfo glomDevInfo = glomDev.GetSystemInfo();
System.Console.WriteLine(" Available Physical Memory \t:\t" + glomDevInfo.AvailPhys);

干杯,


Uri


 Test Automation not working.

Visual Studio 2008 Pro

The target application is a WINCE 6.0 R2 runing CF3.5

The Emulator (Pocket PC 2003 Emulator) and the real target show the same error.

Setps: On the smart device project, selected a class, selected a function and Right click "Create Unit Test". This builds for me the Shell aplication.

Without adding any test code, I click the "Debug Test In Current Context" button and then it gives me the Test results windows but always fails with the FileNotFound Exception. (Output shown at the end of the description) 

Because I get the same error if I select my target as the host or the Emulator, I suspect that the problem is in VS2008. Am I missing something? does it looks like the correct test framework is loaded for a SmartDevice Unit Test?

Output:

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'

'vstesthost.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\vstesthost.exe'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Remoting\2.0.0.0__b77a5c561934e089\System.Runtime.Remoting.dll'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'

'vstesthost.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.Common.dll'

'vstesthost.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll'

'vstesthost.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.ControllerObject.dll'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll'

'vstesthost.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.AgentObject.dll'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll'

'vstesthost.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll'

'vstesthost.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.SmartDevice.TestHostAdapter.dll'

The thread '<No Name>' (0x924) has exited with code 0 (0x0).

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Smartdevice.Connectivity\9.0.0.0__b03f5f7f11d50a3a\Microsoft.Smartdevice.Connectivity.dll'

'vstesthost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.DeviceConnectivity.Interop.9.0\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.DeviceConnectivity.Interop.9.0.dll'

A first chance exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.Smartdevice.Connectivity.dll

A first chance exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.Smartdevice.Connectivity.dll

A first chance exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.Smartdevice.Connectivity.dll

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.Smartdevice.Connectivity.dll

Additional information: The system cannot find the file specified.

 

The program '[3616] vstesthost.exe: Managed' has exited with code -532459699 (0xe0434f4d).

 

 

 

解决方案

How Do I add the Microsoft.SmartDevice.Connectivity.Dll to the Unit Test Enviroment in VS2008?

To check if the problem was on the device (CE machine) I created a samll project that connects using the Connectivity API and bingo, if I add the reference to the project it connects fine. So I am sure the onlything missing is to load the DLL into the test framework. Where can I add the reference?

 

   DatastoreManager dsmgrObj = new DatastoreManager(1033);

   ObjectId glomationID = new ObjectId("81551346-886F-43a2-B707-A91FAE1B33A7");
   ObjectId ce06PlatObjID = new ObjectId("E2BECB1F-8C8C-41ba-B736-9BE7D946A398");

   Platform ce60Plat = dsmgrObj.GetPlatform(ce06PlatObjID);
   Device glomDev = ce60Plat.GetDevice(glomationID);

   Console.WriteLine("\n\nConnect to the device");
   //Connect to the device.
   glomDev.Connect();
   SystemInfo glomDevInfo = glomDev.GetSystemInfo();
   System.Console.WriteLine("Available Physical Memory\t:\t" + glomDevInfo.AvailPhys);

Cheers,

Uri


这篇关于单元测试:Microsoft.Smartdevice.Connectivity.dll中发生未处理的“System.IO.FileNotFoundException”类型异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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