I was trying to profile an application using VSDiagnostics.exe in command line. VS details: Microsoft Visual Studio Professional 2017 -v 15.9.14
Following is the command I used
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Team Tools\DiagnosticsHub\Collector\VSDiagnostics.exe" start 22 /launch:dir.bat /loadAgent:4EA90761-2248-496C-B854-3C0399A591A4;DiagnosticsHub.CpuAgent.dll
The above call failed with the following error message because dir.bat
file was not there.
Failed to launch process 'dir.bat'. The system cannot find the file specified
I created the dir.bat
file as follows
@echo off
dir
Then I re-ran the above command and it resulted in the following error
Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
at DiagnosticsHub.StandardCollector.Host.Interop.IStandardCollectorService.CreateSession(SessionConfiguration& sessionConfig, IStandardCollectorClientDelegate clientDelegate)
at Microsoft.DiagnosticsHub.StandardCollector.CollectorActions.Start(RuntimeOptions options)
at Microsoft.DiagnosticsHub.StandardCollector.Program.Main(String[] args)
If I use a session id other than 22 the command works fine.
But I want to find a way to stop the current session with is 22
When I try to stop the session with following command
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Team Tools\DiagnosticsHub\Collector\VSDiagnostics.exe" stop 22 /output:out
It throws the following exception
The collector session is in an unsupported state for the requested action (Stop).
at DiagnosticsHub.StandardCollector.Host.Interop.ICollectionSession.Stop()
at Microsoft.DiagnosticsHub.StandardCollector.CollectorActions.Stop(RuntimeOptions options)
at Microsoft.DiagnosticsHub.StandardCollector.Program.Main(String[] args)
The status of the session is "Created"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Team Tools\DiagnosticsHub\Collector\VSDiagnostics.exe" status 22
Microsoft (R) VS Standard Collector
Session 22: {1697e42f-003d-4f91-a845-6404cf289e84}
Created
So the question is how to stop a session in a "Created" status?
User contributions licensed under CC BY-SA 3.0