O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exception Behavior

During the discussion about the APM and the EAP, you saw how dealing with errors can be tricky. The problem with those patterns lies in their multiphased nature, where exceptions can occur at various stages. In the world of the APM, exceptions can come out during Begin and End method calls. When using the EAP, exceptions can occur during the Async start operation, but can be reported through the Completed event arguments as well.

For the TAP, things are much simpler. Other than method parameter usage exceptions (such as ArgumentException), no errors should be raised when invoking the TAP method. Instead, all exceptions have to be propagated through the returned task object. Users of the method can inspect the returned task ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required