1

WP8 で Live 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

この種の動作の原因は何ですか?

4

0 に答える 0