SlideShare a Scribd company logo
1 of 29
Download to read offline
Craig Dunn
Developer Evangelist
Xamarin
craig@xamarin.com
@conceptdev
C# async await
Mobile Apps
• Need responsive user interfaces
• App features are o!en dependent on:
network access
database functionality or I/O
complex processing on mobile CPUs
stuff that takes some time
• You want to run these on a different thread to keep the UI
responsive... they should be ASYNCHRONOUS!
Fast!
Long running tasks!
Threads!
All
DEMODEMO1) Download Html string
2) Download Jpeg image
3) Save to Storage
4) Return Html length
Old-style
callbacks
1) Download Html string
2) Download Jpeg image
3) Save to Photo Album
5) Error Handling
4) Return Html length
6) InvokeOnMainThread
Callback Hell
1) Download Html string
2) Download Jpeg image
3) Save to Photo Album
5) Error Handling
4) Return Html length
6) InvokeOnMainThread
Callback Hell
Old-style
callbacks
Old-style callbacks
• Spaghetti code:
Callbacks are the new “GOTO”
Control flow jumps around in ways that are difficult to read
& understand from the source
Error handling is difficult to implement, required in many
different places
Changes in the chain can have unintended consequences
http://tirania.org/blog/archive/2013/Aug-15.html
What is “async”?
• Tasks running outside of the main program flow
• Code runs on another thread, so the UI doesn’t block/freeze
• Completion runs on the calling thread, so if you started on the
UI that’s where you’ll be a!er the async task is complete
• async and await syntax in C# 5 takes Task support to the next
level!
Frameworks need to support it on long running tasks
Task Parallel Library (TPL)
has been around a while
.NET BCL APIs
• Lots of .NET APIs support async; for example:
HttpClient.GetStringAsync()
HttpClient.PostAsync()
FileStream.ReadAsync()
FileStream.CopyToAsync()
• and many more...
Windows Store and Phone apps
only have async APIs
Xamarin.iOS
• updated iOS APIs to be async; some examples:
ALAssetsLibrary.WriteImageToSavedPhotosAlbumAsync()
ALAsset.SetImageDataAsync()
SKStoreProductViewController.LoadProductAsync()
CLGeocoder.GeocodeAddress()
NSUrlConnection.SendRequestAsync()
and many more... 174 async iOS native APIs
Xamarin.Android
• updated Android APIs to be async; some examples:
Android.Net.Http.AndroidHttpClient.ExecuteAsync()
Android.Bluetooth.BluetoothServerSocket.AcceptAsync()
Android.Graphics.BitmapFactory.DecodeFileAsync()
Android.Locations.Geocoder.GetFromLocationAsync()
Java.IO.File.ListAsync()
and many more... 337 async Android native APIs
Xamarin APIs
• Xamarin.Mobile
Geolocator.GetPositionAsync()
Contact.SaveThumbnailAsync()
• Xamarin.Auth
FormAuthenticator.SignInAsync()
Request.GetResponseAsync(cancellationToken)
• and many more...
Xamarin cross-platform libraries
Xamarin Component Store
• Many components already
offer async APIs, eg. Parse!
Powerful, easy to use components
http://components.xamarin.com
USING ASYNC
async, await, cancellation and error handling
Comparison
1) Download Html string
2) Download Jpeg image
3) Save to Photo Album
5) Error Handling
4) Return Html length
6) InvokeOnMainThread
Callback Hell
Comparison
1) Download Html string
2) Download Jpeg image
3) Save to Photo Album
5) Error Handling
4) Return Html length
6) InvokeOnMainThread
Callback Hell
1) Download Html string
2) Download Jpeg image
3) Save to Photo Album
5) Error Handling
4) Return Html length
Comparison
Async-ified
6) InvokeOnMainThread
1) Download Html string
2) Download Jpeg image
3) Save to Photo Album
5) Error Handling
4) Return Html length
Comparison
6) InvokeOnMainThread
one place
not required
Async-ified
Comparison
1) Download Html string
2) Download Jpeg image
3) Save to Photo Album
5) Error Handling
4) Return Html length
6) InvokeOnMainThread
old new!
Compiler Magic
http://msdn.microso!.com/en-us/library/vstudio/hh191443.aspx
LOL =D
Compiler Magic
• async keyword informs the compiler that this method needs to be
“munged” (my term)
• await keyword indicates a suspension point where a callback
needs to be generated, along with error handling
• Continuations are generated a!er each suspension point
• Error handling (support for enclosing try-catch) is taken care of
• All you need to remember is async and await
and use Tasks
How to use: async?
• async modifier on methods, lambdas and anonymous methods
use Async suffix, eg LoadAsync, SendAsync
return Task or Task<T> preferably
- Task for methods that don’t return a value
- Task<T> to return a value
- void for event handlers only!
void for event handlers
How to use: await?
• await keyword on awaitable objects (Tasks)
only within an async context
marks a suspension point - control is returned to caller
can’t be used in catch or finally blocks
Task, Task<T> or a custom type
get a reference
to the Task first
... or just await
How to use: error handling?
• async Task or Task<T>
Returned Task State == Faulted
Exception re-thrown when task is awaited
• async void methods (event handlers)
Exception is thrown on the current synchronization context
and the app will crash...
• Cancellation is optional
provide another Async method, usually an overload, that
takes a CancellationToken parameter
caller uses the token
async tasks complete with Faulted state (time for this to
happen isn’t guaranteed)
Cancellation.None means it won’t be cancelled by the
caller
How to use: cancellation?
• Progress reporting is optional
provide another Async overload with an IProgress<T>
parameter
basic Progress<T> implementation can be used
exposes EventHandler<T> ProgressChanged
How to use: progress reporting?
send events to
track progress
BONUS: Combinators
• Wait on multiple tasks
Task.WhenAll (IEnumerable<Task>)
- requires all the tasks to be completed
Task.WhenAny(IEnumerable<Task>)
- returns when any of the tasks completes
this kind of
loop fine for
small numbers
of Tasks
WARNING: Await, and UI, and deadlocks
http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115163.aspx
Don’t await... give it a try
• Available in .NET 4.5 for Windows Store apps, Windows 8,
Windows Phone, etc.
• Also available programming in C# iOS & Android using Xamarin!
xamarin.com/download
Questions?
Developer Evangelist
Xamarin
craig@xamarin.com
@conceptdev
Craig Dunn

More Related Content

Viewers also liked

Using Async in your Mobile Apps - Marek Safar
Using Async in your Mobile Apps - Marek SafarUsing Async in your Mobile Apps - Marek Safar
Using Async in your Mobile Apps - Marek Safar
Xamarin
 
C# Delegates and Event Handling
C# Delegates and Event HandlingC# Delegates and Event Handling
C# Delegates and Event Handling
Jussi Pohjolainen
 

Viewers also liked (11)

Async Await for Mobile Apps
Async Await for Mobile AppsAsync Await for Mobile Apps
Async Await for Mobile Apps
 
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at XamarinC# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
 
Asynchronous programming from Xamarin Hakcday in Melbourne
Asynchronous programming from Xamarin Hakcday in MelbourneAsynchronous programming from Xamarin Hakcday in Melbourne
Asynchronous programming from Xamarin Hakcday in Melbourne
 
Evolution of C# delegates
Evolution of C# delegatesEvolution of C# delegates
Evolution of C# delegates
 
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
C# Async on iOS and Android - Miguel de Icaza, CTO of XamarinC# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
 
Using Async in your Mobile Apps - Marek Safar
Using Async in your Mobile Apps - Marek SafarUsing Async in your Mobile Apps - Marek Safar
Using Async in your Mobile Apps - Marek Safar
 
Async await...oh wait!
Async await...oh wait!Async await...oh wait!
Async await...oh wait!
 
The Future of C# and .NET Framework
The Future of C# and .NET FrameworkThe Future of C# and .NET Framework
The Future of C# and .NET Framework
 
C# Delegates and Event Handling
C# Delegates and Event HandlingC# Delegates and Event Handling
C# Delegates and Event Handling
 
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio CodePython 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code
Python 개발자를 위한 최상의 무료 개발 도구 Visual Studio와 Visual Studio Code
 
C# Delegates
C# DelegatesC# Delegates
C# Delegates
 

More from Craig Dunn

iOS & Android apps using Parse and Xamarin
iOS & Android apps using Parse and XamariniOS & Android apps using Parse and Xamarin
iOS & Android apps using Parse and Xamarin
Craig Dunn
 
OzAltNet Fast-ANDroid-furious
OzAltNet Fast-ANDroid-furiousOzAltNet Fast-ANDroid-furious
OzAltNet Fast-ANDroid-furious
Craig Dunn
 
OzAltNet Fast-ANDroid-furious
OzAltNet Fast-ANDroid-furiousOzAltNet Fast-ANDroid-furious
OzAltNet Fast-ANDroid-furious
Craig Dunn
 

More from Craig Dunn (20)

Visual Studio for Mac (AltConf 2017)
Visual Studio for Mac (AltConf 2017)Visual Studio for Mac (AltConf 2017)
Visual Studio for Mac (AltConf 2017)
 
EastBay.net Building Mobile Apps with Xamarin and Visual Studio
EastBay.net Building Mobile Apps with Xamarin and Visual StudioEastBay.net Building Mobile Apps with Xamarin and Visual Studio
EastBay.net Building Mobile Apps with Xamarin and Visual Studio
 
Introduction to iOS 9 (Xamarin Evolve 2016)
Introduction to iOS 9 (Xamarin Evolve 2016)Introduction to iOS 9 (Xamarin Evolve 2016)
Introduction to iOS 9 (Xamarin Evolve 2016)
 
Xamarin for iOS developers
Xamarin for iOS developersXamarin for iOS developers
Xamarin for iOS developers
 
Introduction to Xamarin.Forms 2.x
Introduction to Xamarin.Forms 2.xIntroduction to Xamarin.Forms 2.x
Introduction to Xamarin.Forms 2.x
 
Xamarin DevDays Portland - iOS 9
Xamarin DevDays Portland - iOS 9Xamarin DevDays Portland - iOS 9
Xamarin DevDays Portland - iOS 9
 
Wearables with C# and Xamarin
Wearables with C# and XamarinWearables with C# and Xamarin
Wearables with C# and Xamarin
 
What's New Xamarin.Forms 1.3
What's New Xamarin.Forms 1.3What's New Xamarin.Forms 1.3
What's New Xamarin.Forms 1.3
 
Your First Xamarin.Forms App
Your First Xamarin.Forms AppYour First Xamarin.Forms App
Your First Xamarin.Forms App
 
Introduction to iOS with C# using Xamarin
Introduction to iOS with C# using XamarinIntroduction to iOS with C# using Xamarin
Introduction to iOS with C# using Xamarin
 
Introduction to Android with C# using Xamarin
Introduction to Android with C# using XamarinIntroduction to Android with C# using Xamarin
Introduction to Android with C# using Xamarin
 
iOS & Android apps using Parse and Xamarin
iOS & Android apps using Parse and XamariniOS & Android apps using Parse and Xamarin
iOS & Android apps using Parse and Xamarin
 
Azure Mobile Services - more than just cloud data
Azure Mobile Services - more than just cloud dataAzure Mobile Services - more than just cloud data
Azure Mobile Services - more than just cloud data
 
Cloud-enabling iOS & Android apps with C# (using Xamarin)
Cloud-enabling iOS & Android apps with C# (using Xamarin)Cloud-enabling iOS & Android apps with C# (using Xamarin)
Cloud-enabling iOS & Android apps with C# (using Xamarin)
 
Cloudy with a Chance of Cross Platform (for Bay.NET)
Cloudy with a Chance of Cross Platform (for Bay.NET)Cloudy with a Chance of Cross Platform (for Bay.NET)
Cloudy with a Chance of Cross Platform (for Bay.NET)
 
Xamarin v.Now
Xamarin v.NowXamarin v.Now
Xamarin v.Now
 
Mono for Android... for Google Devs
Mono for Android... for Google DevsMono for Android... for Google Devs
Mono for Android... for Google Devs
 
PassKit on iOS6
PassKit on iOS6PassKit on iOS6
PassKit on iOS6
 
OzAltNet Fast-ANDroid-furious
OzAltNet Fast-ANDroid-furiousOzAltNet Fast-ANDroid-furious
OzAltNet Fast-ANDroid-furious
 
OzAltNet Fast-ANDroid-furious
OzAltNet Fast-ANDroid-furiousOzAltNet Fast-ANDroid-furious
OzAltNet Fast-ANDroid-furious
 

Recently uploaded

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 

C# 5 async-await (for EastBay.NET)

  • 2. Mobile Apps • Need responsive user interfaces • App features are o!en dependent on: network access database functionality or I/O complex processing on mobile CPUs stuff that takes some time • You want to run these on a different thread to keep the UI responsive... they should be ASYNCHRONOUS! Fast! Long running tasks! Threads! All
  • 3. DEMODEMO1) Download Html string 2) Download Jpeg image 3) Save to Storage 4) Return Html length
  • 4. Old-style callbacks 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length 6) InvokeOnMainThread Callback Hell
  • 5. 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length 6) InvokeOnMainThread Callback Hell Old-style callbacks
  • 6. Old-style callbacks • Spaghetti code: Callbacks are the new “GOTO” Control flow jumps around in ways that are difficult to read & understand from the source Error handling is difficult to implement, required in many different places Changes in the chain can have unintended consequences http://tirania.org/blog/archive/2013/Aug-15.html
  • 7. What is “async”? • Tasks running outside of the main program flow • Code runs on another thread, so the UI doesn’t block/freeze • Completion runs on the calling thread, so if you started on the UI that’s where you’ll be a!er the async task is complete • async and await syntax in C# 5 takes Task support to the next level! Frameworks need to support it on long running tasks Task Parallel Library (TPL) has been around a while
  • 8. .NET BCL APIs • Lots of .NET APIs support async; for example: HttpClient.GetStringAsync() HttpClient.PostAsync() FileStream.ReadAsync() FileStream.CopyToAsync() • and many more... Windows Store and Phone apps only have async APIs
  • 9. Xamarin.iOS • updated iOS APIs to be async; some examples: ALAssetsLibrary.WriteImageToSavedPhotosAlbumAsync() ALAsset.SetImageDataAsync() SKStoreProductViewController.LoadProductAsync() CLGeocoder.GeocodeAddress() NSUrlConnection.SendRequestAsync() and many more... 174 async iOS native APIs
  • 10. Xamarin.Android • updated Android APIs to be async; some examples: Android.Net.Http.AndroidHttpClient.ExecuteAsync() Android.Bluetooth.BluetoothServerSocket.AcceptAsync() Android.Graphics.BitmapFactory.DecodeFileAsync() Android.Locations.Geocoder.GetFromLocationAsync() Java.IO.File.ListAsync() and many more... 337 async Android native APIs
  • 11. Xamarin APIs • Xamarin.Mobile Geolocator.GetPositionAsync() Contact.SaveThumbnailAsync() • Xamarin.Auth FormAuthenticator.SignInAsync() Request.GetResponseAsync(cancellationToken) • and many more... Xamarin cross-platform libraries
  • 12. Xamarin Component Store • Many components already offer async APIs, eg. Parse! Powerful, easy to use components http://components.xamarin.com
  • 13. USING ASYNC async, await, cancellation and error handling
  • 14. Comparison 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length 6) InvokeOnMainThread Callback Hell
  • 15. Comparison 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length 6) InvokeOnMainThread Callback Hell
  • 16. 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length Comparison Async-ified 6) InvokeOnMainThread
  • 17. 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length Comparison 6) InvokeOnMainThread one place not required Async-ified
  • 18. Comparison 1) Download Html string 2) Download Jpeg image 3) Save to Photo Album 5) Error Handling 4) Return Html length 6) InvokeOnMainThread old new!
  • 20. Compiler Magic • async keyword informs the compiler that this method needs to be “munged” (my term) • await keyword indicates a suspension point where a callback needs to be generated, along with error handling • Continuations are generated a!er each suspension point • Error handling (support for enclosing try-catch) is taken care of • All you need to remember is async and await and use Tasks
  • 21. How to use: async? • async modifier on methods, lambdas and anonymous methods use Async suffix, eg LoadAsync, SendAsync return Task or Task<T> preferably - Task for methods that don’t return a value - Task<T> to return a value - void for event handlers only! void for event handlers
  • 22. How to use: await? • await keyword on awaitable objects (Tasks) only within an async context marks a suspension point - control is returned to caller can’t be used in catch or finally blocks Task, Task<T> or a custom type get a reference to the Task first ... or just await
  • 23. How to use: error handling? • async Task or Task<T> Returned Task State == Faulted Exception re-thrown when task is awaited • async void methods (event handlers) Exception is thrown on the current synchronization context and the app will crash...
  • 24. • Cancellation is optional provide another Async method, usually an overload, that takes a CancellationToken parameter caller uses the token async tasks complete with Faulted state (time for this to happen isn’t guaranteed) Cancellation.None means it won’t be cancelled by the caller How to use: cancellation?
  • 25. • Progress reporting is optional provide another Async overload with an IProgress<T> parameter basic Progress<T> implementation can be used exposes EventHandler<T> ProgressChanged How to use: progress reporting? send events to track progress
  • 26. BONUS: Combinators • Wait on multiple tasks Task.WhenAll (IEnumerable<Task>) - requires all the tasks to be completed Task.WhenAny(IEnumerable<Task>) - returns when any of the tasks completes this kind of loop fine for small numbers of Tasks
  • 27. WARNING: Await, and UI, and deadlocks http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115163.aspx
  • 28. Don’t await... give it a try • Available in .NET 4.5 for Windows Store apps, Windows 8, Windows Phone, etc. • Also available programming in C# iOS & Android using Xamarin! xamarin.com/download