Running an async operation from a synchronous function

One of those things that you almost never need, but if you need it, you need it. I hit a scenario where in Windows Phone 8 app, I had to have a Protocol launch handler. If you are not familiar, the protocol launch handler in Windows Phone 8 is done by deriving from the UriMapper […]

WinRT in C++/Cx and registering and unregistering event handlers

Having to work in C++/Cx, every day I have new appreciation for C#. Things that I take for granted in C#, well, they are not straightforward C++. Take the example of event handlers. In C#, the usual way of registering and unregistering event handlers is pretty straight forward: e.g. Click += Button_click_handler and Click -= […]

Getting access to the UI dispatcher from a background thread (Win8/8.1)

I recently struggled quite a bit trying to get access to the UI dispatcher from a background thread. I had a scenario where when I receive a push notification, I had to update the XAML page UI. Obviously, I did not have access to the UI thread from the background thread so I binged quite […]

C# synchronization blocks containing await or how to lock a block with an await

Recently working on a project, I came across a scenario where I needed to lock a block so that only one thread could enter the block at a time. Simple Monitors, I thought. However as soon as I put the C# lock statement around my block, I noticed Visual Studio started complaining. The problem was […]

C#/XAML App suspend: Bug/Feature – OnNavigatedFrom called during app Suspend

Got hit by this bug in suspension manager (C# and XAML) and wanted to share it with you in case you ever hit this scenario. Recently, I have been coding an app with Azure backing and I got hit by a bunch of interesting scenarios that left me scratching my head, thinking, “Hmm, how do […]