Great talk, nice walkthough of async/await. I was kind of disappointed by the lack of mention of ConfigureAwait - it's extremely important, especially in older dotnets, and can be very useful in WPF :)
Just point that the official MS documentation says: `async void` should only be used for event handlers. async void is the only way to allow asynchronous event handlers to work because events do not have return types (thus cannot make use of Task and Task). Any other use of async void does not follow the TAP model and can be challenging to use, such as: - Exceptions thrown in an async void method can't be caught outside of that method. - async void methods are difficult to test. - async void methods can cause bad side effects if the caller isn't expecting them to be async.
30:48 "not only did it change what this method returns..." indeed! The compiler _completely replaces the method body with a state machine handler_ the method becomes an incomprehensible mess of classes, secondary state machines and methods edit: ah, you demonstrate it, nice
I would also add that is good practise to provide cancellation token to every function if it's support e.g. 57:43 line 40 or in Task.Delay from 54:34 because most of libraries implement it in correct way, so e.g. we would not wait for full line when reading file or wait whole time when we use delays
20:30 "contextual keyword" does not mean "they do a lot of compiler magic to solve the same problems that we could do without async and await...". "contextual keyword" means the compiler recognises it as a keyword if encountered when expected but it is not a _reserved_ word. This means you _can_ use any of where, set, get, async, await, or, and, not as identifiers, verbatim, while you can not use the word _if_ as an identifier: at best, you can use @if
Great talk, nice walkthough of async/await. I was kind of disappointed by the lack of mention of ConfigureAwait - it's extremely important, especially in older dotnets, and can be very useful in WPF :)
Great talk!
I've been using async/await for a few years now without really understanding it, until now.
Thank you Filip!
50:08 Task.WhenAll(t1, t2) is not the same as await t1; await t2; in my opinion
Thanks for uploading these! This definitely taught me knew things about async/await!
Just point that the official MS documentation says: `async void` should only be used for event handlers.
async void is the only way to allow asynchronous event handlers to work because events do not have return types (thus cannot make use of Task and Task). Any other use of async void does not follow the TAP model and can be challenging to use, such as:
- Exceptions thrown in an async void method can't be caught outside of that method.
- async void methods are difficult to test.
- async void methods can cause bad side effects if the caller isn't expecting them to be async.
30:48 "not only did it change what this method returns..."
indeed! The compiler _completely replaces the method body with a state machine handler_
the method becomes an incomprehensible mess of classes, secondary state machines and methods
edit: ah, you demonstrate it, nice
Fantastic talk, thank you!
Conclusion: Exit from power point is harder than writing Task Parallel Library (56:29).
I would also add that is good practise to provide cancellation token to every function if it's support
e.g. 57:43 line 40 or in Task.Delay from 54:34
because most of libraries implement it in correct way, so e.g. we would not wait for full line when reading file or wait whole time when we use delays
Great talk!
Learn how to use async all the way properly and the cancelation token.
Nice talk! learned a couple of new things
47:21
if you encourage people to stop using await when no need to get the result you should mention about cons of this approach
20:30 "contextual keyword" does not mean "they do a lot of compiler magic to solve the same problems that we could do without async and await...".
"contextual keyword" means the compiler recognises it as a keyword if encountered when expected but it is not a _reserved_ word.
This means you _can_ use any of where, set, get, async, await, or, and, not as identifiers, verbatim, while you can not use the word _if_ as an identifier: at best, you can use @if
Jesus Christ :o
Why doesn't an async function automatically return a Task without having to annotate it like that?
oooooh boy
here we go
Oh desktop? Oh... (closes the video)
Nothing new 🙁 just repeated information that was already available everywhere several years ago