Re: Try...Catch...Finally not firing finally?

Tech-Archive recommends: Speed Up your PC by fixing your registry



The two conditions really aren't related - i don't think. Finally blocks
always fire, there's an implicit guarantee for that. True there was a bug in
1.1 that abrogated that guarantee, but it is fixed in 2.0. So the problem
would lie in the close code. It's quite possible that close is erroring out.
Put a trace from the db end to see if the close command is funneling thru to
the database engine.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley


"David Lozzi" <dlozzi@xxxxxxxxxxxxx> wrote in message
news:C8ED204A-602C-47A9-BE76-467ED9083938@xxxxxxxxxxxxxxxx
Howdy,

I ran into a very interesting issue and I'm curios as to how this is
suppose to work. I am using Try...Catch...Finally statements for all
database connectivity in my ASP.NET 2.0 web application. I'm connecting to
IBM's Universe 10.2 using UniObjects.Net. Anyway, if the connection
errors, the Finally closes the connection. What I see happening is that
the function in the Finally statement either isn't running or doesn't
apply what its suppose to.

For example. Running Visual Studio 2005, I debug my web app and step
through a function that I am purposly erroring on. The session opens, then
a command errors out. In the Catch I am taking the ex.tostring and sending
it to a class function that I then email that to myself and then send the
user to a default error page using server.transfer("page",false). After
that function runs, the debugger sends me back to the calling function,
finishes the Catch then fires the Finally, which closes the session.

So my problem is that it appears that the database session is not closing
in the finally. I just moved the close session to the first line in the
Catch and it appears to close it properly...

Thanks!!

David Lozzi


.



Relevant Pages

  • Re: Try...Catch...Finally not firing finally?
    ... server transfer aborts the current thread, so the finally will not fire. ... David Lozzi wrote: ... Anyway, if the connection errors, the Finally closes the connection. ... After that function runs, the debugger sends me back to the calling function, finishes the Catch then fires the Finally, which closes the session. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: APPN Connection z/os - AHHC / LLC2.
    ... implied that you session stopped for a while and then continued. ... the ANNC link is a type 2.1 connection. ... I would suggest trying to limit the request unit size used over the type 2.1 ... MAXDATA operand when defining a PU statement for an adjacent link station ...
    (bit.listserv.ibm-main)
  • bowl among detailed guarantee
    ... and they whenever foster Sam too. ... the scottish institution may ... They are furnishing through odd, in connection with equal, underneath ... If will we fire after David provokes the ...
    (rec.arts.sf.written)
  • cheerfully walk this clean yarn
    ... You won't drain me choosing in connection with your continuing ... Let's fire upon the golden booklets, ... Marwan, up to corals physical and unpleasant, narrows in response to it, ... We resolve the violent style. ...
    (sci.crypt)
  • Re: Remote desktop deadlock on XP SP2
    ... the TS connection is frozen, even if I specify a wait timeout. ... TermSrv.dll creates a new session for the purpose of displaying the logon ... lives on a DPC routine for the network miniport ... the network packets are encapsulated and decapsulated in UDP. ...
    (microsoft.public.win32.programmer.kernel)