In a SignalR hub, I have this:
public class MyHub : Hub
{
public override Task OnConnected()
{
return base.OnConnected();
}
}
I want to execute asynchronous code. So I added the keyword asyncas follows:
public class MyHub : Hub
{
public override async Task OnConnected()
{
var result = await MyAsyncMethod();
return base.OnConnected();
}
}
but return base.OnConnected();shows this error:
Since MyHub.OnConnected () is an async method that returns Task, a Returned keyword should not be accompanied by an expression of the object. Did you intend to return Task<T>?
How can i fix this? thank.
source
share