I came across this error while serializing an entity class using an XmlSerializer, and realized one of the causes for the error is when the class being serialized does not have a default (empty) constructor.
I had added a parameterized constructor to provide some syntactic sugar, and started getting the error.
So, if you get this type of error, define a default constructor to fix the serialization error.
public class foo()
{
public foo () { }
}
Note: You can pinpoint the class by going through the chain of Inner Exceptions.
March 11, 2011 at 5:20 pm
This can also occur if any OTHER classes referenced within your class don’t have default constructors either.
November 5, 2011 at 1:48 am
[Serializable]
Add this property in top class