Questions tagged [clr-profiling-api]

The Common Language Runtime (CLR) Profiling API is a set of native unmanaged interfaces useful for implementing .NET profilers. It primarily consists of the ICorProfilerCallback and ICorProfilerInfo interface families.

The Common Language Runtime (CLR) Profiling API is a set of native unmanaged interfaces useful for implementing .NET profilers.

The primary interfaces are:

  • ICorProfilerCallback - for receiving notifications regarding various events in the CLR, including Class Loading, Just-In-Time Compilation, and Garbage Collection.

  • ICorProfilerInfo- for querying information regarding the different application entities, such as objects, classes, functions, modules and assemblies.

For a complete reference, refer to Microsoft's official documentation:
Microsoft Unmanaged API Reference / Profiling Interfaces.

54 questions
1
vote
1 answer

In ClrProfiler, how to get managed object from ObjectID

I am building a .Net Profiler for some custom requirement where I need to capture the exception details even though it got handled properly in the code. To do so- I have implemented ICorProfilerCallback SetEventsMask for…
Hitesh
  • 1,067
  • 1
  • 10
  • 27
1
vote
0 answers

How to make two processes write on the same NamedPipe?

So, the profiler is written in c++ and is launched by the CLR automatically when the process to be profiled is launched. The process then launches another application (the main target of profiling). Profiler is launched for this process also. All…
Ali tariq
  • 11
  • 3
1
vote
1 answer

.NET Profiler enter/leave function hooks does not get called in case of exception

I am building a .Net Profiler for some custom requirement. I want to hook at Enter and Leave for some specific methods. To achieve this, I have tried below two approaches. IL Rewrite - I am able to inject the custom code at both the places. It is…
Hitesh
  • 1,067
  • 1
  • 10
  • 27
1
vote
1 answer

Why do plain, non-profile-optimized native images aren't loaded by my CLR profiler?

I'm developing a CLR profiler, using the CLR profiling interfaces, and having a hard time getting the CLR to load plain, non-profile-optimized native images (that were compiled with ngen.exe without the /profile option) when running my profiler (or…
valiano
  • 16,433
  • 7
  • 64
  • 79
1
vote
2 answers

Optimizing C++ call from C#

I am calling a two C++ function calls from C# my code is below. [DllImport("A.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "FuncA"), System.Security.SuppressUnmanagedCodeSecurity] public static extern void FuncA(UInt64…
Sel_va
  • 588
  • 5
  • 25
1
vote
1 answer

How to get unique method ID in .NET profiler (ICorProfilerCallback)?

I played with .NET profiling API (ICorProfilerCallback) and quickly discovered that FunctionID is not stable (it may be reused, see http://msdn.microsoft.com/en-us/library/bb384619.aspx). That's all fine. I came up with the idea to encode a method…
Nullptr Dev
  • 311
  • 2
  • 10
0
votes
0 answers

Why is the implementation of ICorProfilerCallback::Initialize( IUnknown*) returning success and SETEVENTMASK failing (segmentation fault)?

Building a Simple Profiler for .NET in the Linux Platform. I am using the Platform Adaptive Layer provided by microsoft to have the header files of the profiling apis(corprof.h) and the dependent Macros and dependencies. Using MSBUILD in Visual…
0
votes
0 answers

why full name of method on ilspy appear with slash?

I take the project Newtonsoft from git and compile it. When I open the assembly dll and I check some of the full method names (full method name mean return type of the method + namespace + class + method) I see that some of the full method names are…
Yanshof
  • 9,659
  • 21
  • 95
  • 195
0
votes
0 answers

How to query profiler instrumented IL code address using Windbg and SOS extension?

I have been debugging a .Net framework (4.8) CLR profiler codebase using Windbg and extension SOS. I am starting the target application debug binary through windbg and after the instrumentation has happened for a function (within assembly mscorlib)…
prasen_b
  • 1
  • 1
0
votes
0 answers

Can't start CLRprofiler on WSL on Windows 11, but it works on Windows 10

I have been using CLRProfiler on Linux (using WSL) on my Windows 10 machine. I got new machine with Windows 11, and I am trying to do same, meaning that I am using WSL (Ubuntu) and the same code for running the CLRProfiler, but it's not…
Yanshof
  • 9,659
  • 21
  • 95
  • 195
0
votes
1 answer

.NET Profiler - Filter out .Net Framework Functions

I've created a .NET Profiling DLL that implements the ICorProfilerCallback3 interface. I'm using the profiling to trace the functions called during Runtime, however, I'm looking to trace application specific functions, not the standard .NET…
CBaker
  • 830
  • 2
  • 10
  • 25
0
votes
1 answer

Parsing the COR_PRF_FUNCTION_ARGUMENT_INFO Structure

I'm wondering how I should go about parsing the COR_PRF_FUNCTION_ARGUMENT_INFO structure that is supplied to the callback method of the SetEnterLeaveFunctionHooks3WithInfo function. From my understand the structure contains a group of memory…
CBaker
  • 830
  • 2
  • 10
  • 25
0
votes
1 answer

.NET Profiler - Getting The Type Of A Function Parameter

I've implemented the .Net Profiler callback which allows me to get data about all the functions called in a .NET application. The function callback works great. Starting in the callback, I make a call to GetModuleMetaData(moduleId, ofRead,…
CBaker
  • 830
  • 2
  • 10
  • 25
0
votes
1 answer

How to get the value from the byte array object using ICorProfilerInfo2

I'm using ICorProfilerCallback2 interface to profiler my application. On function enter hook I'm trying to read the value from byte array which is passed as an argument to a function. I've the argument info COR_PRF_FUNCTION_ARGUMENT_INFO from which…
Zader
  • 67
  • 7
0
votes
1 answer

Which method I should track to know a new request comes into .net core application

I'm implementing profiler to track http requests coming to .net core applications hosted in IIS. I'm using coreclr profiling api to hook method enter/exit. Which method I should track to know a new http request coming into my application.