How to ensure Dispose() is called?
I have an
This also occurs with unhandled exceptions - but I can deal with this using
The real problem is when I forcibly end the process: I needed to make sure that the test browser will also be closed, or better, that my unmanaged resources are discarded after the end of the program, whether by love or by pain.
How do I deal with this?
IDisposable class that deals with Puppeteer performing tests and it closes the browser correctly after the end of the test. The problem is that, when I'm debugging and stop the debugger, the Dispose() of this class is not invoked, and the browser remains active, until I see that I have 30 instances of browsers without a parent. I'm running in headless mode so i cant see them in the taskbar.This also occurs with unhandled exceptions - but I can deal with this using
try...catch during the test.The real problem is when I forcibly end the process: I needed to make sure that the test browser will also be closed, or better, that my unmanaged resources are discarded after the end of the program, whether by love or by pain.
How do I deal with this?