System.PlatformNotSupportedException: Compiling JScript/CSharp scripts is not supported
See original GitHub issueHi,
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:
- Created 6 years ago
- Reactions:1
- Comments:19 (7 by maintainers)

Top Related StackOverflow Question
I understood the root cause of the issue. One of the types generated by WCF Connected Service was wrong, see below.
The property is a 2-dimensional array, but the
XmlArrayItemAttributespeicifed the item type astypeof(ListViewRecordColumn). To work around the issue, we can change the item type totypeof(ListViewRecordColumn[]).The issue is a duplicate of https://github.com/dotnet/wcf/issues/1274. Resolved the issue as duplicate.
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,
Note that, using reflection to enable the mode is subject to future changes.