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

后端 未结 2 716
旧巷少年郎
旧巷少年郎 2021-01-05 14:20

I am profiling a C# program from Visual Studio 2013. I go to Analyze -> Performance and Diagnostics to start the wizard. It gives me a choice of profiling method. If I ch

相关标签:
2条回答
  • 2021-01-05 14:31

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

    0 讨论(0)
  • 2021-01-05 14:45

    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]

    0 讨论(0)
提交回复
热议问题