locked
LiveAuthClient InitializeAsync exception RRS feed

  • Question

  • Nobody is responding to my previous topic so to get noticed again I start over:

    I log all exceptions in my app (Recipe4share) and I get sometimes exceptions with LiceAuthClient. Below is the exception from my logfiles and below the exception is the code where the exception occurs:

    Object reference not set to an instance of an object.

    at Microsoft.Live.ResourceHelper.GetString(String name)  

    at Microsoft.Live.LiveAuthClient.PrepareForAsync()  

    at Microsoft.Live.LiveAuthClient.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)  

    at Recipe4share.MainPage.VB$StateMachine_18_GetUserAccountSettings.MoveNext()
        - UserID: Not Yet Available
        - TwoLetterIsoLanguageCode: nl
        - Location: MainPage - FirstRun - 2
        - Key: 2166843742246278801086644269900934838126433427517951903335

    Code in VB:

    Async Function GetUserAccountSettings() As task
    	Dim auth As New LiveAuthClient()
    	Dim initializeResult As LiveLoginResult = Nothing
    	Dim loginResult As LiveLoginResult = Nothing
    	Dim Counter As Integer = 3
    	While Counter > 0
    		Try
    			initializeResult = Await auth.InitializeAsync()
    			Exit While
    		Catch ex As Exception
    			Counter -= 1
    			If Counter = 0 Then
    				_BugReport("MainPage - FirstRun - 1", ex)
    			End If
    		End Try
    		Await Task.Delay(500)
    	End While
    	Counter = 3
    	While Counter > 0
    		Try
    			loginResult = Await auth.LoginAsync(Nothing)
    			Exit While
    		Catch ex As Exception
    			Counter -= 1
    			If Counter = 0 Then
    				_BugReport("MainPage - FirstRun - 2", ex)
    			End If
    		End Try
    		Await Task.Delay(500)
    	End While
    ...
    ...
    ...
    End Function

    The While-End While loops can be ignored because when the exception once occured, the exception keeps occuring.

    The exception looks like to occur randomly, about 10-20% of the users get the exception. Sometimes the exception occurs at "initializeResult = Await auth.InitializeAsync()" and sometimes at "loginResult = Await auth.LoginAsync(Nothing)".

     I can't reproduce the exception, but when I was last time at my mother, she couldn't use my app the way it supposed to be used. I tried several time to restart the app, but still some functions where diasabled because the app couldn't log in.

    After a reboot the problem was gone.

    When I looked at my logfiles at home, I saw that the exception occured at my mothers.

    The problem is that I can't reproduce the exception, so there is no possibility to debug well.







    Sunday, October 27, 2013 12:05 PM

All replies

  • You'll get better responses in the right forum. I'll move this over for you.

    --Rob

    Sunday, October 27, 2013 3:04 PM
  • From the stack trace, it looks happened when you have an existing InitializeAsync/LoginAsync call running. Is there a chance that your app invoke InitializeAsync or LoginAsync multiple times concurrently? Can you manage to avoid that?


    Lin Wang

    Tuesday, October 29, 2013 9:08 PM
    Moderator
  • I know now why the exception occurs:

    I can now reproduce the exception by changing my password on a second Windows 8 pc. When I then start my app on the first pc, the exception occurs,

    But now I can't figure out how to ask the user to enter the right credentials for his account when he starts my app,  but ofcourse only when needed. I tried to start the game Wordament and that app asked me to enter the right credentials before the app launches. So there is a way to detect that the account has a password change and ask the user to enter the right credentials, but how?

    Edit:

    I think I know what was missing. I didn't use a scope with the authentication. I added the right scope (wl.basic) and tried if the exception stil occurred. But now the app works just fine. I submit my app again and hope that the exceptions are gone forever...

    Edit 2:

    This was not the solution. Even the MSFT server in Redmond (IP 131.107.221.60) generated the exception this time during the app certification in step 3. Maybe MSFT can look in their log what the server exactly did and what caused the exception. This is part of my logfile:

    + 10-30-2013 19:45:14  131.107.221.60 Version: 2.1.1.11 Error message: Object reference not set to an instance of an object.
        - at Microsoft.Live.ResourceHelper.GetString(String name)   at Microsoft.Live.LiveAuthClient.PrepareForAsync()   at Microsoft.Live.LiveAuthClient.<executeauthtaskasync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)   at Recipe4share.MainPage.VB$StateMachine_6_GetUserAccountSettings.MoveNext()
        - UserID: Not Yet Available
        - TwoLetterIsoLanguageCode: en
        - Location: MainPage - FirstRun - 1
        - Key: 205452172781532727958716026691841920942114490596545756230602
    </executeauthtaskasync>
    + 10-30-2013 19:45:15  131.107.221.60 Version: 2.1.1.11 Error message: Object reference not set to an instance of an object.
        - at Microsoft.Live.ResourceHelper.GetString(String name)   at Microsoft.Live.LiveAuthClient.PrepareForAsync()   at Microsoft.Live.LiveAuthClient.<executeauthtaskasync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)   at Recipe4share.MainPage.VB$StateMachine_6_GetUserAccountSettings.MoveNext()
        - UserID: Not Yet Available
        - TwoLetterIsoLanguageCode: en
        - Location: MainPage - FirstRun - 2
        - Key: 205452172781532727958716026691841920942114490596545756230602</executeauthtaskasync>

    I stopped the app certification and hope that someone can help me out.

    @Lin Wang above:

    I inspected my app and there is no possibility that the app invokes InitializeAsync or LoginAsync multiple times.

    Edit 3:

    After some experimenting I figured out that the addition of the wl.basic scope partly solves the exceptions. When a user changed his password on a different pc, the exception won't occur anymore. But the MS certification server still caused the exception to occur, so there is another situation possible to cause the exceptions...



    Wednesday, October 30, 2013 6:07 PM
  • After 7 months I still get the same exception one in a while in my logfiles. I still can't figure out what goes wrong. In 5-10% of the attemps that a random user starts my app, he will not be able to login to my app because of the exception.

    Who recognizes the exception and has a solution?

    Thursday, June 5, 2014 9:47 AM
  • I have the same problem. Did you ever find an answer?
    Tuesday, April 21, 2015 12:50 PM
  • Unfortunately not. I gave up and think that the problem lies in Windows 8(.1) Microsoft didn't respond anymore. I thirst thought there was something wrong with my coding, but especially now you say you have the same exceptions, I believe it's a Windows 8(.1) thing...
    Tuesday, April 21, 2015 1:01 PM
  • You must fill Target domain and Redirect URL in Microsoft account developer center.

    http://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-register-microsoft-authentication/

    Saturday, April 25, 2015 6:35 PM
  • We already have done the registration. This exception does not happen every time, but still occurs frequently.
    Saturday, April 25, 2015 6:55 PM