locked
Windows Store App can access OneDrive only when in debug mode RRS feed

  • Question

  • Hi,

    I am having a weird behaviour when testing my app. Launching with F5 works but if I start without debugging or launch it outside of VS through the Start Screen I can't connect to OneDrive. The part of the app that is not using OneDrive works correctly. Any idea why this is happening?

    Thanks. 


    NFG

    Thursday, April 17, 2014 2:51 AM

Answers

  • Hi Carl,

    Thanks for your attention. I finally found the problem. I was using the LoginAsync method in a dataservice class that was not running in the UI thread. Placing the code inside the RunAsync forces it to run in the UI thread and now all is working fine. What is curious is that in debug mode it was working fine.

    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                        async () => {
                            authResult = await authClient.LoginAsync(new List<string>() { "wl.signin", "wl.basic", "wl.skydrive", "wl.skydrive_update", "wl.offline_access" });
                            liveConnectClient = new LiveConnectClient(authResult.Session);
                            liveConnectAccessToken = authResult.Session.AccessToken;
                        });

    NFG


    NFG

    Friday, April 18, 2014 11:55 AM

All replies

  • Can you please be more specific? What happens when your application tries to make a call to Live Connect?  What exception do you see?  Are there any Fiddler traces you could provide of the request to Live Connect? 

    Carl Hirschman

    Thursday, April 17, 2014 5:50 PM
    Moderator
  • Hi Carl,

    Thanks for your attention. I finally found the problem. I was using the LoginAsync method in a dataservice class that was not running in the UI thread. Placing the code inside the RunAsync forces it to run in the UI thread and now all is working fine. What is curious is that in debug mode it was working fine.

    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                        async () => {
                            authResult = await authClient.LoginAsync(new List<string>() { "wl.signin", "wl.basic", "wl.skydrive", "wl.skydrive_update", "wl.offline_access" });
                            liveConnectClient = new LiveConnectClient(authResult.Session);
                            liveConnectAccessToken = authResult.Session.AccessToken;
                        });

    NFG


    NFG

    Friday, April 18, 2014 11:55 AM