When the desktop bridge application uses the update API, disconnecting the network will cause the app to crash

Victor Chen 106 Reputation points
2020-07-03T12:13:35.253+00:00

Using StoreContext.CanSilentlyDownloadStorePackageUpdates when the network is disconnected will cause the app to crash, and I try to use Try-Catch to fail to catch this exception.

In addition, when I use StoreContext.TrySilentDownloadStorePackageUpdatesAsync to download the update package, disconnecting the network at this time will also cause the APP to crash too. The following is the error log in Event Viewer:

Eventlog 1: Application: MyApp.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException at Windows.Services.Store.StoreContext.get_CanSilentlyDownloadStorePackageUpdates()

Eventlog 2: Faulting application name: MyApp.exe, version: 1.0.0.0, time stamp: 0x96223b82 Faulting module name: Windows.ApplicationModel.Store.dll, version: 10.0.19041.329, time stamp: 0x92fa3e59 Exception code: 0xc0000005 Fault offset: 0x0009fcb0 Faulting process id: 0x6d0c Faulting application start time: 0x01d6511c5d86de48 Faulting application path: C:\Program Files\WindowsApps\MyApp\MyApp.exe Faulting module path: C:\Windows\System32\Windows.ApplicationModel.Store.dll Report Id: d67098d6-39c7-4a02-a837-b523821c9ca2 Faulting package full name: MyApp Faulting package-relative application ID: App

Eventlog 3: Application: MyApp.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: exception code c0000005, exception address 7947FCB0 Stack:

Eventlog 4: Faulting application name: MyApp.exe, version: 1.0.0.0, time stamp: 0x96223b82 Faulting module name: Windows.ApplicationModel.Store.dll, version: 10.0.19041.329, time stamp: 0x92fa3e59 Exception code: 0xc0000005 Fault offset: 0x0009fcb0 Faulting process id: 0x36a0 Faulting application start time: 0x01d65131af3782e2 Faulting application path: C:\Program Files\WindowsApps\MyApp\MyApp.exe Faulting module path: C:\Windows\System32\Windows.ApplicationModel.Store.dll Report Id: 4a027389-345c-4f16-a605-276f2774c768 Faulting package full name: MyApp Faulting package-relative application ID: App

This kind of exception seems to be unable to be caught using managed code, what should I do?

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor
    2020-07-13T03:40:05.11+00:00

    Hello,

    Welcome to Microsoft Q&A!

    After discussing with other engineers, it looks like there is no other way to handle it.
    This method should be running in the background so that you could not catch it in the UI thread. It essentially bypasses any chance dev has at handling the exception.

    Our suggestion is that you need to check the network before calling this method and give a tip when calling this method to tell the user to keep network connection. And you could try to subscribe to the NetworkInformation.NetworkStatusChanged Event in your app.

    Thank you.

    0 comments No comments