mgoldin's blog

A blog about Profiler in Microsoft Visual Studio Team System 2005

Multiple profilers of managed code on the same machine. Why it is bad?

It may happen that when you try to attach Visual Studio profiler to a managed application, you get the following error:

Error VSP1336 : Could not attach to process ID:1234 MyProcess.exe. Wrong setting of COR_PROFILER environment variable in target process.  Please use VSPerfClrEnv.cmd to set environment variables correctly.

You follow the instructions precisely, use VSPerfClrEnv.cmd properly, and it doesn't help. What is wrong?

The next question I would ask you is: "Did you install other profiler on your machine?" If yes, try to uninstall it, reboot the machine and use VSPerfClrEnv.cmd again.

The issue here is that usage of .NET profiling services is bound to the COR_PROFILER environment variable, and each profiler sets it to its own value. Having more than one profiler in field may cause a conflict, where profilers "fight" with each other for the right to set this environment variable. If process is created having this varialbe set by a different profiler, Visual Studio profiler detects this and generates the above error.

 

Published Tuesday, July 26, 2005 7:05 PM by mgoldin

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Evgeny Goldin said:

So how about the above message will be changed to:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error VSP1336 : Could not attach to process ID:1234 MyProcess.exe. Wrong setting of COR_PROFILER environment variable in target process. Please use VSPerfClrEnv.cmd to set environment variables correctly or check there's no other profiler currently activated.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This should help
July 28, 2005 6:01 AM
 

Rob Caron's Blog - A Team System Nexus said:

Cleaning-out my “To Blog” file again…
Architects

Handling data in service oriented systemsEdward...
August 1, 2005 2:58 AM
 

Nice site said:

Very nice blog!
February 20, 2006 11:54 AM
 

IanWho's bLog said:

The profiler team has been crazy busy with getting Visual Studio Team System shipped and out the door,...
March 6, 2006 3:46 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker