Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing method on stop debugging

I'm looking for a way to execute a method on stop debugging in an ASP.NET web application.

I have several resource releases methods that I have to execute in any way the application shuts down. (Including stop debugging (kill))

I've tried Application_End and overriding Dispose() in global.asax but they are not executing on stop debugging. Either AppDomain.CurrentDomain.ProcessExit event.

Actually it makes sense any method can not be executed while we kill the process but it might be a creative way to do so.

like image 346
Jacob Avatar asked Jun 16 '26 16:06

Jacob


1 Answers

You can't handle termination of the process from the same process which you are terminating.

To perform any tasks on stop debugging you will need another method which observes the process and executes required functions when the first process terminates.

like image 71
Abhishek Maurya Avatar answered Jun 18 '26 06:06

Abhishek Maurya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!