I've created a .net assembly that includes the data contract for a WCF (win32) service. I then exposed these objects via COM Interop so that the same assembly can be re-used on the client side for calling the WCF service. I've got the following pieces to my project:
[wcf service] <====> { [wcf client assembly exposed through COM interop] + [data contracts assembly also exposed through com interop] } <==> [vb 6 application]
One example of a class in the data contract is like this:
[Guid("00000000-0000-0000-0000-000000000000")]
[ComVisible(true)]
[DataContract]
public sealed class Monkey {
public string name;
};
And, mostly, it works just fine. I'm able to compile the .net assembly that includes this class, register it for COM interop, refer to it in the VB6 project, and call through to the WCF service from the client application.
Here's the strange behavior: It displays the class Monkey in the VB6 IDE object browser, but does not display the members like Monkey.name.
I believe that this is being caused by the same thing that causes the following compile-time warning in the .net assembly project:
Type library exporter warning processing 'MyCompany.Product.Contracts, MyCompany.Product.API'. Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute.
And, finally, I think that the cause of both the warning and the strange behavior while developing the client application is being caused by the fact that I'm using the automatically generated service reference and client object that inherits from System.ServiceModel.ClientBase<T>
.
Am I on the right track?
How can I resolve this issue/warning?