Integrate Third-Party Tools with dotCover
The JetBrains .NET tools (dotTrace, dotCover, and dotMemory) are based on a common profiler core. The core provides low-level profiling functionality like attaching to profiled processes, communication with the .NET runtime, collecting profiling data, and so on.
The profiler core provides a mechanism that lets third-party tools to integrate with JetBrains .NET tools. An example of such integration is Typemock Isolator running along with JetBrains dotTrace: Users not only test their code but also investigate performance problems.
Transparent integration concepts
When a JetBrains .NET tool profiles a process, it loads the profiler core into the profiled process. In case of transparent integration, profiling is initiated by a third-party tool. So, the third-party tool becomes responsible for loading the profiler core into the profiled process.
How to integrate your tool with dotCover
Before starting profiling, your tool must add the following values (32-bit and/or 64-bit) to the
CoverageProfiler(REG_SZ) – (Required) a class ID of the third-party profiler COM object.
CoverageProfiler_Path32(REG_SZ) – (Required) a full path to the x86 third-party profiler shared library.
CoverageProfiler_Path64(REG_SZ) – (Required for Windows x64/ARM64) a full path to the x64 third-party profiler shared library.
CoverageProfiler_PathArm64(REG_SZ) – (Required for Windows ARM64) a full path to the ARM64 third-party profiler shared library.
CoverageProfiler_RegistryFreeActivation(REG_DWORD) – (Optional)
0by default. Specify any number other than
0if you are going to skip step 2 (if you're not going to profile .NET Framework 2.0 - 4.5.2 processes).
(Required only if you're going to profile .NET Framework 2.0 - 4.5.2 processes) Register your tool as a COM object using the Win32 API or
regsvr32for x86 or x64 (ARM64 CPUs don't support .NET Framework 2.0 - 4.5.2).
To load the JetBrains profiler core into the profiled process, you should use the following data:
JETBRAINS_PROFILER_CORE_GUID– the profiler core GUID.
JETBRAINS_PROFILER_CORE_PATH_ARM64– the path to the profiler core .dll (x86, x64, and ARM64 correspondingly).
You must take the values of these variables from the following sources (search the sources exactly in the specified order until the required value is found):
<X>– an unsigned decimal process id.
<Y>– a hexadecimal process start time in 100-nanosecond intervals since 01-Jan-1601 (UTC).
Make sure your tool implements and keeps up to date the translation of the interfaces:
ICorProfilerInfo13. Note that the implementation of the
ICorProfilerInfo::QueryInterface()in your tool must return the same set of available interfaces as the CLR/CoreCLR it supports. For example, if CoreCLR supports only
ICorProfilerInfo10, then only these interfaces must be available to the JetBrains profiler core.