Skip to content

Commit dbac15b

Browse files
Add comprehensive error handling documentation to GetAppAndOptionalStorePackageUpdatesAsync
Co-authored-by: GrantMeStrength <1928855+GrantMeStrength@users.noreply.github.com>
1 parent 192fe98 commit dbac15b

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

windows.services.store/storecontext_getappandoptionalstorepackageupdatesasync_399599716.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,68 @@ Gets the collection of packages for the current app that have updates available
1515
## -returns
1616
An asynchronous operation that, on successful completion, returns a collection of [StorePackageUpdate](storepackageupdate.md) objects that represent the packages that have updates available.
1717

18+
## -exceptions
19+
### T:System.Runtime.InteropServices.COMException
20+
21+
If the **ErrorCode** property of the exception has the value 0x80070578 (ERROR_INVALID_WINDOW_HANDLE), this indicates that the method was not called on the UI thread. If you are calling this method in a desktop application that uses the Desktop Bridge, this can also indicate that you did not configure the [StoreContext](storecontext.md) object to specify which application window is the owner window for modal dialogs shown by this method. For more information, see [this article](/windows/uwp/monetize/in-app-purchases-and-trials#desktop).
22+
23+
### T:System.Exception
24+
25+
The method may throw exceptions when the Microsoft Store service is unavailable or not properly configured. Common scenarios include:
26+
27+
- **"Object server is stopping when OLE service contacts it"**: This error typically occurs when the Microsoft Store service is not running, is shutting down, or when there are issues with the Windows Store infrastructure. This can happen if:
28+
- The Windows Store app is not installed or is corrupted
29+
- The Microsoft Store service is disabled or not running
30+
- There are permission issues accessing the Store service
31+
- The system is in an inconsistent state during shutdown or startup
32+
33+
- **Service unavailable errors**: Network connectivity issues or Microsoft Store service outages can cause the operation to fail.
34+
1835
## -remarks
1936
For more information about using this method, including a code example, see [Download and install package updates for your app](/windows/uwp/packaging/self-install-package-updates).
2037

2138
There is a latency of up to a day between the time when a package passes the certification process and when the GetAppAndOptionalStorePackageUpdatesAsync method recognizes that the package update is available to the app.
2239

2340
After you call GetAppAndOptionalStorePackageUpdatesAsync to determine which packages have updates available, you can call [RequestDownloadStorePackageUpdatesAsync](storecontext_requestdownloadstorepackageupdatesasync_889669938.md) to download the updated packages or you can call [RequestDownloadAndInstallStorePackageUpdatesAsync](storecontext_requestdownloadandinstallstorepackageupdatesasync_1750789617.md) to download and install the updated packages.
2441

42+
### Prerequisites and Environment Requirements
43+
44+
For this method to work correctly, the following conditions must be met:
45+
46+
- **Microsoft Store app**: The Microsoft Store app must be installed and functional on the system.
47+
- **Microsoft account**: While a signed-in Microsoft account is not strictly required to check for updates, certain scenarios may require authentication.
48+
- **Store services**: The Microsoft Store licensing and update services must be running and accessible.
49+
- **Network connectivity**: An active internet connection is required to communicate with the Microsoft Store service.
50+
51+
### Assigned Access Mode Compatibility
52+
53+
This method can be used in Assigned Access (kiosk) mode, but the following considerations apply:
54+
55+
- The assigned access account must have permission to access Microsoft Store services.
56+
- Network access must be configured to allow communication with Microsoft Store endpoints.
57+
- Some Store UI elements may be restricted depending on the assigned access configuration.
58+
59+
### Error Handling Recommendations
60+
61+
When calling this method, it's recommended to implement proper error handling:
62+
63+
```csharp
64+
try
65+
{
66+
var updates = await storeContext.GetAppAndOptionalStorePackageUpdatesAsync();
67+
// Process updates
68+
}
69+
catch (System.Runtime.InteropServices.COMException ex)
70+
{
71+
// Handle COM-related errors (e.g., threading issues)
72+
}
73+
catch (System.Exception ex)
74+
{
75+
// Handle Store service errors (e.g., service unavailable)
76+
// Log the error and implement appropriate retry logic
77+
}
78+
```
79+
2580
> [!IMPORTANT]
2681
> Optional packages and downloadable content (DLC) packages are not available to all developer accounts.
2782

0 commit comments

Comments
 (0)