Hi All,
Need help with COM Interop.
I am trying to use interop and perform automation on a COM DLL.
In the process, i need to type cast an Object into a Class specified in COM DLL.
When i do the same in VB it works fine.
However when i typecast using C# , i get the following exception.
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type '<ClassName>'. COM components that enter the CLR and do not support IProvideClassInfo or that do not have any interop assembly registered will be wrapped in the __ComObject type. Instances of this type cannot be cast to any other class; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
i get the same exception when i try to typecast to the interface.
Surprisingly, since i donot need to typecast in VB explicity, i am able to typecast.
Can you please help me nail this. Am i doing something wrong
Regards,
Swaroop
PS: am trying to perfrom automation of a COM Dll that comes with a tool called Extensis Portfolio.