I've used the immediate window to manually query the properties of the COM object. The downside is that I don't think you get intellisense so you have to know exactly what you want to inspect.
views:
214answers:
3
+1
A:
Tuzo
2009-08-21 04:23:35
Yeah it works 'manually'.. but I am looking for a way to display the whole object properly
Jörg B.
2009-08-21 08:17:59
Hey there,maybe it depends on the way the variable is initialized/created? How has the first one come to life?-J
Jörg B.
2009-08-25 16:11:17
I thought about that as well. I was wondering if you get more information in the locals/watch windows if you instantiate it versus simply getting an object instance returned from a COM object. In the first picture, the 'unsplitShape' is returned from a COM object. In the second picutre 'scratchLayer' is an object that I've instantiated.Are you running VS2003/2005/2008? Service pack level?
Yoopergeek
2009-08-25 17:38:59
Jörg B.
2009-08-26 10:35:52
+1
A:
From .NET and COM: The Complete Interoperability Guide:
When an instance of a COM object is returned to you, via a method's return type or a by-reference parameter, and the CLR can't determine the type, you'll get the generic System.__ComObject type because COM objects are always passed/returned as interface pointers.
You might try changing the return type using Marshal.CreateWrapperOfType
as in the example below:
MyType newObject = (MyType)Marshal.CreateWrapperOfType(oldObject, typeof(MyType))
Then you can look at newObject in your watch window and it should have the expected properties.
If the call fails, it will throw an InvalidCastException.
C-Pound Guru
2009-08-26 23:30:07