Reputation: 7216
We have a set of classes which we obtained via xsd.exe
and we use to serialize/deserialize some XML. We were using this on .NET 4.7.2 and everything went well. Once we tried to upgrade to .NET 5, some is working ok but other classes are failing on the XMLSerializer constructor with the following error:
System.PlatformNotSupportedException: Compiling JScript/CSharp scripts is not supported
I've searched for this error but I only got results regarding WCF. Does anyone know if something might have changed in XMLSerializer that can provoke this error?
Upvotes: 3
Views: 2641
Reputation: 7216
I found the problem. I leave the answer here for if it helps someone. We had a property like this:
/// <remarks/>
[XmlElement("EstimatedEndDateTime", typeof(System.DateTime), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[XmlElement("FinalizedEndDateTime", typeof(System.DateTime), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[XmlChoiceIdentifier("ItemElementName")]
public System.DateTime? Item
{
get
{
return this.itemField;
}
set
{
this.itemField = value;
}
}
I had to change the type in the XmlElement
attributes to be also System.DateTime?
. The weird thing is that it used to work with .Net 4.7.2.
Upvotes: 1