- Problem: In
winrt::impl::promise_base::set_completed, there is an unqualified call toinvoke()that intended to resolve towinrt::impl::invokebut instead resolves tostd::invokedue to argument-dependent lookup. - Cause: In C++17, coroutines were an experimental feature and the first type in
Args1...wasstd::experimental::coroutine_traits. After promoting coroutines out of the experimental namespace in C++20,stdnamespace was added to the argument-dependent lookup search, resulting instd::invokebeing found. - Solution for older version: To fix the issue in an older version of C++/WinRT without upgrading, one can put a better
invokein the searched-in namespaces. For example, declare a version ofinvokein thewinrt::Windows::Foundationnamespace that is considered better thanstd::invoke(with a non-deduced finalstatusparameter) before includingwinrt/Windows.Foundation.h. If using WIL, includewil/cppwinrt.hbefore any C++/WinRT header. Then implement theinvokeby forwarding towinrt::impl::invokeand assert that the C++/WinRT version is pre-bug-fix. - Author: Raymond Chen has been involved in Windows evolution for over 30 years. His Web site The Old New Thing grew popular and led to a book. He occasionally appears on the Windows Dev Docs Twitter account.
- Namespace details: Technically,
winrt::implandwil::detailsnamespaces are for internal use and not supposed to be relied on as they can change. But in this case, they are stable within the context of the fix as thestatic_assertwill fire once the header is upgraded, indicating the fix is no longer needed.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用。你还可以使用@来通知其他用户。