NullPointerException inside RESTConnectorWP8 on App42_Unity3D_SDK_WP8_2.3.1

+1 vote

Hi guys!

Inside your DLL for WP8 on Unity3D,

When I call UserService.GetUser(), my wp8 solution get this unhandled exception:

 

Message: Object reference not set to an instance of an object.

Source: App42_Unity3D_SDK_WP8_2.3.1

StackTrace:  

 

at com.shephertz.app42.paas.sdk.csharp.connection.RESTConnectorWP8.CatchServerError(WebException e, App42CallBack requestCallback)

                at com.shephertz.app42.paas.sdk.csharp.connection.RESTConnectorWP8.<>c__DisplayClasse.<ExecuteGet>b__c(IAsyncResult results)

                at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass1d.<InvokeGetResponseCallback>b__1b(Object state2)

 

This Unhandled exception is thown on my App.xaml.cs file calling Application_UnhandledException method.

 

Can you help me?

Thanks

Dario

asked Apr 8, 2014 in AppWarp by DevLabTech (25 points)

2 Answers

+2 votes
Are you using UserService.GetUser(string user_name) or UserService.GetUser(string user_name, App42Callback callback_object)?

I've had similar issues in unity using the non-callback version, afaik you need to use the callback versions wherever possible in the Unity SDKs as the non-callback versions aren't currently Unity safe.
answered Apr 8, 2014 by knee (35 points)
I'm using the callback version.
But the problem occurs when there is no connections. When there is a connection there is no unhandled exception and it works like a charm.

my code is:

try {
       social.userService.GetUser(Username, new ExistingUserCallBack(social, Username, Password, Email));
} catch {}

the ExistingCallBack object have a constructor that receive that parameter.

I've tried to add the try-catch statement, but is useless and the App.xaml.cs call the Application_unhandledexception method that programatically add a breakpoint if the application run with debugger.

I have update your dll to 2.5.1 version and the issue is the same.
0 votes

It is clear from stack trace that some object has not been created and used as null reference. Couple of things that you have to check

  1.  Make sure you have initialize App42 API using 
  2. ServiceAPI serviceAPI = new ServiceAPI("<API_KEY>","<SECRET_KEY>");  
  3. You ahve build user service using 
  4. UserService userService = serviceAPI.BuildUserService();  
  5. And then call desired method on userService reference.
answered Apr 8, 2014 by ajay123 (899 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...