DataContractSerializer KnownType attribute not being respected?
- by e28Makaveli
I have a class that is decorated with a KnownType attribute with a type of the class. Is this not allowed?
[KnownType(typeof(Occ600UIConfig))]
public class Occ600UIConfig
{ }
If so, why is the DCS throwing the following exception?
{"Error in line 1 position 387.
Element
'http://schemas.microsoft.com/2003/10/Serialization/Arrays:Value'
contains data of the
'http://schemas.datacontract.org/2004/07/OCC600.Infrastructure.Dictionary.BusinessEntities:Occ600UIConfig'
data contract. The deserializer has no
knowledge of any type that maps to
this contract. Add the type
corresponding to 'Occ600UIConfig' to
the list of known types - for example,
by using the KnownTypeAttribute
attribute or by adding it to the list
of known types passed to
DataContractSerializer."}