Skip to content

Instantly share code, notes, and snippets.

@dcomartin dcomartin/SyncOverAsync.cs
Last active Sep 11, 2019

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
You can’t perform that action at this time.