This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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