'Visual Studio/CLR: Is it possible to watch an unmanaged pointer's attributes?

COMMON LANGUAGE RUNTIME

Is there any way to "watch" - see the member variables/values - an unmanaged pointer in a Visual Studio debug watch window in a VB.NET <=> Managed C++ <=> Unmanaged C++ hierarchy?

For example:

C++

  public ref class MyManagedCPP_Class
  {
    private:
      MyUnmanagedCPP_Class *myUnmanagedPtr;
                
    public:
      MyManagedCPP_Class() { <set up myUnmanagedPtr etc> }
      ...
  }

VB.NET

Dim myVBVar as MyManagedCPP_Class
<myVBVar initializations etc>
<break and interrogate the unmanaged pointer>

I would like to see the values in *myUnmanagedPtr in the watch window, but cannot get past e.g.

myUnmanagedPtr = &H10BF9C28.

I've tried various casting combinations and permutations within the watch window, but either it cannot be done, or, I have not yet worked out the correct way. Is it because the unmanaged pointer is [by definition] outside of the CLR and consequently, VS2019 does not understand MyUnmanagedCPP_Class ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source