Using Thread.Sleep() inside an async method is a bad idea. await Task.Delay() is a drop-in replacement. It would be great to have an analyzer rule (and an accompanying code fix) to catch accidental use of Thread.Sleep.
Back on the old AsyncUsageAnalyzers repo, there was this discussion: DotNetAnalyzers/AsyncUsageAnalyzers#2
And also a related PR: DotNetAnalyzers/AsyncUsageAnalyzers#50
Is vs-threading the right place for an analyzer like this?
Using
Thread.Sleep()inside anasyncmethod is a bad idea.await Task.Delay()is a drop-in replacement. It would be great to have an analyzer rule (and an accompanying code fix) to catch accidental use ofThread.Sleep.Back on the old AsyncUsageAnalyzers repo, there was this discussion: DotNetAnalyzers/AsyncUsageAnalyzers#2
And also a related PR: DotNetAnalyzers/AsyncUsageAnalyzers#50
Is vs-threading the right place for an analyzer like this?