hellboy
hellboy

Reputation: 1618

.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

Upvotes: 5

Views: 1154

Answers (2)

robor
robor

Reputation: 3089

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()

Upvotes: 1

user153923
user153923

Reputation:

If you just installed the SDK for the mobile device, it may have installed a framework that has not been initialized. Try a reboot.

If you have multiple mobile SDKs installed (WM5, WM6.1, WM6.3.5, etc.), make sure your project is trying to launch the version you are targeting.

If all else fails, you could try uninstalling the emulator, reboot (because we love Windows), install again, reboot (because it is still Windows), then return to your project.

Upvotes: 1

Related Questions