.NET command line dynamic profiler not capturing data

49 views Asked by At

I am using .NET framework 4.8 with Visual Studio 2019 (v16.11.11). I am attempting to use the dynamic instrumentation profiler on a C# executable (and loaded dll) launched from a wrapper script on the command line. Due to requirements of the full project, the exe under inspection cannot be launched directly by hand or through the VS GUI; it must be launched by our component launcher to provide the correct response upstream. After having set the environment variables as shown below, launching vsperfcmd.exe, and ProgramToInstrument.exe the generated .vsp file is of size 148 kb and produces the error "File contains on data buffers" when opened.

Based on the instructions contained in https://devblogs.microsoft.com/visualstudio/new-dynamic-instrumentation-profiling/#comment-24332. I have the following in a dynamicWrapper.bat file

set COR_ENABLE_PROFILING=1
set COR_PROFILER={324F817A-7420-4E6D-B3C1-143FBED6D855}
set CORECLR_ENABLE_PROFILING=1
set CORECLR_PROFILER={324F817A-7420-4E6D-B3C1-143FBED6D855}
set COR_PROFILER_PATH_32="C:\Program Files (x86)\Microsoft Visual set Studio\2019\Preview\Common7\IDE\CommonExtensions\Platform\InstrumentationEngine\x86\MicrosoftInstrumentationEngine_x86.dll"
set CORECLR_PROFILER_PATH_32="C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\CommonExtensions\Platform\InstrumentationEngine\x86\MicrosoftInstrumentationEngine_x86.dll"
set COR_PROFILER_PATH_64="C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\CommonExtensions\Platform\InstrumentationEngine\x64\MicrosoftInstrumentationEngine_x64.dll"
set CORECLR_PROFILER_PATH_64="C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\CommonExtensions\Platform\InstrumentationEngine\x64\MicrosoftInstrumentationEngine_x64.dll"
set MicrosoftInstrumentationEngine_ConfigPath32_PerfProfiler="C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\CommonExtensions\Platform\DiagnosticsHub\x86\PerfProfiler.config"
set MicrosoftInstrumentationEngine_ConfigPath64_PerfProfiler="C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\CommonExtensions\Platform\DiagnosticsHub\amd64\PerfProfiler.config"
set VSPERF_MODULES=ProgramToInstrument.exe; ModuleToInstrument.dll;
set VSPERF_EXCLUDE_SMALL_FUNCTIONS=1

call vsperfcmd.exe /start:trace /output:profileData.vsp
call ProgramToInstrument.exe
call vsperfcmd.exe /shutdown

As stated above, vsperfcmd.exe launches correctly without path errors and creates profileData.vsp. The issue is that the COR profiler did not detect/connect to my exe and generate instrumentation data.

I cannot find any Microsoft documentation on the command line use of dynamic instrumentation. I am aware of and have tried the older static pre-instrumentation method documented at https://learn.microsoft.com/en-us/visualstudio/profiling/instrument-dotnet-framework-component-and-collect-timing-data?view=vs-2019. This yields the well known issues of requiring full pdb files and breaking strong signing.

0

There are 0 answers