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

How to OnReceived with Async? #311

Open
vanhaodev opened this issue Aug 12, 2024 · 1 comment
Open

How to OnReceived with Async? #311

vanhaodev opened this issue Aug 12, 2024 · 1 comment

Comments

@vanhaodev
Copy link

    protected override async void OnReceived(byte[] buffer, long offset, long size)
    {
        
        base.OnReceived(buffer, offset, size);
    }

Should I set async for base method?

@shersh
Copy link

shersh commented Sep 19, 2024

No. Never do async void

If you don’t even get the task back. You have no way of knowing when the function’s task has completed. —— Crash course in async and await | The Old New Thing

https://learn.microsoft.com/en-us/archive/msdn-magazine/2013/march/async-await-best-practices-in-asynchronous-programming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants