3 ms·
You can mess up async/await in C# in exactly 0 ways. Calling .Result is just a bad practice and should never be done.
by dsirola 7y ago
You can mess up async/await in C# in exactly 0 ways. Calling .Result is just a bad practice and should never be done.
- naikrovek 7y agoUhh, I've messed it up a lot more ways than zero, and it's easy to do. In fact, doing the exact same thing in a console app and a Windows Forms app will result in a deadlock in one of them, for absolutely no obvious reason. Async and await in C# may be wonderful to some, but they are horribly broken to others.
- Const-me 7y agoI agree there're caveats, I experienced that too. I disagree they're broken. C# 7.1 introduced async main. No reason to call Task.Result in console programs. Even before that feature arrived, visual studio debugger could resolve that literally in a minute. Press F5, reproduce deadlock, you'll see exactly what's locked and why.