Bug 52436 - System.ArgumentException: The empty string '' is not a valid local name - when parsing SOAP response
Summary: System.ArgumentException: The empty string '' is not a valid local name - whe...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 4.8.0 (C9)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-10 09:37 UTC by Prashant [MSFT]
Modified: 2017-02-10 15:52 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case (859.09 KB, application/zip)
2017-02-10 09:37 UTC, Prashant [MSFT]
Details

Description Prashant [MSFT] 2017-02-10 09:37:58 UTC
Created attachment 19781 [details]
Test case

Parsing the SOAP response form the MS Exchange web service fails on the Mono, while it works without any exceptions.
On windows we get the following XML response - 

> <t:Value Name="SmtpAddress" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">prchol@microsoft.com</t:Value>

But same request fails with below exception on Mac and Ubuntu -  

{System.InvalidOperationException: There was an error generating the XML document. ---> System.ArgumentException: The empty string '' is not a valid local name.
  at System.Xml.XmlWellFormedWriter.WriteStartElement (System.String prefix, System.String localName, System.String ns) [0x00011] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriter.cs:410 
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_delegate_end_invoke (object,intptr)
  at (wrapper delegate-end-invoke) <Module>:end_invoke_object__this___object[]&_IAsyncResult (object[]&,System.IAsyncResult)
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.EndProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters, System.IAsyncResult result) [0x00025] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:460 
  at System.ServiceModel.ClientBase`1+ChannelBase`1[TChannel,T].EndInvoke (System.String methodName, System.Object[] args, System.IAsyncResult result) [0x0003c] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs:404 
  at ExchangeServices.ExchangeServicePortTypeClient+ExchangeServicePortTypeClientChannel.EndFindPeople (System.IAsyncResult result) [0x00010] in /Users/prashantvc/Projects/ExchangeWeb/ExchangeWeb/ExchangeServices.cs:67242 
  at ExchangeServices.ExchangeServicePortTypeClient.ExchangeServices.ExchangeServicePortType.EndFindPeople (System.IAsyncResult result) [0x00008] in /Users/prashantvc/Projects/ExchangeWeb/ExchangeWeb/ExchangeServices.cs:63743 
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00014] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/threading/Tasks/FutureFactory.cs:550 }
	Data: {System.Collections.ListDictionaryInternal}
	HResult: -2146233079
	HelpLink: (null)
	InnerException: {System.ArgumentException: The empty string '' is not a valid local name.
  at System.Xml.XmlWellFormedWriter.WriteStartElement (System.String prefix, System.String localName, System.String ns) [0x00011] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriter.cs:410 }
	Message: "There was an error generating the XML document."
	Source: (null)
	StackTrace: "  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_delegate_end_invoke (object,intptr)\n  at (wrapper delegate-end-invoke) <Module>:end_invoke_object__this___object[]&_IAsyncResult (object[]&,System.IAsyncResult)\n  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.EndProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters, System.IAsyncResult result) [0x00025] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:460 \n  at System.ServiceModel.ClientBase`1+ChannelBase`1[TChannel,T].EndInvoke (System.String methodName, System.Object[] args, System.IAsyncResult result) [0x0003c] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs:404 \n  at ExchangeServices.ExchangeServicePortTypeClient+ExchangeServicePortTypeClientChannel.EndFindPeople (System.IAsyncResult result) [0x00010] in /Users/prashantvc/Projects/ExchangeWeb/ExchangeWeb/ExchangeServices.cs:67242 \n  at ExchangeServices.ExchangeServicePortTypeClient.ExchangeServices.ExchangeServicePortType.EndFindPeople (System.IAsyncResult result) [0x00008] in /Users/prashantvc/Projects/ExchangeWeb/ExchangeWeb/ExchangeServices.cs:63743 \n  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00014] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/threading/Tasks/FutureFactory.cs:550 "
	TargetSite: (null)
	Static members: 
	Non-public members: 

I have tested this with the latest mono stable and master, the results are still same 

# Steps to reproduce

1. Download attached test case 
2. Use your MS user name and password in Program.cs (like 35 & 36)
3. Run!

# Expected result 
SOAP response should be parsed without any exception. The p.Result should come back as FindPeopleResponse object

# Actual result
API fails to parse SOAP response, and throws ArgumentException

Note You need to log in before you can comment on or make changes to this bug.