Skip to content

Commit d993f18

Browse files
Merge pull request #2502 from MicrosoftDocs/copilot/fix-1060
Add comprehensive error handling documentation to GetAppAndOptionalStorePackageUpdatesAsync
2 parents a77436d + dbac15b commit d993f18

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,11 +15,66 @@ 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
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.
2239

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

0 commit comments

Comments
 (0)