I generated a WCF proxy from a WSDL file given by one of our clients using the svcutils with dotnet core 2.1. When call one of the services, I get the following error.
System.PlatformNotSupportedException: Compiling JScript/CSharp scripts is not supported
After a bit of research and looking into the generated proxy, I found that some array properties are two dimensional array instead of normal array.
/// <remarks/> [System.Xml.Serialization.XmlArrayAttribute(Order=5)] [System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(string), IsNullable=false)] public string[][] labelNames { get { return this.labelNamesField; } set { this.labelNamesField = value; } }
Manually changing it to single dimension array fixes the exception. However, I get the next exception
System.InvalidOperationException: System.Xml.Linq.XElement cannot be used as: ‘xml text’
I found that the cause of this exception is due to the strange XElement[] Any properties in the generated proxy.
private System.Xml.Linq.XElement[] anyField; /// <remarks/> [System.Xml.Serialization.XmlTextAttribute()] [System.Xml.Serialization.XmlAnyElementAttribute(Order=0)] public System.Xml.Linq.XElement[] Any { get { return this.anyField; } set { this.anyField = value; } }
Removing all these fixes that exception and everything works.
I generated the WCF for the same WSDL file using full .Net Framework svcutils tool and it did not have these issues. It seems like it might be a bug in dotnet core svcutils tool.