-->

类型的“Microsoft.Live.LiveAuthException”第一次机会异常出现在msc

2019-10-19 02:10发布

我试图登录使用上WP8 SDK直播。 我能登录了几天,但现在无需对代码进行任何更改我得到一次机会异常。

使用的代码:

 try
        {
            auth = new LiveAuthClient("0000000044107D80");
            LiveLoginResult result = await auth.InitializeAsync(new string[] { "wl.basic", "wl.signin", "wl.emails" });
            if (result.Status != LiveConnectSessionStatus.Connected)
            {
                result = await auth.LoginAsync(new string[] { "wl.basic", "wl.signin", "wl.emails" });
            }
            if (result.Status == LiveConnectSessionStatus.Connected)
            {
                var connect = new LiveConnectClient(auth.Session);
                var opResult = await connect.GetAsync("me");
                dynamic nameResult = opResult.Result;
                MessageBox.Show(string.Format("Welcome, {0}", nameResult.first_name));
            }
            }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.StackTrace);
        }

堆栈跟踪:

A first chance exception of type 'Microsoft.Live.LiveAuthException' occurred in mscorlib.ni.dll
A first chance exception of type 'Microsoft.Live.LiveAuthException' occurred in mscorlib.ni.dll
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.Live.LiveAuthClient.<LoginAsync>d__c.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`1.GetResult()
at PhoneApp2.MainPage.<Login>d__4.MoveNext()

如果没有登录部分用的try / catch围绕我得到这个调试控制台上:

A first chance exception of type 'System.Reflection.TargetInvocationException' occurred    in mscorlib.ni.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in System.Windows.ni.dll

什么可能导致这种类型的行为?

文章来源: A first chance exception of type 'Microsoft.Live.LiveAuthException' occurred in mscorlib.ni.dll