There is the following class hierarchy:
public class XmlTypeMapping_init { public XmlTypeMapping tm; public XmlTypeMapping_init() { tm = (new SoapReflectionImporter().ImportTypeMapping(typeof(SOAP_Serializer))); } } public class SOAP_Serializer:XmlTypeMapping_init { private StreamWriter file; private XmlSerializer xml_s; public SOAP_Serializer() : base() { xml_s = new XmlSerializer(tm); } ... } When you call the specified constructor of the class SOAP_Serializer ( SOAP_Serializer s = new SOAP_Serializer(); ), the parent constructor is called and on the line
tm = (new SoapReflectionImporter().ImportTypeMapping(typeof(SOAP_Serializer))); an error:
Unable to serialize System.Xml.Serialization.XmlTypeMapping, because it does not have a non-parametric constructor
XmlSerializerrequires that the type being serialized have a default constructor. TheXmlTypeMappingtype does not have this. You can try using a different serializer (DataContractSerializer,JsonSerializer, etc.), but better tell what you want to do. - andreycha