Thomas Levesque 11/11/2015

Explicitly switch to the UI thread in an async method

Read Original

This technical article addresses a common challenge in C# async/await programming: resuming on the UI thread after an asynchronous operation configured not to capture the synchronization context. It explains the problem, discusses workarounds like using Dispatcher.Invoke, and introduces a more elegant solution by creating a custom awaiter for the synchronization context to enable clean thread switching.

Explicitly switch to the UI thread in an async method

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week