On Sun Nov 2 18:45:06 2025 +0000, Piotr Caban wrote:
It looks like on vccorlib140 side there's something along these lines:
static void DECLSPEC_NORETURN throw_exception(struct Exception *excp, const cxx_exception_type *type) { /* Thrown exceptions have a refcount of 2. */ __TRY { IInspectable_AddRef(&excp->IInspectable_iface); _CxxThrowException(&excp, type); } __FINALLY_CTX(throw_exception_finally, &excp->IInspectable_iface); }I guess it tries to workaround some kind of refcounting error in older C-runtime/some kind of app. I'm not sure if it makes sense to replicate it as long as there's no application that depends on it. How about removing AddRef call from throw_exception helper?
The bug in vcruntime140 is caused by difference in __C_specific_handler (between ntdll and C-runtime). It looks like native is sometimes destroying the exception object there. It's not specific to WinRT exceptions.