NullReferenceException using slsvcutil generated WCF client

RonnieJrgensenRonnieJrgensen DKUniversity

I've generated a proxy for a WCF service for use within a PCL project. Everything compiles, however, a call to base.BeginInvoke inside the generated code throws a NullReferenceException.

This looks like an issue that other people are having as well, recently someone have revived the following thread about the same: http://forums.xamarin.com/discussion/12685/strange-exception-when-using-wcf-in-pcl

It seems however that some people have no problems, which is why I'm hoping some of your have got some ideas to what be the problem.

Here's a snippet of the generated code that fails:

        public System.IAsyncResult BeginGetUserFilteredSessionID(string PartnerUser, string PartnerPassword, string CustomerUser, string CustomerPassword, System.AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[4];
                _args[0] = PartnerUser;
                _args[1] = PartnerPassword;
                _args[2] = CustomerUser;
                _args[3] = CustomerPassword;
                System.IAsyncResult _result = base.BeginInvoke("GetUserFilteredSessionID", _args, callback, asyncState);
                return _result;
            }

The stacktrace:

  at System.ServiceModel.ChannelFactory.get_DefaultOpenTimeout () [0x00000] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.4.46/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs:85 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel..ctor (System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.ChannelFactory channelFactory, System.ServiceModel.EndpointAddress remoteAddress, System.Uri via) [0x00000] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.4.46/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:87 
  at System.ServiceModel.ClientBase`1+ChannelBase`1[ProApp.PCL.EFB.Data.EfbServiceSoap,ProApp.PCL.EFB.Data.EfbServiceSoap].get_Inner () [0x0000b] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.4.46/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs:375 
  at System.ServiceModel.ClientBase`1+ChannelBase`1[ProApp.PCL.EFB.Data.EfbServiceSoap,ProApp.PCL.EFB.Data.EfbServiceSoap].BeginInvoke (System.String methodName, System.Object[] args, System.AsyncCallback callback, System.Object state) [0x0003c] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.4.46/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs:395 
  at ProApp.PCL.EFB.Data.EfbServiceSoapClient+EfbServiceSoapClientChannel.BeginGetUserFilteredSessionID (System.String PartnerUser, System.String PartnerPassword, System.String CustomerUser, System.String CustomerPassword, System.AsyncCallback callback, System.Object asyncState) [0x00024] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/EFB/Data/EfbService.cs:10739 
  at ProApp.PCL.EFB.Data.EfbServiceSoapClient.ProApp.PCL.EFB.Data.EfbServiceSoap.BeginGetUserFilteredSessionID (System.String PartnerUser, System.String PartnerPassword, System.String CustomerUser, System.String CustomerPassword, System.AsyncCallback callback, System.Object asyncState) [0x00010] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/EFB/Data/EfbService.cs:8652 
  at ProApp.PCL.EFB.Data.EfbServiceSoapClient.OnBeginGetUserFilteredSessionID (System.Object[] inValues, System.AsyncCallback callback, System.Object asyncState) [0x0002c] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/EFB/Data/EfbService.cs:8667 
  at System.ServiceModel.ClientBase`1[ProApp.PCL.EFB.Data.EfbServiceSoap].InvokeAsync (System.ServiceModel.BeginOperationDelegate beginOperationDelegate, System.Object[] inValues, System.ServiceModel.EndOperationDelegate endOperationDelegate, System.Threading.SendOrPostCallback operationCompletedCallback, System.Object userState) [0x00058] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.4.46/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs:255 
  at ProApp.PCL.EFB.Data.EfbServiceSoapClient.GetUserFilteredSessionIDAsync (System.String PartnerUser, System.String PartnerPassword, System.String CustomerUser, System.String CustomerPassword, System.Object userState) [0x0008a] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/EFB/Data/EfbService.cs:8705 
  at ProApp.PCL.EFB.Data.EfbServiceSoapClient.GetUserFilteredSessionIDAsync (System.String PartnerUser, System.String PartnerPassword, System.String CustomerUser, System.String CustomerPassword) [0x00008] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/EFB/Data/EfbService.cs:8688 
  at ProApp.PCL.EFB.Data.EfbWebClient.Login (System.String username, System.String password) [0x0002a] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/EFB/Data/EfbWebClient.cs:33 
  at ProApp.PCL.EFB.GUI.EfbTabPage..ctor () [0x00045] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/EFB/GUI/EfbTabPage.cs:17 
  at ProApp.PCL.Universal.GUI.TabView..ctor () [0x0001e] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/Universal/GUI/TabView.cs:18 
  at ProApp.PCL.App..ctor () [0x00031] in /Users/ronnie/Documents/Work/ProApp/ProApp.PCL/ProApp.cs:28 
  at ProApp.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x0004c] in /Users/ronnie/Documents/Work/ProApp/iOS/AppDelegate.cs:40 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/1977/2c66d2fe/source/maccore/src/UIKit/UIApplication.cs:63 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/1977/2c66d2fe/source/maccore/src/UIKit/UIApplication.cs:47 
  at ProApp.iOS.Application.Main (System.String[] args) [0x00008] in /Users/ronnie/Documents/Work/ProApp/iOS/Main.cs:17 

Answers

Sign In or Register to comment.