Async workflow [how to hibernate async methods, part 2]

Four years ago I’d written a post “How to hibernate async methods (how to serialize a task)“. I decided to dig it up and improve it. Here’s what I can now write with it: await AlphaAsync().RunWithCheckpointing(“a.json”); // This kicks off the async method. But it allows the async method to // serialize its state to…

8

Talk: architecture for a connected device+cloud app

How do you write a “connected device+cloud” app that works, and doesn’t crash when the user walks out of network coverage? How can you make an “offline mode” that still syncs properly with the cloud? I’m passionate about correct distributed programming. Here are some slides I made: slides.pptx [500k] the transcript is in the “notes” section…

1

Exception.StackTraceEx – better exception stacktrace for async code

Last year I wrote about getting good exception stack traces for async code. Now I’ve cleaned it up, made into a Portable Class Library, published the source code it under MIT-license on github and made precompiled binaries available as a NuGet package.   To recap: the goal is to get a user-experience like this, including…

1

Mr Flakey — helps you write robust async code

(Update: Mr Flakey asked me to tell everyone that he’s now available as a NuGet package)   It’s a fact of life that network operations might fail. I wanted to check that my client apps behave correctly even if calls to REST services fail. So here’s what I do: Dim r = Await http.GetStringAsync(uri).Flakey() I wrote…

3

Async re-entrancy, and the patterns to deal with it

What should we do in case of re-entrancy? For example, if the user clicks the button twice in rapid succession then this code will give this the wrong answer: async  void  ButtonClick( object  s,  EventArgs  e) {      await  FooAsync(); }  async  Task  FooAsync() {    var  x = ReadEntry();    await  Task .Delay(100);    WriteEntry(x + 1); }   There are several patterns to…

7

Talk: Async best practices

I’ve talked about async best practices a lot, and each time I’ve tried to refine the talk a little further. Here’s the best I can explain how to use async effectively! online videos on Channel9 slides.pptx [6.1mb] source code.zip [430k, some in VB requires VS2012+Windows8 or higher, some in C# requires VS2013 or higher] transcript.docx…

10

Talk: Async Codegen

Talk: Async Codegen In October 2011, as we were developing async, I prepared this super low-level talk so that my colleagues on the compiler and CLR/JIT teams would understand what code the compiler generates for async methods. It’s deep, and technical, and not of practical use to most people who just use async. But if…

0

How to get Exception.StackTrace line numbers on Windows Phone

(update: I’ve written an updated blog post about this. Also I made it available on NuGet as package AsyncStackTraceEx. And published the source code under MIT license on Github.)  Scenario: I’ve written my app and released it to users. Some of them have reported crashes but I don’t know where. So I released an update which…

3

Talk: The Complete Async — three talks from TechEd Europe 2013

I gave three talks on Async at TechEd Europe. These cover everything you need to know about async, from beginner to advanced.   Intro: Using Async in Windows 8. This introductory talk introduces how to use async, the connection between IAsyncOperation and Task, and how to cancel an async operation. Watch video online Download slides.pptx…

3

MVVM with Async – sample code

How do you combine MVVM with async? — Well, really, there’s not much to it. Just the same as always. Here’s an example Silverlight MVVM project. It first shipped with the Async CTP, and I’ve updated it to use VS2012 and Microsoft.Bcl.Async. Download AsyncMVVM-Silverlight-VB.zip [2mb, requires VS2012] Download AsyncMVVM-Silverlight-CS.zip [2mb, requires VS2012] One thing that…

2