Monday, June 10, 2019

VB.NET Exit Sub Finally

I have a recurring VB.NET application that will start every 15 minutes. However, as a precaution, the next scheduled instance of the application will immediately exit if the previous instance is still running.

To keep track of the status of the application, I put a code in the finally block that will update the status to stopped and save it to the database.

I noticed that somehow the status of the application was stopped but the application still running in the task manager. There is no background worker so it should exit when the status is updated. It turns out that the subsequent instance update the status when it exited due to finally block is always executed even on "Exit Sub"

No comments:

Post a Comment