Bug 25843 - System.NullReferenceException: Object reference not set to an instance of an object at System.String.FindNotWhiteSpace
Summary: System.NullReferenceException: Object reference not set to an instance of an ...
Status: NEEDINFO
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-01-08 14:03 UTC by Albert
Modified: 2015-05-15 04:45 UTC (History)
4 users (show)

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


Attachments

Description Albert 2015-01-08 14:03:57 UTC
i have created a simple project to connect to a VMware server that use VMware library and runs fine on windows but when running in linux/mono 3.10 i get:

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at System.String.FindNotWhiteSpace (Int32 pos, Int32 target, Int32 change) [0x00000] in <filename unknown>:0
  at System.String.Trim () [0x00000] in <filename unknown>:0
  at System.Net.WebHeaderCollection.SetInternal (System.String name, System.String value) [0x00000] in <filename unknown>:0
  at System.Net.HttpWebRequest.set_UserAgent (System.String value) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest:set_UserAgent (string)
  at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.GetRequestForMessage (System.Uri uri, System.Web.Services.Protocols.SoapClientMessage message) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at VimApi_51.VimService.RetrieveServiceContent (VimApi_51.ManagedObjectReference _this) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) VimApi_51.VimService:RetrieveServiceContent (VimApi_51.ManagedObjectReference)
  at VMware.Vim.ServiceInstance.RetrieveServiceContent () [0x00000] in <filename unknown>:0
  at VMware.Vim.VimClient.Connect () [0x00000] in <filename unknown>:0
  at VMware.Vim.VimClient.Connect (System.String serviceUrl) [0x00000] in <filename unknown>:0
  at monovim.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at System.String.FindNotWhiteSpace (Int32 pos, Int32 target, Int32 change) [0x00000] in <filename unknown>:0
  at System.String.Trim () [0x00000] in <filename unknown>:0
  at System.Net.WebHeaderCollection.SetInternal (System.String name, System.String value) [0x00000] in <filename unknown>:0
  at System.Net.HttpWebRequest.set_UserAgent (System.String value) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest:set_UserAgent (string)
  at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.GetRequestForMessage (System.Uri uri, System.Web.Services.Protocols.SoapClientMessage message) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at VimApi_51.VimService.RetrieveServiceContent (VimApi_51.ManagedObjectReference _this) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) VimApi_51.VimService:RetrieveServiceContent (VimApi_51.ManagedObjectReference)
  at VMware.Vim.ServiceInstance.RetrieveServiceContent () [0x00000] in <filename unknown>:0
  at VMware.Vim.VimClient.Connect () [0x00000] in <filename unknown>:0
  at VMware.Vim.VimClient.Connect (System.String serviceUrl) [0x00000] in <filename unknown>:0
  at monovim.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Comment 1 Zoltan Varga 2015-01-08 18:32:19 UTC
-> bcl.
Comment 2 Albert 2015-01-09 04:25:07 UTC
If I target .NET 2.0 or 3.5 the error is different. Is there any workaround to make this library work on mono or is it a problem with vendor library?

Unhandled Exception:
System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type of the argument object 'VimApi_51.TraversalSpec' is not primitive.
  at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive (System.String name, System.String ns, System.Object o, Boolean xsiType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObject (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp, Boolean isNullable, Boolean needType, Boolean writeWrappingElem) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMemberElement (System.Xml.Serialization.XmlTypeMapElementInfo elem, System.Object memberValue) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteListContent (System.Object container, System.Xml.Serialization.TypeData listType, System.Xml.Serialization.ListMap map, System.Object ob, System.Text.StringBuilder targetString) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteElementMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElementElements (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElement (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObject (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp, Boolean isNullable, Boolean needType, Boolean writeWrappingElem) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMemberElement (System.Xml.Serialization.XmlTypeMapElementInfo elem, System.Object memberValue) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteListContent (System.Object container, System.Xml.Serialization.TypeData listType, System.Xml.Serialization.ListMap map, System.Object ob, System.Text.StringBuilder targetString) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteElementMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElementElements (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElement (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObject (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp, Boolean isNullable, Boolean needType, Boolean writeWrappingElem) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMemberElement (System.Xml.Serialization.XmlTypeMapElementInfo elem, System.Object memberValue) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteListContent (System.Object container, System.Xml.Serialization.TypeData listType, System.Xml.Serialization.ListMap map, System.Object ob, System.Text.StringBuilder targetString) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteElementMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMessage (System.Xml.Serialization.XmlMembersMapping membersMap, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteRoot (System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Serialize (System.Object o, System.Xml.Serialization.XmlSerializationWriter writer) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Serialize (System.Xml.XmlWriter xmlWriter, System.Object o, System.Xml.Serialization.XmlSerializerNamespaces namespaces) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Xml.Serialization.XmlSerializer.Serialize (System.Xml.XmlWriter xmlWriter, System.Object o, System.Xml.Serialization.XmlSerializerNamespaces namespaces) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Serialize (System.Xml.XmlWriter xmlWriter, System.Object o) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.WebServiceHelper.WriteSoapMessage (System.Xml.XmlTextWriter xtw, SoapBindingUse methodUse, System.Xml.Serialization.XmlSerializer bodySerializer, System.Xml.Serialization.XmlSerializer headerSerializer, System.Object bodyContent, System.Object[] headers, Boolean soap12) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.WebServiceHelper.WriteSoapMessage (System.Xml.XmlTextWriter xtw, System.Web.Services.Protocols.SoapMethodStubInfo method, SoapHeaderDirection dir, System.Object bodyContent, System.Web.Services.Protocols.SoapHeaderCollection headers, Boolean soap12) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.SendRequest (System.IO.Stream s, System.Web.Services.Protocols.SoapClientMessage message, System.Web.Services.Protocols.SoapExtension[] extensions) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at VimApi_51.VimService.RetrieveProperties (VimApi_51.ManagedObjectReference _this, VimApi_51.PropertyFilterSpec[] specSet) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) VimApi_51.VimService:RetrieveProperties (VimApi_51.ManagedObjectReference,VimApi_51.PropertyFilterSpec[])
  at VMware.Vim.PropertyCollector.RetrieveProperties (VMware.Vim.PropertyFilterSpec[] specSet) [0x00000] in <filename unknown>:0
  at VMware.Vim.VimClient.FindEntityViews (System.Type viewType, VMware.Vim.ManagedObjectReference beginEntity, System.Collections.Specialized.NameValueCollection filter, System.String[] properties) [0x00000] in <filename unknown>:0
  at monovim.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type of the argument object 'VimApi_51.TraversalSpec' is not primitive.
  at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive (System.String name, System.String ns, System.Object o, Boolean xsiType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObject (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp, Boolean isNullable, Boolean needType, Boolean writeWrappingElem) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMemberElement (System.Xml.Serialization.XmlTypeMapElementInfo elem, System.Object memberValue) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteListContent (System.Object container, System.Xml.Serialization.TypeData listType, System.Xml.Serialization.ListMap map, System.Object ob, System.Text.StringBuilder targetString) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteElementMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElementElements (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElement (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObject (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp, Boolean isNullable, Boolean needType, Boolean writeWrappingElem) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMemberElement (System.Xml.Serialization.XmlTypeMapElementInfo elem, System.Object memberValue) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteListContent (System.Object container, System.Xml.Serialization.TypeData listType, System.Xml.Serialization.ListMap map, System.Object ob, System.Text.StringBuilder targetString) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteElementMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElementElements (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObjectElement (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteObject (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob, System.String element, System.String namesp, Boolean isNullable, Boolean needType, Boolean writeWrappingElem) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMemberElement (System.Xml.Serialization.XmlTypeMapElementInfo elem, System.Object memberValue) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteListContent (System.Object container, System.Xml.Serialization.TypeData listType, System.Xml.Serialization.ListMap map, System.Object ob, System.Text.StringBuilder targetString) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteElementMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteMessage (System.Xml.Serialization.XmlMembersMapping membersMap, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationWriterInterpreter.WriteRoot (System.Object ob) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Serialize (System.Object o, System.Xml.Serialization.XmlSerializationWriter writer) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Serialize (System.Xml.XmlWriter xmlWriter, System.Object o, System.Xml.Serialization.XmlSerializerNamespaces namespaces) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Xml.Serialization.XmlSerializer.Serialize (System.Xml.XmlWriter xmlWriter, System.Object o, System.Xml.Serialization.XmlSerializerNamespaces namespaces) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Serialize (System.Xml.XmlWriter xmlWriter, System.Object o) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.WebServiceHelper.WriteSoapMessage (System.Xml.XmlTextWriter xtw, SoapBindingUse methodUse, System.Xml.Serialization.XmlSerializer bodySerializer, System.Xml.Serialization.XmlSerializer headerSerializer, System.Object bodyContent, System.Object[] headers, Boolean soap12) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.WebServiceHelper.WriteSoapMessage (System.Xml.XmlTextWriter xtw, System.Web.Services.Protocols.SoapMethodStubInfo method, SoapHeaderDirection dir, System.Object bodyContent, System.Web.Services.Protocols.SoapHeaderCollection headers, Boolean soap12) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.SendRequest (System.IO.Stream s, System.Web.Services.Protocols.SoapClientMessage message, System.Web.Services.Protocols.SoapExtension[] extensions) [0x00000] in <filename unknown>:0
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at VimApi_51.VimService.RetrieveProperties (VimApi_51.ManagedObjectReference _this, VimApi_51.PropertyFilterSpec[] specSet) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) VimApi_51.VimService:RetrieveProperties (VimApi_51.ManagedObjectReference,VimApi_51.PropertyFilterSpec[])
  at VMware.Vim.PropertyCollector.RetrieveProperties (VMware.Vim.PropertyFilterSpec[] specSet) [0x00000] in <filename unknown>:0
  at VMware.Vim.VimClient.FindEntityViews (System.Type viewType, VMware.Vim.ManagedObjectReference beginEntity, System.Collections.Specialized.NameValueCollection filter, System.String[] properties) [0x00000] in <filename unknown>:0
  at monovim.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Comment 3 Albert 2015-01-23 05:21:09 UTC
I think i get this error when using pre-generated *.XmlSerializers.dll. Are pregenerated xmlserializers assemblies supported in mono?
Comment 4 Marek Safar 2015-05-15 04:45:14 UTC
These are different issue. Please provide test case to verify them

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