Exception handling in CAB

Topics: CAB & Smart Client Software Factory
May 31, 2007 at 9:29 AM
In some cases, for instance a provider pattern is used to implement DAL, CAB will leave the informative exception behind and only return a general error back. The error message only says somthing like "The target of invocation has return an error". The database loggin error generated in DAL is not added to inner exception. This way make the error tracing more difficult.

I'm currently logging those db error into a log file so that I can find out what's really going wrong.

Any idea?
May 31, 2007 at 12:43 PM
This happens because the EventBroker pub/sub supports background threads(async), there isn't really a good way to assure the exception data from the publisher is there.

The way I go around it is to catch and log exceptions on an event subscriber that may throw an exception.

Hope this helps
May 31, 2007 at 7:06 PM
Thanks. Currently I do the same.

I expected the same. It can be caused by threading issue. Exception handling is do at thread level. CAB can catch the exception but it throw the most inner one away. If an exception is unhandled, the appdomain can still handle it at domain level.

So I think CAB did something strange and lost the most inner exception.