facebook-csharp-sdk/facebook-winclient-sdk

crash when cancelling login in Windows 8

Closed this issue · 2 comments

Hi!

I have the following code:

        facebookAppId="xxxxxxxxxxxxx";
        facebookSessionClient=new FacebookSessionClient(facebookAppId);

        string message = String.Empty;
        try
        {
            session = await facebookSessionClient.LoginAsync("user_about_me,read_stream");
        }
        catch (InvalidOperationException ee)
        {
            message = "Login failed! Exception details: " + ee.Message;
            var dialog = new Windows.UI.Popups.MessageDialog (message);
            dialog.ShowAsync();
        }

run in Windows 8. The code works correctly if I login, or if I press ESCAPE or the back button.

However if I press the "Cancel" button instead of the facebook Login button, my app crashes without going through the InvalidOperationException .

In fact, LoginAsync calls ProptOAuthDialog, and returns an authResult where authResult.AccessToken is null. This makes the FacebookClient constructor throw a NullRefException.

I don't know if this can be considered a bug, but either the code must be changed, or the Windows 8 sample must be changed (crashes the app right now cancelling the login)

Thanks!
Kak

Looking.

@KakCAT duplicate of #21