J
jehugaleahsa
Hello:
Has anyone ever noticed that when you stop the debugger that
destructors (Finalize) are not called?
I have some code that is supposed to register for an event on a
database. In order for the code not to leave residual records on the
database, I have to unregister when the code ends.
However, when I hit Stop on the debugger, it appears as though the
clean-up code is never called. I have tied implementing IDisposable
and have written a Destructor.
However, when I looked on the database, the registration rows still
appear. It leads me to believe the destructors and disposal methods
are not called at all!
The oddity of this whole arrangement is that it would seem that code
inside finally blocks do get executed. However, I am managing my
registration with a class, so finally is not an option.
BTW, if the code ends naturally, everything gets cleaned up fine.
Does anyone know why this is happening?
Thanks,
Travis
Has anyone ever noticed that when you stop the debugger that
destructors (Finalize) are not called?
I have some code that is supposed to register for an event on a
database. In order for the code not to leave residual records on the
database, I have to unregister when the code ends.
However, when I hit Stop on the debugger, it appears as though the
clean-up code is never called. I have tied implementing IDisposable
and have written a Destructor.
However, when I looked on the database, the registration rows still
appear. It leads me to believe the destructors and disposal methods
are not called at all!
The oddity of this whole arrangement is that it would seem that code
inside finally blocks do get executed. However, I am managing my
registration with a class, so finally is not an option.
BTW, if the code ends naturally, everything gets cleaned up fine.
Does anyone know why this is happening?
Thanks,
Travis