Skip to content

Invalid resourcekey generates unhelpful winrt::hresult_error exception #5442

Open
@dotMorten

Description

@dotMorten

Describe the bug

If I create a custom control and in the generic.xaml template and accidentially use a static resource that doesn't exist, I'm met with an extremely unhelpful error message:

Image

Steps to reproduce the bug

  1. Open the following project: ChatApp.zip
  2. Run the application and observe the exception

The exception is happening because in \Themes\Generic.xaml an invalid static resource in line 56 is used. The error message does nothing to help lead me to this error message. In many other cases, the error message will include the xaml line number and resource key name, but in this case a really bad crash occurs.

This is another one of the death-by-1000-razorcut issues that can significantly slow down the inner developer loop. Having more actionable errors will greatly improve the developer experience.

Expected behavior

A helpful error message that helps identify my typo and unblock me.

Screenshots

No response

NuGet package version

Windows App SDK 1.8 Experimental 2: 1.8.250515001-experimental2

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 24H2 (22621, October 2024 Update)

IDE

Visual Studio 2022

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions