Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET CF UnitTesting with emulator - Test run error

Test run error:

The test adapter ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') required to execute this test could not be loaded. Check that the test adapter is installed properly. Error: Smart device host adapter failed to initialize.

Actual situation: Known issue "Exceptions in unit tests in secondary threads kills vstesthost"

has been solved with adding to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VSTestHost.exe.config

the following line:

Microsoft.VisualStudio.SmartDevice.UnitTestFramework.dll has been added to GAC:

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" -i "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.SmartDevice.UnitTestFramework.dll"

But I still receive error message and can not run unit tests on emulator.

Or may be this is still unresolved issue of Visual Studio 2008 and I should try another tools/possibilities?

enter image description here

System.IO.FileNotFoundException was unhandled

System can not find file

Source="Device Connection Manager" StackTrace: at Microsoft.VisualStudio.DeviceConnectivity.Interop.ConManServerClass.DownloadPackage(String pwszPackageId) at Microsoft.SmartDevice.Connectivity.FileDeployer.DownloadPackage(ObjectId packageId) at Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.RunConfigDevice.InitializeStreamingWithDevice() at Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.DeviceHostAdapter.initializeInternal() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

http://img688.imageshack.us/img688/2025/20120808testrunerrorexc.gif

like image 201
hellboy Avatar asked Nov 04 '22 18:11

hellboy


1 Answers

I found an answer here: http://social.msdn.microsoft.com/Forums/en/vssmartdevicesvbcs/thread/72fbc539-cf28-4643-b7bf-2ced70018d2e

Maybe not the most elegant solution, but I just copied the SmartDevice.UnitTestFramework.dll with its xml config file from the VS 2008 public assemblies folder to VS 2010 public assemblies folder and it worked for me.

On my machine those folders are, for VS2008

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies

and for VS2010

 C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies

I got 2 error messages. Either vstesthost.exe crashes and in the detail gives this lines

vstesthost.exe
Microsoft.SmartDevice.Connectivity
System.IO.FileNotFoundException

Or the unit test framework throws this exception

"The system cannot find the file specified.\r\n"
"Device Connection Manager"
at Microsoft.VisualStudio.DeviceConnectivity.Interop.ConManServerClass.DownloadPackage(String pwszPackageId)
at Microsoft.SmartDevice.Connectivity.FileDeployer.DownloadPackage(ObjectId packageId)
at Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.RunConfigDevice.InitializeStreamingWithDevice()
at Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.DeviceHostAdapter.initializeInternal()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
like image 134
robor Avatar answered Nov 15 '22 12:11

robor