Microsoft (R) VS Standard Collector Exception

2024-12-11T15:34:15.3+00:00

According to the page [Measure application performance from the command line], I issued the following two commands in a command prompt on Windows 10 and Visual Studio 2022 installed:

    > cd "C:\Program Files\Microsoft Visual Studio\2022\Professional\Team Tools\DiagnosticsHub\Collector"
    > VSDiagnostics.exe start 1 /attach:28240 /loadConfig:AgentConfigs\CPUUsageLow.json

But I get the following error:

    Microsoft (R) VS Standard Collector
    
    The file exists. (Exception from HRESULT: 0x80070050)
       at DiagnosticsHub.StandardCollector.Host.Interop.IStandardCollectorService.CreateSession(SessionConfiguration& sessionConfig, IStandardCollectorClientDelegate clientDelegate)
       at Microsoft.DiagnosticsHub.StandardCollector.CollectorActions.Start(RuntimeOptions options, ICollectorHost collectorHost)
       at Microsoft.DiagnosticsHub.StandardCollector.Program.<Main>d__0.MoveNext()

The first time, the command succeeded, and I collected the data with the command:

    VSDiagnostics.exe stop 1 /output:C:\temp\VSDiagnostics.diagsession

The second time, I left it running longer, and because VSDiagnostics.exe stop took a lot of time, I pressed Ctrl-C and stopped it. Since then, I get the above error. I deleted C:\temp\VSDiagnostics.diagsession but the error persists. There is probably somewhere a temporary file, does somebody know where that could be?

Developer technologies | Visual Studio | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2024-12-12T03:31:25.4266667+00:00

    Hi @ΠΑΠΠΑΣ Ι. ΑΛΕΞΑΝΔΡΟΣ, 

    Welcome to Microsoft Q&A! 

    You need to first stop the running collection session. 

    You can run the following command line to stop the active collection session.

    VSDiagnostics.exe stop 1 /output:C:\temp\VSDiagnostics.diagsession 

    Then, running the command again:

    VSDiagnostics.exe start 1 /attach:28240 /loadConfig:AgentConfigs\CPUUsageLow.json 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.