Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obscure error message when modifying property accessed by UI on timer thread #9984

Open
Pdawg-bytes opened this issue Sep 13, 2024 · 1 comment
Labels
area-CoreFramework Issues on fundamental components like UIElement, visibility, etc. bug Something isn't working team-Markup Issue for the Markup team

Comments

@Pdawg-bytes
Copy link

Describe the bug

Normally, when you access anything that the UI concerns from another thread, you have to go through the dispatcher. A member in the UWP Community Discord ran into this same problem, but was met with a very undescriptive error message, saying System.Runtime.InteropServices.COMException: "".

Though, I do recall seeing the proper error message before when this happened, but I don't remember how long ago that was.

Steps to reproduce the bug

https://github.com/Pdawg-bytes/WASDK-INPC-COMException-repro/tree/main
Clone this repository and run the app. Take note of the comments in App1/SystemViewModel.cs.

Expected behavior

When you attempt to access something like this, the error message should tell you that you need to use the Dispatcher to dispatch it to the UI thread.

Screenshots

Here's the undescriptive error message:
image

NuGet package version

WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@Pdawg-bytes Pdawg-bytes added the bug Something isn't working label Sep 13, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Sep 13, 2024
@codendone codendone added area-CoreFramework Issues on fundamental components like UIElement, visibility, etc. team-Markup Issue for the Markup team and removed needs-triage Issue needs to be triaged by the area owners labels Sep 13, 2024
@lolametro
Copy link

This is very annoying.

It's not clear to me why the exception text is empty, as the HResult value is properly set to -2147417842 0x8001010E RPC_E_WRONG_THREAD. The plain old Win32Exception would automatically display a message like The application called an interface that was marshalled for a different thread..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CoreFramework Issues on fundamental components like UIElement, visibility, etc. bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

3 participants