I don’t understand why async or tasks are this fucking hard
I mean – conceptually everything seems to be easy,
but almost all people that I’ve witnessed that go beyond doing very simple stuff like await dbContext.GetSomethingAsync() – let it be professional devs, lecturers, amateurs – almost everybody is always fucking up something “subtle” in their code

The only very proficent people that actually understood those nuances that I’ve witnessed were outliers, really strong devs, like think of conference speakers (but not those that sell you some tech)
even OP after using .GetAwaiter().GetResult() said I do believe that there is probably a better way of doing this

There are countless stories about deadlocks and stuff
There’s shitton of mysteries about Wait(), GetResult() and there probably is a whole fucking book about just synchronization context
Just check this one blog post from
https://devblogs.microsoft.com/dotnet/configureawait-faq/
It’s relatively huge.

Where this complexity and trickery when it comes to using this stuff actually comes from??
Yeah it’s interesting. Swift, which is just about to get async/await now, will take a slightly different approach with more enforced structure. There will be pros and cons, but one pro should be that it’s simpler and easier to use correctly.
/u/ExeusV, I have found an error in your comment:
“sell your [you’re] some tech”

I consider the post by you, ExeusV, invalid; it should say “sell your [you’re] some tech” instead. ‘Your’ is possessive; ‘you’re’ means ‘you are’.
This is an automated bot. I do not intend to shame your mistakes. If you think the errors which I found are incorrect, please contact me through DMs or contact my owner EliteDaMyth!

This was super useful for me. I was always unsure about the execution order and this cleared it up perfectly. Thanks

source