I'm using Xamarin.mac and mono (4.6.2) to deploy a .Net application to macOS and Linux. This application uses the VirtualBox SDK which is provided through a SOAP webservice.
On Windows and Linux this works fine but on macOS I get a strange NullReferenceException when I try to invoke any method on the SOAP webservice.
The Stacktrace is:
System.NullReferenceException: Object reference not set to an instance of an object
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse (System.Web.Services.Protocols.SoapClientMessage message, System.Net.WebResponse response, System.IO.Stream responseStream, System.Boolean asyncCall) [0x00398] in <4493f371b365451c969f031cecf97807>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String methodName, System.Object[] parameters) [0x0005d] in <4493f371b365451c969f031cecf97807>:0
at vboxBinding.IWebsessionManager_logon (System.String username, System.String password) [0x00001] in <908974d32d214cf186212716ae292b73>:0
at (wrapper remoting-invoke-with-check) vboxBinding:IWebsessionManager_logon (string,string)
The called method:
[SoapDocumentMethod("", RequestNamespace = "http://www.virtualbox.org/", ResponseNamespace = "http://www.virtualbox.org/", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute]
public string IWebsessionManager_logon([System.Xml.Serialization.XmlElementAttribute] string username, [System.Xml.Serialization.XmlElementAttribute] string password);
And the bindings:
[DebuggerStepThrough]
[DesignerCategory("code")]
[GeneratedCode("wsdl", "4.6.1055.0")]
[WebServiceBinding(Name = "vboxBinding", Namespace = "http://www.virtualbox.org/")]
[System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName = "VBoxService.XmlSerializers")]
public class vboxBinding : SoapHttpClientProtocol
Of course this works fine on my development machine and only breaks on any other one so I think there must me some kind of dependency problem. The web service is reachable on the machines where the error occurs (as localhost).