BUG REPORT: Crash would occur when there is a network error [Windows Store App, Live SDK 5.5] RRS feed

  • Question

  • We are using Live SDK 5.5 on Windows Store apps, and found a serious bug that would crash the app every time.

    Let's have a simple one page app that lets the user sign on to OneDrive.  After signing on, a button click to invoke GetAsync("/me/skydrive/quota") to get the quota.  

    This would work just fine normally.  However, when there is a network error _after_ the sign-on completes, the subsequent GetAsync() call would generate a System.NullReferenceException within Microsoft.Live.dll that cannot be caught by the user's code.  This would cause the app to crash every time.  This problem would also occur on other SDK calls such as BackgroundUploadAsync()

    The network error that would cause this can be anything that makes the computer loose its Internet connection (for instance, the router drops the computer, or the ISP is having an issue).  Therefore, we believe this is pretty serious problem that would impact the reliability of every app that uses the Live SDK.  For example, when the app is doing a BackgroundUploadAsync(), which could take a long time to complete, and the network disconnects, the app would just crash.

    Exception Detail:

    Application: LiveSDKTest.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException Stack: at System.Net.ServicePoint.ConnectSocketCallback(System.IAsyncResult) at System.Net.LazyAsyncResult.Complete(IntPtr) at System.Net.ContextAwareResult.Complete(IntPtr) at System.Net.LazyAsyncResult.ProtectedInvokeCallback(System.Object, IntPtr) at System.Net.Sockets.Socket.ConnectCallback() at System.Net.Sockets.Socket.RegisteredWaitCallback(System.Object, Boolean) at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(System.Object, Boolean)

    public sealed partial class MainPage : Page { public LiveAuthClient mAuthClient = null; public MainPage() { this.InitializeComponent(); } protected override async void OnNavigatedTo(NavigationEventArgs e) { mAuthClient = new LiveAuthClient(); try { LiveLoginResult loginResult = await mAuthClient.LoginAsync(new string[] { "wl.signin", "wl.skydrive_update" }); if (loginResult.Status == LiveConnectSessionStatus.Connected) { mMsgTextBlock.Text = "Signed In"; mGetAsyncButton.Visibility = Windows.UI.Xaml.Visibility.Visible; mInstrTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { mMsgTextBlock.Text = "Sign In Failed"; } } catch (Exception ex) { mMsgTextBlock.Text = "Sign In Failed: " + ex.Message; } } private async void mGetAsyncButton_Click(object sender, RoutedEventArgs e) { LiveConnectClient connectClient = null; try { if (mAuthClient != null && mAuthClient.Session != null) connectClient = new LiveConnectClient(mAuthClient.Session); string queryString = "/me/skydrive/quota"; IDictionary<string, object> resultObj = null; LiveOperationResult result = await connectClient.GetAsync(queryString); resultObj = result.Result; if (resultObj != null) { if (resultObj.ContainsKey("available") && resultObj.ContainsKey("quota")) { object obj = resultObj["quota"]; double quota = Convert.ToDouble(resultObj["quota"]); double available = Convert.ToDouble(resultObj["available"]); mMsgTextBlock.Text = "Done: " + quota; } } } catch (LiveConnectException ex) { mMsgTextBlock.Text = "LiveConnectException ex: " + ex.Message; } catch (TaskCanceledException ex) { mMsgTextBlock.Text = "TaskCanceledException ex: " + ex.Message; } catch (Exception ex) { mMsgTextBlock.Text = "Exception ex: " + ex.Message; } } }


        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <TextBlock x:Name="mMsgTextBlock" HorizontalAlignment="Left" Margin="23,191,0,0" TextWrapping="Wrap" Text="OneDrive Signin... please wait" VerticalAlignment="Top" FontSize="22"/>

            <Button Visibility="Collapsed" x:Name="mGetAsyncButton" Content="GetAsync" HorizontalAlignment="Left" Margin="20,389,0,0" VerticalAlignment="Top" Click="mGetAsyncButton_Click"/>
            <TextBlock x:Name="mInstrTextBlock" Visibility="Collapsed" HorizontalAlignment="Left" Margin="23,293,0,0" TextWrapping="Wrap" Text="Simulate a network failure by disabling the network adapter, then click GetAsync.  The app crashes." VerticalAlignment="Top" FontSize="22"/>


    Thursday, April 10, 2014 6:16 AM

All replies

  • Thanks for reporting the issue. I have tried to run the scenario, like disable network or unplug the cable, but did not see what you get. Can you provide more details on how to repro the issue?


    Lin Wang

    Friday, April 11, 2014 8:12 PM
  • Thanks for looking into this.  Here are the steps to reproduce:

    1. Start the app, and complete the OneDrive Sign-In (This is what the OnNagivatedTo() function does in the sample code attached).

    2. Disable the network (in my case, just disable the Wi-Fi).

    3. Click the button within the app that invokes mGetAsyncButton_Click(), which will attempt to get data from OneDrive.  The app would crash at this stage.  As you can see from the sample code, the exception cannot be caught.

    We can reproduce the issue on various device, including ARM-based Surface, x86-based tablet, etc.  If you give us an email address, we can forward you the sample code within a VS solution.



    Saturday, April 12, 2014 3:58 AM
  • I tried your repro steps, but not able to receive a crash.

    Here is an example I tried: http://1drv.ms/1gu0irY

    Let me know if you can repro with this sample. You can also upload your test code.


    Lin Wang

    Monday, April 14, 2014 6:04 AM