Brian,
Yes we are having some exceptions that cause a .Net Runtime error. We have
at least one general business logic exception that we are looking into, but
we also see it in our production environment when we switch from one DB
Cluster Node to another (not all the time...but this could be to timing
issues...e.g. in the middle of a SQL Request or not when switch occurs).
[quoted text, click to view] "Brian Gideon" wrote:
> Larry,
>
> Yes. It should catch any exception thrown by OnReceiveDelegate. In
> fact, it should catch any exceptions thrown by the catch blocks of the
> inner try-catch block as well. The only way AsyncReceiveCallback can
> throw an exception is if the outer catch block generates it. Are you
> observing different behavior?
>
> Brian
>
> Larry Herbinaux wrote:
> > Note: I accidentally left out the top try:
> >
> > AsyncReceiveCallback
> > {
> > try
> > {
> > try
> > {
> > OnReceiveDelegate();
> > }
> > catch (SocketException)
> > {
> > ...
> > }
> > catch (ObjectDisposedException)
> > {
> > ...
> > }
> > catch (Exception ex)
> > {
> > ...
> > }
> > }
> > catch (Exception ex)
> > {
> > ...
> > }
> > }
> >
> >
> > "Larry Herbinaux" wrote:
> >
> > > I have built an asychronous TCP Server that uses the thread pool. I have two
> > > levels of exception handling in case the handling of the inner catch block
> > > throws an exception. The outer catch block does nothing put print a string
> > > literal to our logging mechanism. The general structure for this is:
> > >
> > > AsyncReceiveCallback
> > > {
> > > try
> > > {
> > > OnReceiveDelegate();
> > > }
> > > catch (SocketException)
> > > {
> > > ...
> > > }
> > > catch (ObjectDisposedException)
> > > {
> > > ...
> > > }
> > > catch (Exception ex)
> > > {
> > > ...
> > > }
> > > }
> > > catch (Exception ex)
> > > {
> > > ...
> > > }
> > > }
> > >
> > > The OnReceiveDelegate is what handles the application business logic and
> > > this business logic also has exception handling, but in some cases it may not
> > > catch everything. My question here is shouldn't my exception handling in the
> > > AsyncReceiveCallback method catch any unhandled exception returning from the
> > > OnReceiveDelegate method?
> > >
>