55 questions
1
vote
1
answer
63
views
Get assembly names using dotnet profiling api
I'm using .NET profiling api to instrument my .NETCore application running on Linux. I need to find all the assemblies loaded in my application.
I've enabled the flag COR_PRF_MONITOR_ASSEMBLY_LOADS to ...
0
votes
1
answer
182
views
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 + ...
0
votes
0
answers
74
views
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 ...
0
votes
1
answer
267
views
.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 ...
2
votes
1
answer
347
views
IMetaDataEmit::DefineUserString returns HRESULT: -2147024882 (0x8007000E E_OUTOFMEMORY)
I'm playing around with the unmanaged Profiling interfaces for the CLR.
When running with a netcoreapp3.1 or net5.0 console application, in ICorProfilerCallback::JITCompilationStarted or in ...
0
votes
1
answer
271
views
.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 ...
1
vote
1
answer
90
views
Can we invoke a method from a class using IMetaDataImport2 in CLR profiling?
I'm using CLR profiling API to profile my .NET Core application.
In the method enter hook I can get the classID and metadata.
Is there any way to invoke another function from that class using ...
0
votes
1
answer
482
views
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 ...
5
votes
1
answer
235
views
Understanding "this" argument for structs (specifically Iterators/async)
I'm currently inspecting deep objects in the CLR using the Profiler API. I have a specific problem analyzing "this" argument for Iterators/async methods (generated by the compiler, in the form of <...
2
votes
0
answers
216
views
Creating a PE file using IMetaDataEmit::Save(/ToMemory/ToStream)
I'm writing a native CLR Profiler which does some heavy IL rewriting. When developing a new feature, we sometimes encounter a CLR verification error. For small methods, it's pretty easy to compare the ...
3
votes
1
answer
395
views
CLR profiler API: Is ICorProfilerCallback::ExceptionThrown GC safe?
In the .NET framework profiler, is ExceptionThrown guaranteed to not overlap with GC?
Looking at documentation, it appears so:
If the profiler blocks here and garbage collection is attempted, the ...
2
votes
0
answers
178
views
Reloading Assembly from Itself into Shared App Domain
I have a strange requirement as I am working on instrumentation of .NET code using C++ code.
In a particular scenario, I need to reload my C# assembly(a dll) into a shared appdomain from that dll ...
0
votes
1
answer
216
views
Code injection does not work with MSCorLib in .Net 2.x
In our .Net application, we want to keep track of a file that is getting opened through .Net Code. Any file that is getting opened, execution call always pass through an internal instance method ...
3
votes
0
answers
160
views
Can I load a managed C# DLL from a physical path instead of loading from GAC via CLRProfiler
The managed DLL can be loaded when it is in GAC using the public key token and assembly name.
MetaDataAssemblyEmit->DefineAssemblyRef(pbPublicKeyOrToken, publicKeySize, assemblyName, &...
0
votes
1
answer
182
views
Define TypeSpec from TypeRef for .Net IL
I have built custom IL Rewriter that inject custom code into some methods. Part of this injection, I want to instantiate the object of List<int>. I already found the mdTokenRef for List~1.
...
1
vote
0
answers
230
views
IL Rewrite to mscorlib crashing w3wp.exe
I have built the IL Rewriter to monitor any file is being opened in ASP.Net WebApp. To do so, I am rewriting IL for a private method called 'Init' in FileStream class in mscorlib. Here, I inject the ...
3
votes
1
answer
317
views
IL Rewrite fails to load .Net DLL
I have built the IL Rewriter for some custom requirement. All it does is
Creates method references for another .Net DLL (newly built custom DLL)
Inject epilogue & prologue for few required methods,...
1
vote
0
answers
79
views
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). ...
0
votes
1
answer
74
views
C# icorprofilercallback4::SurvivingReferences
I would like to be able to find all the surviving references of some kind of object in any application without having to use an external memory profiler.
My basic idea is that, I just want to be able ...
0
votes
1
answer
701
views
CLR Profiling and Rewriting using ICLRProfiling::AttachProfiler()
I gather the main benefit of using the CLR Profiler ICLRProfiling::AttachProfiler method is that you now can attach your CLR profiler long after the target process has started and that you also don't ...
3
votes
1
answer
436
views
ICorProfiler: Why do I get the wrong type token for a jitted function?
I have code that is structured like this:
class A {
void M() {}
}
delegate void B<T1,T2>(T1 key, T2 value);
And I'm using the ICorProfiler2 API to profile that code. Now, when method M is ...
1
vote
2
answers
308
views
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]...
0
votes
0
answers
188
views
CLR Profiling API Version
I have a CLR profiler that I have written which injects code into methods at JIT time. The code I inject depends on .NET 3.5+. How can I detect the version of the .NET Framework that is available at ...
3
votes
1
answer
414
views
CLR profiler: COM-style casting and calling functions from derived interfaces
I have a need to develop a specialized CLR profiler. CLR profilers must be implemented as a COM server implementing ICorProfilerCallback or a newer version currently up through 5. Profiler ...
1
vote
1
answer
361
views
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 ...