clrmd

Finding a type's instance data in .net heap

守給你的承諾、 提交于 2021-02-07 10:23:22
问题 Let's say I have two class Foo and Bar as follows public class Foo { private Bar _bar; private string _whatever = "whatever"; public Foo() { _bar = new Bar(); } public Bar TheBar { get { return _bar; } } } public class Bar { public string Name { get; set; } } I have an application that attaches to a process that is using these classes. I would like to see all instances of Foo type in .NET heap and inspect the TheBar.Name property or _whatever field of all Foo instances present in .NET heap. I

Finding a type's instance data in .net heap

ぃ、小莉子 提交于 2021-02-07 10:22:24
问题 Let's say I have two class Foo and Bar as follows public class Foo { private Bar _bar; private string _whatever = "whatever"; public Foo() { _bar = new Bar(); } public Bar TheBar { get { return _bar; } } } public class Bar { public string Name { get; set; } } I have an application that attaches to a process that is using these classes. I would like to see all instances of Foo type in .NET heap and inspect the TheBar.Name property or _whatever field of all Foo instances present in .NET heap. I

Calling WaitForSingleObject from C#

余生颓废 提交于 2020-01-23 17:15:49
问题 I am trying to call WaitForSingleObject method from C#, as documented here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx In order to call this function I need to create a Handle, or I need to get a Handle of type IntPtr, how can it be done? I've tried this function that I found: http://www.pinvoke.net/default.aspx/kernel32.WaitForSingleObject [DllImport("coredll.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto)]

ClrMd - ClrInfo TryGetDacLocation and other method missing?

↘锁芯ラ 提交于 2019-12-24 15:48:04
问题 I am trying out the ClrMd Library : https://github.com/Microsoft/clrmd And I have this issue, according to the first tutorial I have a method called TryGetDacLocation in ClrInfo type, but as I can find it in it... I can see that Dac location are generated automatically inside the Clrinfo but as I am trying to call runtimeInfo.CreateRuntime(); I am getting: "Mismatched architecture between this process and the dac" The dump and the running process are of the same - 32bit architecture. I don't

ClrMd throws exception when creating runtime

♀尐吖头ヾ 提交于 2019-12-18 16:46:45
问题 I am using the CLR Memory Diagnostics library to get the stack trace of all threads in a running process: var result = new Dictionary<int, string[]>(); var pid = Process.GetCurrentProcess().Id; using (var dataTarget = DataTarget.AttachToProcess(pid, 5000, AttachFlag.Passive)) { string dacLocation = dataTarget.ClrVersions[0].TryGetDacLocation(); var runtime = dataTarget.CreateRuntime(dacLocation); //throws exception foreach (var t in runtime.Threads) { result.Add( t.ManagedThreadId, t

ClrMD on another user's process

不想你离开。 提交于 2019-12-12 02:43:16
问题 I have a .Net application that's reporting hangs in the Event Log. The events say "Application Hang" with no usable details to go by. So I whipped up a C# console app that uses the ClrMD library. But the caveat is this application is being published as a RemoteApp. When I try to attach ClrMD to the users' process I get this error: Microsoft.Diagnostics.Runtime.ClrDiagnosticsException: Could not attach to process. Error 0. This is not surprising since I'm logged into the server as

Attach to self with ClrMD? HRESULT: 0x80070057

心已入冬 提交于 2019-12-10 17:15:17
问题 I'm trying to attach the ClrMD in a process to itself: private static void Main() { var pid = Process.GetCurrentProcess().Id; WriteLine($"PID: {pid}"); using (var dataTarget = DataTarget.AttachToProcess(pid, 1000)) { WriteLine($"ClrMD attached"); } } However, I'm getting the following exception: PID: 7416 Unhandled Exception: Microsoft.Diagnostics.Runtime.ClrDiagnosticsException: Could not attach to pid 1CF8, HRESULT: 0x80070057 at Microsoft.Diagnostics.Runtime.DbgEngDataReader..ctor(Int32

Can DebugDiag generate reports with “inclusive size” like Visual Studio 2013

☆樱花仙子☆ 提交于 2019-12-02 02:39:36
问题 Visual Studio 2013 can show a column for inclusive size (which includes size of child objects) - http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/net-memory-analysis-enhancements-in-visual-studio-2013.aspx DebugDiag's memory analysis reports currently only shows object size without including child objects. Is there a way to make DebugDiag include size of child objects in its report? What do you suggest is a good way to generate such a report for .NET 4.0 since Visual Studio only

Can DebugDiag generate reports with “inclusive size” like Visual Studio 2013

倾然丶 夕夏残阳落幕 提交于 2019-12-02 01:49:20
Visual Studio 2013 can show a column for inclusive size (which includes size of child objects) - http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/net-memory-analysis-enhancements-in-visual-studio-2013.aspx DebugDiag's memory analysis reports currently only shows object size without including child objects. Is there a way to make DebugDiag include size of child objects in its report? What do you suggest is a good way to generate such a report for .NET 4.0 since Visual Studio only supports analyzing .NET 4.5 crash dumps DebugDiag DebugDiag 2 has totally been rewritten and is now a set