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

How to make a Win8.1 app with ScrollViewer respond to size changes

Users expect Windows8.1 apps to resize gracefully – either when they “snap” the app to a particular size, or when they change the orientation of their device. This turns out surprisingly difficult with a ScrollViewer. The details are below… Download full source code – ScrollViewerKeepPosition.zip [592k, VB, requires Win8.1/VS2013] Sorry I don’t have C# code….

0

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 do it this way? Well, if you did it…

1

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    Await DragAsync(rectangle1, e)End Sub   Here below is my implementation…

0

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() Catch ex As Exception     … End Try   Q. Why do I want to await it? Why not just…

1

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 a button-click How to await…

3