Is there an API to have WinDBG-SOS-like features in .NET?
Given an object, I would like to know how many roots are keeping it alive at runtime from C# within the same process.
Is there an API to have WinDBG-SOS-like features in .NET?
Given an object, I would like to know how many roots are keeping it alive at runtime from C# within the same process.
ClrMD
NuGet: https://www.nuget.org/packages/Microsoft.Diagnostics.Runtime
And I wrote a small example:
Yes there is. How all those profiles would work if not? This is called Profiling API: https://msdn.microsoft.com/en-us/library/ms404386(v=vs.110).aspx .
The API itself is unmanaged (COM object). But there is nothing that could stop you to use it from managed code through a RCW.
I am not sure and in doubt if you can profile a process from within itself. I think the profiler must be in another process. Though I see no issue to have process to process communication and feed the data back to the profiled process through some communication method like named pipes.