First of all: I’m total beginner.in COM.
I’m working in team on big project. The server part is written in C++. The client side is written in C#. They communicate through COM.
Now – I have interface IA in C#. And I have object o, whose type is class A (implements IA in C++ – it is somehow trasfered via COM). I want to use reflection to get all properties of that type, but it’s not working properly. It returns just those properties, which I have used in my code.
Here is the Reflection code that retrieves the properties:
Type[] ifaces = typeof(A).GetIterfaces();
foreach (Type iface in ifaces)
{
foreach (PropertyInfo info in iface.GetProperties())
{
// it takes only those properties, I have used in C# code
}
}
First I thought it’s not working because of COM. But it’s weird, that it gives me all properties, which I mention in code. And all stuff around COM should be written correctly, because it’s working for a long time (before I got to this project).
The problem was in Embed interop types. I switched from True to False and it’s working.