I've checked the three hits on SO that the error message's given me. None of them seemed to be relevant (reader on element created, document isn't empty, wrong library used).
My class for Mapping looks like so.
[Serializable]
public class Mapping
{
[XmlElement] public String Key { get; set; }
[XmlElement] public String Field { get; set; }
[XmlElement] public String Value { get; set; }
[XmlElement] public bool Enable { get; set; }
}
When I try to assign manually using the code below, I get it to run as supposed to.
return characteristics.ToDictionary(
element => element.Element("Name").Value,
element => element.Descendants("DataMapping")
.Select(felement => new Mapping
{
Key = felement.Element("Key").Value
}));
However, when I try to impose deserialization on the very same data set being read, I get the error in subject.
return characteristics.ToDictionary(
element => element.Element("Name").Value,
element => element.Descendants("DataMapping")
.Select(felement
=> serializer.Deserialize(felement.CreateReader()) as Mapping));
I know (almost) for sure that I did something stupid and forgot something but I just can't see what... And I'm out of ideas to think of more things to try.