Async Data Access Exceptions

Async Data Access Exceptions

Old forum URL: forums.lhotka.net/forums/t/6205.aspx


TAC posted on Monday, January 19, 2009

Ok, my factory methods are Async. When one of my Data Access methods throws an exception ("Can't find data", etc) when it gets to Fetch_RunWorkerCompleted the line
var result = e.Result as DataPortalAsyncResult;
throws an TargetInvocationException (more specifically e.Result throws it)
and because of that My Method for OnFetchCompleted is never getting run.

This seems like a bug to me or is my process wrong?

(Quick note: this is all dotNet not silverlight)

RockfordLhotka replied on Tuesday, January 20, 2009

Thanks for finding this, it is a bug and I'll add it to the list.

RockfordLhotka replied on Tuesday, January 20, 2009

I fixed this for 3.6.1, and the fix is in svn. If you can grab the latest code

http://www.lhotka.net/cslacvs/viewvc.cgi/trunk/cslacs/Csla/DataPortalT.cs?view=log

and give it a try that'd be great!

TAC replied on Tuesday, January 20, 2009

Thanks for that Rocky. My solution was using a try-catch block. Same result but your way is much nicer.

Copyright (c) Marimer LLC