You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
COMExceptions thrown by WinRT code often times only have an empty error message. This greatly impacts the developer experience, especially for beginners. To understand the error, the HResult must be researched manually, which can be confusing if you don't know what it means.
The easiest to reproduce with is when setting some WinUI component value on the wrong thread (RPC_E_WRONG_THREAD -2147417842)
I assume it is a CsWinRT bug, because the error message (The application called an interface that was marshalled for a different thread.) is correctly shown in C++ (also in the IRestrictedErrorInfo) (C++WinRT):
Description
COMExceptions thrown by WinRT code often times only have an empty error message. This greatly impacts the developer experience, especially for beginners. To understand the error, the HResult must be researched manually, which can be confusing if you don't know what it means.
The easiest to reproduce with is when setting some WinUI component value on the wrong thread (
RPC_E_WRONG_THREAD -2147417842
)I assume it is a CsWinRT bug, because the error message (
![Image](https://private-user-images.githubusercontent.com/173548087/411012791-2bfd7d01-fe16-431d-818b-e34e31edfe29.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjMyODUsIm5iZiI6MTczOTM2Mjk4NSwicGF0aCI6Ii8xNzM1NDgwODcvNDExMDEyNzkxLTJiZmQ3ZDAxLWZlMTYtNDMxZC04MThiLWUzNGUzMWVkZmUyOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxMjIzMDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ZmRjNDFkNzdmZGRjMTRmYTk5Y2ZhZjNjOWI3MThhZTQ3ZTBmMTBkZWRjYmJlNDQ4N2UxNDg1Njc0YzMzZmFjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.R3TRnScmDGBFVJ2DUA9xoQtcPlE2v2195yIfwVDHGag)
The application called an interface that was marshalled for a different thread.
) is correctly shown in C++ (also in the IRestrictedErrorInfo) (C++WinRT):Steps To Reproduce
Expected Behavior
The COMException message should contain a message.
It should be the same message as in the C++WinRT exception.
If there is no specific exception message set, it would be nice if CsWinRT could at also generate a message based on the
HResult
code as a fallback.Version Info
CsWinRT 2.2.0
Windows App SDK 1.6 or 1.7
.NET 8/9
Additional Context
No response
The text was updated successfully, but these errors were encountered: