C# and VB – towards joining F# with asynchronous programming support

I am very pleased to report that a vision of the future of C# and Visual Basic was outlined today where they are moving to join F# in offering what I call language-integrated asynchronous programming support. This was outlined today at PDC10 by Anders Hejlsberg, the designer of C# and Technical Fellow at Microsoft, along with follow up videos from key contributors Mads Torgersen, Lucian Wischik and Stephen Toub.

The proposed design of C# and VB asynchronous programming is pleasant and simple, and heavily inspired by the corresponding feature of F#. I have been a long advocate of improving all .NET languages (cooperatively 🙂 ) and the F# team have been at the forefront of the long and difficult road of proving the viability and importance of language-integrated asynchronous programming both in and outside Microsoft – I still remember TechEd Barcelona 2007 where I first talked about the feature and the nerves I had in explaining this to the professional developer audience. It is a great relief to see this journey heading towards the eventual addition of asynchronous programming to C# and VB, and humbling to see the clear and simple ways the C# and VB team have found to disseminate this idea.

Most critically, this development has the potential to push compositional, structured asynchronous programming through the design of the .NET platform itself, something which will greatly benefit all languages and .NET programmers. The critical task for the C# and VB teams has been to refine the basic idea of language-integrated asynchronous programming support to fit closely with .NET tasks (generally a good thing), and to ensure a very good fit with the C# and VB languages and compilation expectations. Hopefully this will also lead to many improvements with debugging and other critical aspects as well. 

One topic we’ll be talking about over the next few months is ensuring smooth interoperability between the F# and the C#/VB models. This looks like it will be smooth and simple without losing the essence of what makes F# async programming particularly effective in interactive and functional programming. Interestingly, the C# and VB material tends to emphasize asynchrony in user interface programming, something often under-emphasized in my own F# material, though others such as Tomas Petricek have looked at this closely.

If you are interested in how the two models relate, please read Tomas Petricek’s blog series on this topic.  Even if you’re a C# or VB programmer, we’d encourage you to learn both the C#/VB and F# models, how differ, and how they interoperate. In addition, F# asynchronous programming ships today in Visual Studio 2010, and allows you to use asynchronous programming on .NET 2.0, 3.5, 4.0 and Windows Phone 7

If you’re interested in a more academic perspective, Tomas is also the co-author of the paper The F# Asynchronous Programming Model, a simple summary of F# asynchronous programming, along with Dmitry Lomov. And for a real walk on the async wild-side, try joinads. C# and VB asynchronous programming also rests heavily on .NET 4.0 tasks, themselves based on work by Daan Leijen of Microsoft Research. Microsoft Research are proud to be at the heart of language innovation at Microsoft, from .NET Generics to LINQ to Asynchrony and beyond.


Comments (7)

  1. Blake says:

    Obviously some plumbing is required to connect their GetAwaiter() approach, but that doesn't seem difficult at first blush.    I'm more concerned about the general conceptual impedance mismatch between 'cold' Async<T> and 'hot' Task<T>.   Is this an already solved problem within the various MSR & DevDiv groups?

  2. Jon Harrop says:

    Does this mean C# and VB will now also be relying upon tail call elimination in the VM?

  3. Blake says:

    Completely off-topic for this post… but wow!   Just finished watching the F# 3.0 talk and all I can say is, I want those bits yesterday!  Extremely, extremely cool.   There are immediately half a dozen things I want to do with this.

  4. Dirk says:


    The most anticipated video of the conference (for me at least :-)) does not play…


    The Future of F#: Data and Services at your Fingertips

    It is not available somewhere else, by any chance?

  5. Dirk says:

    Hurray, it's online now!

  6. Don Juan says:

    Nice presentation Don and some very innovative ideas by the F# team.

    Any chance that you would be posting your easy chart program that you used in the demo? It would be great to see that or even an explanation of some of the code, for us new to programming and have chosen F# as our first language 🙂

  7. Mike Gale says:

    It's satisfying to see collaborative development in language design.

    Freedom from "not invented here" will ultimately help all programmers who need to use multiple languages.

    Congratulations to all the language teams who are making this happen.  (Interoperability is vital for all our sakes.)