Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Last active September 11, 2019 01:34
Embed
What would you like to do?
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace DetectAsync
{
public class BlockingDetectorController : Controller
{
[HttpGet("/sync-over-async")]
public string SyncOverAsyncMethod()
{
MyMethodAsync().Wait();
return "Hello World";
}
public async Task MyMethodAsync()
{
// Just doing a delay here to waiting 100ms like this method actually did something
await Task.Delay(100);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment