mgoldin's blog

A blog about Profiler in Microsoft Visual Studio.

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

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

Rate This
  • Comments 4

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.

 

Comments
  • 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
  • Cleaning-out my “To Blog” file again…
    Architects

    Handling data in service oriented systemsEdward...
  • The profiler team has been crazy busy with getting Visual Studio Team System shipped and out the door,...
  • this is how we do it in detail

    blogs.msdn.com/.../performance-testing-wcf-web-services-using-vsts-unit-tests.aspx

Page 1 of 1 (4 items)
Leave a Comment
  • Please add 2 and 2 and type the answer here:
  • Post