4 ms·
Awaiting a storage operation (ie. look up user) in C# will allow other calls to proceed until the I/O is available to read. Synchronous code locks you into the
by asyncawaaait 6y ago
Awaiting a storage operation (ie. look up user) in C# will allow other calls to proceed until the I/O is available to read.
Synchronous code locks you into the model of handling one request per thread.
Given the minor overhead (both cognitive and runtime) of a sync/await, I can’t see why you wouldn’t want to do it here.
- balfirevic 6y agoBecause async/await infects everything it touches and forces me to spread irrelevant junk words all over the code which have nothing to do with the task I'm trying to accomplish.
- hackerfromthefu 6y agoWhat about the far worse stack traces and debugging? Whats a way to get the utility of normal debugging while using async?
- asyncawaaait 6y agoStack traces were massively improved in 2.1. Using a good IDE (Rider or Visual Studio), debugging async/await code works as expected. Are you doing interop or calling unmanaged code?
- hackerfromthefu 6y agoThanks, I will make sure to check this out. Does anyone have any articles or documentation on this?
- benaadams 6y agoStacktrace improvements in .NET Core 2.1: Intelligible stack traces for async, iterators and Dictionary (key not found) https://www.ageofascent.com/2018/01/26/stack-trace-for-exceptions-in-dotnet-core-2.1/ https://www.ageofascent.com/2018/01/26/stack-trace-for-excep...
- hackerfromthefu 6y agoAwesome! Thank you. Wonderful to see these open source contributions to .NET.