I'm working with a webservice for which a proxy has been generated with the APM pattern for asynchronous calls. I didn't know this acronym, it stands for Asynchronous Programming Model ( see this blog post ) and the one with Async/Await ( and thus with tasks ) is called TAP for Task-based Asynchronous Pattern.
Anyway - I just wanted to async/await these calls and as it turns out it's super easy. Here's the method signature before:
Wrap them using Task.Factory.FromAsync:
... and you're done. Super easy - unit tests verify that it works like a charm.
Credits to Justin Lovell who helped me get started and Stephen Cleary for another great blog post.
Showing posts with label Async/Await. Show all posts
Showing posts with label Async/Await. Show all posts
Monday, June 22, 2015
Saturday, October 18, 2014
Deadlocks in Async/Await
While trying to figure out what the problem is with our app ( link ) I've been reading up on deadlocks that can occur while doing Async/Await the wrong way. Here's a very insightful article on how deadlocks occur and how they can be avoided.
Basically, if you've got async methods that you're forcing to execute synchronously ( with either .Wait or .Result ) you have to be careful. I would have considered that a code smell and as it turns out, that's true!
So check out this blog post by Stephen Cleary:
Basically, if you've got async methods that you're forcing to execute synchronously ( with either .Wait or .Result ) you have to be careful. I would have considered that a code smell and as it turns out, that's true!
So check out this blog post by Stephen Cleary:
Friday, October 17, 2014
Unresolved: Async/Await call doesn't return. Forcing sync does
We've created this WebApp a while ago that nicely implemented WebApi async calls. Everything seems to have been working fine up until a point in time in which the async/await seems to have stopped working. I can't get my head around what's happened, but the async/await calls don't seem to be returning the control. If anyone has a solution - please do let me know!
StackOverflow question here: http://stackoverflow.com/questions/26231300/async-await-call-doesnt-return-forcing-sync-does
Even Jon Skeet got involed, but didn't come up with a solution. I'm thinking it's either deadlocks (although I REALLY can't see where), or it's some configuration issue.
StackOverflow question here: http://stackoverflow.com/questions/26231300/async-await-call-doesnt-return-forcing-sync-does
Even Jon Skeet got involed, but didn't come up with a solution. I'm thinking it's either deadlocks (although I REALLY can't see where), or it's some configuration issue.
Subscribe to:
Posts (Atom)



