New Posts New Posts RSS Feed: Catching TaskCanceledException
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Catching TaskCanceledException

 Post Reply Post Reply
Author
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Topic: Catching TaskCanceledException
    Posted: 21-Feb-2013 at 7:37am
OK, I get it now:

The Cocktail BootstrapperBase hooks into Application.UnhandledException so any unhandled exceptions are passed to ErrorHandler.HandleError which checks the type of the exception and ignores it if it is a TaskCanceledException.

Works for me.

Greg
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 20-Feb-2013 at 2:00pm
There is no logic to be executed if the user decides to cancel, so what are you going to put in the catch? The TaskCanceledException will bubble up as an unhandled exception and ultimate ignored in the ErrorHandler. If you don't like unhandled exceptions, then you would put a try/catch around it and hand the exception directly to the ErrorHandler, where it will get ignored. 
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 20-Feb-2013 at 12:07pm
Doesn't the ErrorHandler catch it?
Back to Top
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Posted: 20-Feb-2013 at 10:34am
In StaffingResourcePhoneListViewModel, there is an Add() method which calls:

await _dialogManager.ShowDialogAsync(phoneTypeSelector, DialogButtons.OkCancel);

Shouldn't this be in a Try-Catch to catch a TaskCanceledException? It will throw this if the user clicks on cancel in the Phone type dialog.

Greg
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down