I\'ve read the advice many times from people smarter than me, and it has few caveats: Always use ConfigureAwait(false)
inside library code. So I\'m
Example from http://blogs.msdn.com/b/pfxteam/archive/2012/01/20/10259049.aspx
... logically you can think of the following code:
await FooAsync(); RestOfMethod();
as being similar in nature to this:
var t = FooAsync(); var currentContext = SynchronizationContext.Current; t.ContinueWith(delegate { if (currentContext == null) RestOfMethod(); else currentContext.Post(delegate { RestOfMethod(); }, null); }, TaskScheduler.Current);
which means you should have your context back after the await myLib.DoThingAync();
call.