views:

198

answers:

2

Hi,

I am having an issue when starting the tests under debug mode in Visual Studio 2008 Team Test where it gives the following error:

"Failed to queue test run '{user@machinename}': Object reference not set to an instance of an object."

I googled for the error but no joy. Don't even understand what it means as it is too brief. Has anyone come across this?

Note that I can run tests fine if I am not debugging and I get the same error irrespective of the test I run.

Thank you,

Swati

ETA:

Being new to Visual Studio Team Test, I didn't know there was a better exception log then what I was seeing. Anyhow, here it is:

<Exception>
System.NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.
ShowToolWindow [T](T&amp; toolWindow, String errorMessage, Boolean show)

at Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.
OpenTestResultsToolWindow()

at Microsoft.VisualStudio.TestTools.TestCaseManagement.SolutionIntegrationManager.
DebugTarget(DebugInfo debugInfo, Boolean prepareEnvironment)

at Microsoft.VisualStudio.TestTools.TestManagement.DebugProcessLauncher.Launch(
String  exeFileName, String args, String workingDir, 
EventHandler processExitedHandler, Process&amp; process)

at Microsoft.VisualStudio.TestTools.TestManagement.LocalControllerProxy.StartProcess(
TestRun run)

at Microsoft.VisualStudio.TestTools.TestManagement.LocalControllerProxy.RestartProcess(
TestRun run)

at Microsoft.VisualStudio.TestTools.TestManagement.LocalControllerProxy.PrepareProcess(
TestRun run)

at Microsoft.VisualStudio.TestTools.TestManagement.LocalControllerProxy.
InitializeController(TestRun run)

at Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.QueueTestRunWorker(
Object state)
</Exception>
A: 

This is a long shot, but I had a similar error message and it turned out that my Unit tests were set to target "x86" in configuration manager.

Once I changed it to target "Any CPU" it all worked fine.

You might consider looking at what your Unit Test Project is set to target.

Vaccano
+1  A: 

You may be running into a (little) known bug caused by lower case characters in the computer name when using the VS 2008 test engine; see here for some info on it. It took us weeks to figure it out on one of my projects, and it still isn't easily found in documentation anywhere that I can find.

The problem is in the VS test engine and occurs if the computer name contains any lower-case letters. The test engine converts the computer name to all upper case letters when running, which causes an internal string comparison to fail and leads to similar error messages to what you are describing.

You may or may not be having the same problem, but if your computer name has any lower case letters, try changing the name to an all upper case version and then see what happens....

Ken Taylor