Browse by Tags

Tagged Content List
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: How to get Exception.StackTrace line numbers on Windows Phone

    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 captures unhandled exceptions and invites the users to email these to me, in the hope that I can figure out what's wrong. Problem: On Windows Phone it...
  • Blog Post: 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...
  • Blog Post: 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...
  • Blog Post: Talk: The New Async Design Patterns

    Talk: The New Async Design Patterns Async involves some new concepts. They're not difficult; just unfamiliar. Over the past year I've been watching how people use it. This talk distils out the three top async patterns and anti-patterns. Async void is for top-level event-handlers only, and event...
  • Blog Post: Talk: Async Part 2 - for architects, under the hood

    Talk: Async Part 2 - for architects, under the hood This talk tackles some more advanced async topics. Async idioms - the "TAP" Task Asynchronous Pattern, when and when not to expose async APIs, the unexpected trouble with Task.Yield Integrating async into existing code - call sync from async...
  • Blog Post: How to write a custom awaiter

    [This post is part of a series How to await a storyboard, and other things ] The normal behavior of the "await" operator on a task is to suspend execution of the method; then, when the task operand has finished, to resume execution on the same SynchronizationContext and with the same ExecutionContext...
  • Blog Post: How to await a command-line process, and capture its output

    [This post is part of a series How to await a storyboard, and other things ] I want to invoke an external executable, and await until it’s finished, and get back its output. (In my case, the external executable is called “ tidy.exe ” – an excellent open-source utility for...
  • Blog Post: Await HttpClient.GetStringAsync() and cancellation

    I’m a big fan of supporting cancellation on async methods. I was recently wondering how to do this for HttpClient.GetStringAsync(). This post has some answers. Async Function TestAsync(uri As Uri , Optional cancel As CancellationToken = Nothing ) As Task ( Of String ) Dim client As...
  • Blog Post: How to await a button click

    [This post is part of a series How to await a storyboard, and other things ] Sometimes we want to await until a button has been clicked. Once place where this is useful is, for instance, when displaying the message “Click button to continue”. Await button1.WhenClicked() Why...
  • Blog Post: How to await a drag operation

    [This post is part of a series How to await a storyboard, and other things ] In my app, I want to await a drag operation. Here’s how I’d like to await it: Private Async Sub rectangle1_PointerPressed(sender As Object , e As PointerRoutedEventArgs ) Handles rectangle1.PointerPressed...
  • Blog Post: How to await a MediaElement (PlaySound in Windows 8)

    [This post is part of a series How to await a storyboard, and other things ] Let’s look at making MediaElement awaitable. This is the kind of idiom I’d like to use: Try Await mediaElement1.OpenAsync( New Uri ( "ms-appx:///Assets/boooo.mp3" )) Await mediaElement1.PlayAsync(...
  • Blog Post: How to await a storyboard, and other things

    This post is part of a series about an important new design pattern, awaiting events ... I also made a Channel9 video introduction " Async Over Events ". In this blog series: How to await a storyboard, and other things How to await a MediaElement How to await a drag operation How to await...
  • Blog Post: How to hibernate async methods (how to serialize Task)

    Sometimes people ask the question “How can I serialize a Task?” If you try, it throws a SerializationException: Dim t = TestAsync() Using stream As New MemoryStream Dim formatter As New Formatters.Binary. BinaryFormatter formatter.Serialize(stream, t) ' SerializationException...
  • Blog Post: Why must async methods return Task?

    We all know that async methods return Task or Task(Of T): Async Function GetNameAsync() As Task ( Of String ) Await Task .Delay(10) Return "ernest" End Function Sometimes, advanced users ask for the ability to return different types out of an async method. That’s disallowed: it gives the...
  • Blog Post: Async Targeting Pack

    [UPDATE: The async targeting pack has been renamed " Microsoft.Bcl.Async ". It now supports async for portable libraries] We’ve just released an " Async Targeting Pack ” [update: replaced by Microsoft.Bcl.Async ] via NuGet. It lets you use the async feature of VS11 for applications...
  • Blog Post: Talk: Async Part 1 - the message-loop, and the Task type

    Talk: Async Part 1 - the message-loop, and the Task type After giving lots of training and talks over the past two years, this is my most recent take on how to explain Async. The message-loop is fundamental. You can't understand async unless you understand the message-loop. Once you understand...
  • Blog Post: Talk: What's new in VB11 (VS11 Beta)

    Talk: What's new in VB11 This talk details some of what's new in VB11. (Just some: there were too many improvements to cover them all in just one talk). Win8 support VBCore (=> new platform support for VB on Phone, XNA, MicroFramework, Kinect, Surface...) Async CallerMemberInfo Iterators View Call...
  • Blog Post: AsyncCTP installation problems (and VS11)

    The AsyncCTP is getting a bit long in the tooth. This post is to explain how, why, and what to do. Common symptoms: AsyncCTP fails to install -- i.e. it doesn't create the "Async CTP" folder inside "My Documents", and VS doesn't recognize the async keywords. Installing VS11 causes AsyncCTP...
  • Blog Post: Async CTP v3 – installation

    The third version of the Async CTP was released on 31st October 2011. The reason for releasing v3 is to address installation issues -- a recent Windows Update had conflicted with the Async CTP v2 and stopped it working, or prevented its installation in the first place. The v3 release also contains...
  • Blog Post: Talk: How to write an [Async] connected app for Windows Phone 7.1

    Talk: How to write an [Async] connected app for Windows Phone 7.1 This talk is all about writing a connected app for the Windows Phone. The talk covered: (1) Azure/WP7 toolkit for the server-side of the phone app. Most good phone apps will need some kind of server-side component, be it for live tile...
  • Blog Post: Talk: The [Async] Future of VB and C#

    Talk: The [Async] Future of VB and C# I gave a C#-specific version of this talk at DevConnections in Las Vegas, USA on 2011.11.01 This talk is mainly about Async and goes into considerable technical depth. It also covers the new CallerInfo feature, and includes a Roslyn demo. Download...
  • Blog Post: [placeholder] How to write a connected VB phone app

    This blog article has been moved and enhanced: http://blogs.msdn.com/b/lucian/archive/2011/05/20/talk-how-to-write-an-async-connected-app-for-windows-phone-7.aspx
Page 1 of 2 (33 items) 12