Should the async compiler throw ArgumentExceptions from calling task?


the tap guidelines mention async method should throw usage errors directly method on callers task , other errors that might occur during execution assigned returnned task (page 3). seem reasonable have compiler generated async methods throw exceptions of type (or derived from) system.argumentexception on caller's task?

idea way people can follow tap guideline without having resort hybrid approach (page 8) or manual implementation. realize perhaps not usage errors argumentexceptions aren't argumentexceptions usage errors? if true, wouldn't make hybrid or manual implementation nessecary non-argumentexception usage errors instead of time?


dave

i think way it's done less surprising.

consider asynchronous operation needs take time validate parameters. in case, argumentexceptions before first await raised on caller's context, while argumentexceptions after first await raised on continuation. also, as noted, not usage exceptions argumentexceptions; it's not clear how async handle a non-argumentexception usage check came before argumentexception usage check. in summary, think semantics unintuitive.

however, come school of thought exceptions takes stand usage exceptions (a special case of boneheaded exceptions) should represented code contracts, , not particular exception type (in fact, default exception type used code contracts not catchable except general exception). following school of thought, doesn't matter if exception raised or continuation; since it's boneheaded exception, shouldn't caught anyway.

       -steve


programming blog: http://nitoprograms.blogspot.com/
  including tcp/ip .net sockets faq
  , how implement idisposable , finalizers: 3 easy rules
microsoft certified professional developer

how heaven according bible


Archived Forums V  >  Visual Studio Async CTP



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'