Serialization File Error Could not load file or assembly mscorlib.XmlSerializers

When serializing an XML file, an error occurs in the following manner:
  
XmlSerializer serializer= new XmlSerializer(typeof(MyType));
			
Errors such as :
The assembly with display name 'mscorlib.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'mscorlib.XmlSerializers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
use the following line to solve it: 
  XmlSerializer lizer = XmlSerializer.FromTypes(new[] { typeof(MyType) })[0];
				

Comments

Popular posts from this blog

C# Crop white space from around the image

Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=xx.0.0.0, Culture=neutral, PublicKeyToken='xxx' or one of its dependencies.

The specified version string contains wildcards, which are not compatible with determinism.