chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I've spent 6 hours wondering why running a unit test within Visual Studio 2010 started failing. It appears to work OK when the setting host is configured to run in a 64 bit process on a 64 bit machine - but set it to force tests to run in a 32 bit process and the test fails.

The tests fail on VS2010. I have a simple unit test project with a single test that reads Assert.IsTrue(true);
I have VS2012 installed also, but not configured Typemock with it.

Visual Studio says "Test Run Error" and "Test Host Process exited unexpectedly" and "Failed to queue test run <blah>: Unable to start the agent process"

The event viewer logs:

AgentProcess cannot register with AgentService, make sure service is running.


(QTAgent32.exe, PID 5828, Thread 1) AgentProcess: could not register with agent service: System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.Uri.ParseScheme(String uriString, Flags& flags, UriParser& syntax)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Microsoft.VisualStudio.TestTools.Execution.ExecutionUtilities.GetChannelUri(IChannelReceiver receiver)
at Microsoft.VisualStudio.TestTools.Execution.AgentContext.AddAgentProcessChannelUri(IChannelReceiver receiver)
at Microsoft.VisualStudio.TestTools.Agent.AgentProcess.Run()


I configured Agent32.exe.config to log:



<system.diagnostics>
<switches>
<!-- You must use integral values for "value".
Use 0 for off, 1 for error, 2 for warn, 3 for info, and 4 for verbose. -->
<!-- <add name="EqtTraceLevel" value="2" /> -->
<add name="EqtTraceLevel" value="4" />
</switches>
</system.diagnostics>

<appSettings>
<add key="CreateTraceListener" value="yes"/>
</appSettings>



and then VSTTAgentProcess.log reports the following:



376, 1, 2012/10/24, 15:23:19.683, GMT00560QTAgent32.exe, DefaultListener removed
I, 7376, 1, 2012/10/24, 15:23:19.691, GMT00560QTAgent32.exe, Create trace listener in path: C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE FileName: VSTTAgentProcess.log
I, 7376, 1, 2012/10/24, 15:23:19.693, GMT00560QTAgent32.exe, AgentProcess: starting
V, 7376, 1, 2012/10/24, 15:23:19.885, GMT00560QTAgent32.exe, ExecutionUtilities.RegisterIpcClientServerChannel: Registering IPC channel on IPC port 'eqt-a3a97055-63d2-6030-9889-4dabb07454ff'
V, 7376, 1, 2012/10/24, 15:23:19.977, GMT00560QTAgent32.exe, ExecutionUtilities.RegisterIpcClientServerChannel: Successfully registered IPC channel on IPC port 'eqt-a3a97055-63d2-6030-9889-4dabb07454ff'
I, 7376, 1, 2012/10/24, 15:23:20.358, GMT00560QTAgent32.exe, AgentProcess: Connecting to ipc://eqt-113ff837-7a8d-bbfa-ae5b-ec4fa ... anager.rem
V, 7376, 1, 2012/10/24, 15:23:20.380, GMT00560QTAgent32.exe, AgentProcess: Calling GetAgentProcessProxy. Execution key: d1358a54-eee6-4108-90d8-0ae2c58092c5
E, 7376, 1, 2012/10/24, 15:23:20.744, GMT00560QTAgent32.exe, AgentProcess: could not register with agent service: System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.Uri.ParseScheme(String uriString, Flags& flags, UriParser& syntax)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Microsoft.VisualStudio.TestTools.Execution.ExecutionUtilities.GetChannelUri(IChannelReceiver receiver)
at Microsoft.VisualStudio.TestTools.Execution.AgentContext.AddAgentProcessChannelUri(IChannelReceiver receiver)
at Microsoft.VisualStudio.TestTools.Agent.AgentProcess.Run()
I, 7376, 1, 2012/10/24, 15:23:20.785, GMT00560QTAgent32.exe, AgentProcess: shutting down.
I, 7376, 1, 2012/10/24, 15:23:20.789, GMT00560QTAgent32.exe, AgentProcess: exiting


In the end I ran devenv.exe /safemode and by a process of elimination discovered that it was the Typemock Isolator add-in! I am running Typemock Isolator 6.1.2.


Our support agreement just expired. Is that conincidence? Does this add-in require a continual license to operate?
asked by AndyPUK (1.2k points)

3 Answers

0 votes
Hi Andrew,

I have seen this error before, I think it happens only to users who installed vs2012 (though not for all such users).

I am not sure, but it might be fixed in a newer version of isolator... We can check what is the latest release that coincides with your license and see if it is fixed there.

But for now -
You can fix this error by disabling typemock on the system.uri namespace. This is done by adding the line
Sytem.Uri
in the file blacklist.dat contained in typemock installation directory, or next to where TypeMock.dll is located.

Obviously, this will also mean that you can not fake classes in System.Uri
answered by yoel (1.9k points)
0 votes
Thank you. I do have VS2012 installed and am happy to confirm that adding the line

System.Uri

to the file blacklist.dat in the installation folder solved the problem. I did not need to restart VS2010, it solved the problem immediately.
Quick note: there is a typo in your response (a missing 's' in System.Uri). I copied it blindly and didn't spot the error! :-)

Once again, thanks for your help.
answered by AndyPUK (1.2k points)
0 votes
Hi,

Glad to read it worked out.
Sorry for the typo (:

Please feel free to contact us with any other issue in the future.
answered by NofarC (4k points)
...