Saturday, September 19, 2009

The Finally block is not really always guaranteed to get executed.

The Finally block is not really always guaranteed to get executed.


If any of these 3 special exceptions do happen, code in Finally won't be executed:

1) OutOfMemoryException,
2) StackOverFlowException
3)
ExecutionEngineException

Those people fortunate who experience all of these exceptions.

That means you had created some global kernel objects, they will indeed hang around and may interfere when user restarts your app. BTW, if you see a code
like catch(Exception ex) {...} or catch{...}, tell the developer that he has committed a sin.


The idea and content taken from this site http://www.shitalshah.com/blog/SomeCoolNetNuggets.aspx
-------------------
Happy programming

No comments:

Post a Comment

Ideal SQL Query For Handling Error & Transcation in MS SQL

BEGIN TRY BEGIN TRAN --put queries here COMMIT; END TRY BEGIN CATCH IF @@TRANCOUNT>0 BEGIN SELECT @@ERROR,ERRO...