microsoft / microsoft/WindowsAppSDK

WCR: Generic COMException "[...] Not declared by app" if missing new, undocumented capability

Open
#5,594 6 comments 0 reactions 0 assignees View on GitHub
area-WCR Status: Investigating
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

When calling `ImageDescriptionGenerator.GetReadyState()`, the application throws a generic `System.Runtime.InteropServices.COMException` with the message "Unspecified error" and "Not declared by app". This lazy error appears to be related to a missing capability requirement that is missing from the [release notes](https://learn.microsoft.com/windows/apps/windows-app-sdk/experimental-channel).

> Edit: It does appear to have been [recently](https://github.com/MicrosoftDocs/windows-ai-docs/commit/2bf93c3b4026184db4305aa822de13236f615270) documented (https://learn.microsoft.com/windows/ai/apis/get-started?tabs=winget%2Cwinui%2Cwinui2#build-a-new-app). Observe, however, that the capability is buried in _getting started_ documentation and not listed in the [API documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.windows.ai.imaging.imagedescriptiongenerator.getreadystate?view=windows-app-sdk-1.7).

Observe this lazily written error has no indication of which capability is missing and the developer must guess or discover the required capability through other means.

### Steps to reproduce the bug

1. Clone `https://github.com/riverar/repro-9b6e05c1`
2. Upgrade WindowsAppSdk reference to `...-exp3` release
3. Deploy and execute app on arm64 machine

### Expected behavior

The error message should clearly indicate which capability is missing. The documentation should include all required capabilities for the AI APIs.

### Screenshots

![Image](https://github.com/user-attachments/assets/66496996-ebb3-4cea-a027-b3b1c6d45fb4)

### NuGet package version

None

### Packaging type

Packaged (MSIX)

### Windows version

Insider Build (xxxxx)

### IDE

Visual Studio 2022-preview

### Additional context

For others, the workaround is to add the new capability to your manifest.

```diff



+


```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with ImageDescriptionGenerator.GetReadyState() and the repro-9b6e05c1 project, then compare the release notes and API documentation linked in the issue. Check the packaged manifest capability configuration and reproduce the failure on the specified ARM64 Insider setup. Done means the missing capability is clearly reported and the required capabilities are documented for the AI APIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
desktop-dev, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.