C++20 Coroutines with Awaitable Class Not Resuming Correctly in MSVC 19.30
I'm testing a new approach and I'm trying to implement I'm prototyping a solution and I've tried everything I can think of but I'm building a feature where I'm sure I'm missing something obvious here, but I'm implementing a basic coroutine using C++20 features in Visual Studio 2019 (MSVC 19.30), but I'm running into an scenario where my custom awaitable class isn't resuming as expected..... The function seems to return immediately without waiting for the awaited operation to complete, leading to unexpected behavior in my program. Here's a snippet of my code: ```cpp #include <iostream> #include <coroutine> struct Awaitable { struct promise_type { Awaitable get_return_object() { return {}; } std::suspend_never initial_suspend() { return {}; } std::suspend_always final_suspend() noexcept { return {}; } void return_void() {} void unhandled_exception() { std::terminate(); } }; bool await_ready() { return false; } void await_suspend(std::coroutine_handle<promise_type> h) { // Simulate an async operation std::cout << "Suspending...\n"; h.resume(); } void await_resume() { std::cout << "Resumed!\n"; } }; Awaitable exampleCoroutine() { co_await Awaitable(); std::cout << "Coroutine finished execution.\n"; } int main() { exampleCoroutine(); return 0; } ``` When I run this code, I see the output "Suspending..." but not "Resumed!" or "Coroutine finished execution." I expected that after the `await_suspend` method calls `h.resume()`, the coroutine should continue execution, but it appears that nothing happens afterwards. I've checked that I have the correct flags enabled for C++20 support in MSVC and that I'm using `std::coroutine` features correctly. Has anyone faced a similar scenario or can provide insights into what might be going wrong here? Is there something I'm missing regarding the coroutine's state management or the way I'm handling the awaitable? This is part of a larger service I'm building. Any pointers in the right direction? I'm developing on macOS with C++. Cheers for any assistance! I'm using C++ 3.10 in this project. Could this be a known issue? This is my first time working with C++ LTS. Could this be a known issue?