Inspecting COM / Interop class instance properly in VS.Net debugger?
So, this is not an answer, but check these two screenshots. It's from the same app, just two different break points. In both cases, COM objects are from the same COM / AX library. I don't know why in one case I see "System .__ ComObject" and in the other the correct type. However, in both cases, I see the corresponding properties of the objects / interfaces. What gives? Why the difference?
The first one shows that it shows "System .__ ComObject", however it also shows me all the properties of the object. Click to view full size image.
The second completely hides "System .__ ComObject". Click to view full size image.
source to share
From .NET and COM: The Complete Compatibility Guide :
When an instance of a COM object is returned to you using the return type of a method or a parameter to reference, and the CLR cannot determine the type, you get the generic type System .__ ComObject because COM objects are always passed / returned as interface pointers.
You can try changing the return type with Marshal.CreateWrapperOfType
as shown in the following example:
MyType newObject = (MyType)Marshal.CreateWrapperOfType(oldObject, typeof(MyType))
Then you can look at newObject in the viewport and have the expected properties.
If the call fails, it throws an InvalidCastException.
source to share