An alternative to ConfigureAwait(false) everywhere

One of the general recommendations you may often read is to use ConfigureAwait(false) in library code. This is so that when the library is used, it does not block the synchronization context in use by the application (e.g. the UI thread). If the library doesn’t know anything about the app, it doesn’t depend on the…

16

Asynchronous infinite loops instead of timers

Did it occur to you that an infinite loop, with async/await inside it, isn’t really an infinite loop? It looks like one (which is usually bad) but because of the asynchrony, we know that it isn’t executing the entire method at one time. Part executes now, then sometime later it periodically resumes – that sounds kind…

2

Waaaaay oversimplified async/await plumbing

Often, when someone asks “how does this async await stuff actually work”? There is a lot of hand waving or someone says “just use reflection and look at it” but the real compiled code is a complex recursive state machine. So I want to show a (relatively) simplified example that isn’t the real thing but…

0

Tasks are (still) not threads and async is not parallel

I talk to a lot of developers who are either new to .NET or are moving from an older version to the newer platform and tools. As such I’m always trying to think of new ways to describe the nature of Tasks vs Threads and async vs parallel. Modern .NET development is steeped in the…

12

Tasks and awaits and Rx! (And Drones!) Oh My!

A few people I work with are tinkering with an off-the-shelf drone in our spare time and so we are writing a C# library to control it. The way it works is you send UDP commands to the drone and you receive a stream of status & navigation UDP packets from it. So everything is…

2