Skip to content

How to OnReceived with Async? #311

Open

Description

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

Should I set async for base method?

Activity

  1. shersh commented on Sep 19, 2024

    @shersh

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions