I've been going round this for a while now and I can't figure out why I can use the config to add references to known types, or how to go about debugging it. Any pointers might save my sanity.
I have a WCF service hosted in a windows service, and I have a config file for the service. In the config I have this:
<configuration>
...
<system.runtime.serialization>
<dataContractSerializer>
<declaredTypes>
<add type="My.Full.Interface.Name, My.Assembly.Name.With.No.dll">
<knownType type="My.Full.Implementation.Class.Name, My.Assembly.Name.With.No.dll"/>
</add>
</declaredTypes>
</dataContractSerializer>
</system.runtime.serialization>
...
</configuration>
I have tried adding the Version=1.0.0.0,Culture=neutral,PublicKeyToken=null
to both declarations, but I can't seem to make the data contract serializer pick them up.
I have verified that this class can be returned (by adding a [ServiceKnownType(typeof(My.Implementation.Class))]
) and that works, but I have another implementation that I want to use that is in anothet assembly that would create a circular reference if I added it, so can't use that.
How can I debug why the datacontract serializer is not finding my type? Or what is wrong with my declaration?