VS2013: “VSP2340: Environment variables were not properly set” even when running from IDE

这一生的挚爱 提交于 2019-11-30 20:30:16

This may be related to administrative privileges. In my case, I know of two workarounds:

  1. Run Visual Studio as a user with real administrator privileges.
  2. Use the [Start -> Microsoft Visual Studio 2012 -> Visual Studio Tools -> ] Developer Command Prompt for VS2012 -> Run as administrator. In command prompt, vsperfclrenv /samplegclife. Window title changes from Administrator: Developer Command Prompt for VS2012 to Administrator: VSPerf Sampling Attaching and Allocation Profiling with objects lifetime 'ON'. Then "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe".

The second approach looks just what the original poster did, except that instead of an ordinary cmd.exe window, I used Run as administrator with the Developer Command Prompt. For me, when I do not run as administrator, I get the VSP2340 error.

I have been experiencing very similar symptoms with a slightly different environment: Windows 7, as a normal user (not in the local Administrators group), starting Visual Studio 2012 from the Start Menu, with Avecto Defendpoint to grant elevated privileges to the Visual Studio executable, CPU profiling produced normal results but .NET memory allocation sampling results were blank. Output window said:

Profiling started.
Profiling process ID #### (xxxx).
Process ID #### has exited.
Data written to C:\path\to\solution\xxxxyymmdd.vsp.
Profiling finished.
VSP2340: Environment variables were not properly set during profiling run and 
    managed symbols may not resolve. Please use vsperfclrenv before profiling.
Profiling complete.

For CPU profiling runs, instead of VSP2340, I get a long listing of Loaded symbols for [full/path/to/dll]

Have you tried to run a Visual Studio Command Prompt (as administrator) and run command vsperfclrenv / globalsampleon? After thad you may need to reboot.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!