System.PlatformNotSupportedException: Compiling JScript/CSharp scripts is not supported

See original GitHub issue

Hi,

I am using a WSDL file (wsdl.zip) provided by Salesforce.com. When trying to logon to the service using the below code, it threw a System.PlatformNotSupportedException saying “Compiling JScript/CSharp scripts is not supported”

var salesforceClient = new SoapClient(); salesforceClient.loginAsync(null, username, password).Wait();

Here is the stack trace. InnerException {System.PlatformNotSupportedException: Compiling JScript/CSharp scripts is not supported at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location) at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type) at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type) at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GenerateSerializers() at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GetSerializer(Int32 handle) at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.AddHeadersToMessage(Message message, MessageDescription messageDescription, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.SerializeRequest(MessageVersion messageVersion, Object[] parameters) at System.ServiceModel.Dispatcher.ProxyOperationRuntime.BeforeRequest(ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.PrepareCall(ProxyOperationRuntime operation, Boolean oneway, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.Begin() at System.ServiceModel.Channels.ServiceChannel.BeginCall(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, TimeSpan timeout, AsyncCallback callback, Object asyncState) at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.CreateGenericTask(ServiceChannel channel, ProxyOperationRuntime operation, Object[] inputParameters)} System.Exception {System.PlatformNotSupportedException}

Is this really something that is not supported by the tool yet?

Thanks, Son

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

38reactions
shmaocommented, Sep 11, 2017

I understood the root cause of the issue. One of the types generated by WCF Connected Service was wrong, see below.

        /// <remarks/>
        [System.Xml.Serialization.XmlArrayAttribute(Order=5)]
        [System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(ListViewRecordColumn), IsNullable=false)]
        public ListViewRecordColumn[][] records
        {
            get
            {
                return this.recordsField;
            }
            set
            {
                this.recordsField = value;
            }
        }

The property is a 2-dimensional array, but the XmlArrayItemAttribute speicifed the item type as typeof(ListViewRecordColumn). To work around the issue, we can change the item type to typeof(ListViewRecordColumn[]).

The issue is a duplicate of https://github.com/dotnet/wcf/issues/1274. Resolved the issue as duplicate.

7reactions
shmaocommented, Aug 23, 2017

Hi Son, I tried the repro and could repro the issue on my machine. For now it seems to be a bug with the XmlSerializer generation using RefEmit. I need to investigate the issue further to understand the root cause.

XmlSerializer has a special mode in which the serializer would use reflection instead of RefEmit to do serialization. I wondered if the app would work in that mode. If you are willing to give it a try, you can enable the mode by using the code below at the app’s startup,

static void Main(string[] args)
{
    MethodInfo method = typeof(XmlSerializer).GetMethod("set_Mode", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
    method.Invoke(null, new object[] { 1 });

    // Your code goes here
}

Note that, using reflection to enable the mode is subject to future changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compiling JScript/CSharp scripts is not supported
Hi Team,. I am calling an xslt in console application, the xslt has cdata section having a function. using cdata is causing the...
Read more >
c# - .NET Core 3.1 SOAP platform not supported error " ...
To work around the issue, we can change the item type to typeof(ListViewRecordColumn[]) . i.e. Change **: /// <remarks/> [System.Xml.
Read more >
Badly auto generated WCF proxy - Just Simply Code
System.PlatformNotSupportedException: Compiling JScript/CSharp scripts is not supported After a bit of research and looking into the ...
Read more >
Compiling JScript/CSharp scripts is not supported
Coding example for the question XSLT compile error - Compiling JScript/CSharp scripts is not supported.
Read more >
'Xslt' must be a valid XML error for Choose condition
I keep getting XSLT compile error, and Inner Exception Compiling JScript/CSharp scripts is not supported. XML FILE: <?xml version="1.0" encoding="utf-8"?>
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found