0

I am trying to read the value of a property of a ClrObject in a dmp file using ClrMD. I can read the values of any field of the object using the function GetField<T>(string fieldName). Unfortunately, this is not possible for the properties.

I have considered whether I can get the value of the property by executing the get method of the property, in my case the get_Int1 method. Is it possible in clrmd to execute a method / function on a ClrObject?

I've already read in this post, that it is not that easy to figure out the property value. Finding a type's instance data in .net heap

However, I wonder how the Visual Studio gets the value of the property. I can load the minidump file in Visual Studio and start it with "Debug with Managed Only". Then I see the locals variables including the property for the minidump file! So Visual Studio can somehow resolve that.

enter image description here enter image description here

Does anyone know a solution to get the value of a property of a ClrObject?

Snowcrack
  • 549
  • 1
  • 5
  • 13
  • 1
    To evaluate properties, Visual Studio has an IL interpreter that simulates the execution of the code. Unfortunately ClrMD is not capable of doing that. But in theory you know how the property is implemented (you can decompile the code if you didn't write it), so you can just rewrite the logic with ClrMD – Kevin Gosse Apr 06 '20 at 15:30
  • 1
    Note that in theory it would be possible to write a library that uses the Visual Studio IL interpreter to add that feature to ClrMD (I believe the magic happens in `Microsoft.VisualStudio.vil.dll` and `Microsoft.VisualStudio.vil.host.dll`), but those aren't documented so that would be **a lot** of work for only niche use-cases – Kevin Gosse Apr 06 '20 at 15:34
  • Thank you for the fast answer! Now I understand how VS does it. To implement this by my own sounds like a lot of work :-/ – Snowcrack Apr 06 '20 at 16:23

0 Answers0