dotnet interop:
Hello,
I want to write a unittest that compares
the property-values of a managed-object with
the property-values of an object instantiated via interop.
Background is:
I have a vb6-class with many public properties. The properties will be
filled by a Read-method from a file and can be written to a file by a
write-method.
Then I converted the vb6-code with upgrade-wizard to VB.NET.
Now I want a use case that instantiates these two classes,
the "old" via interop and the "new" one.
Then get via reflection the propertynames and values, interate about
them and compare the values.
The managed part is no problem with reflection, but
the first problem was that the activeX-instance does not have the
GetType() method.
Ok ... then I found this posting:
http://groups.google.de/group/microsoft.public.dotnet.framework/browse_thread/thread/10c9516762808b3d/52447f5e8683c33d?lnk=st&q=createinstance+interop+oMethod&rnum=1&hl=de#52447f5e8683c33d
With that idea I tried:
oAssembly = oAssembly.LoadFrom("Interop.TestObject06.dll")
oObj =
Activator.CreateInstance(oAssembly.GetType("TestObject06.CTestObject06Class"))
There is the problem that CreateInstance throws a
MissingMethodException and tells
that it cannot create an instance of an interface.
Mhmmm... Then I tried:
oObj =
Activator.CreateInstance(oAssembly.GetType("TestObject06.CTestObject06Class"),
BindingFlags.IgnoreReturn)
There is the problem that CreateInstance throws also a
MissingMethodException and tells
that that the constructor for "TestObject06.CTestObject06Class" cannot
be found.
I suppose "constructor" means in this case:
Public Sub Class_Initialize()
End Sub
But this piece of code is in in the vb6.class.
.........
Now i am a bit confused.
Is it possible to get the properties of an activex-dll via interop?
Thanks
Gordian