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"

Comments

Popular posts from this blog

AWS EC2 Can't Reach EC2 Metadata Service After Subnet Change

A2 Hosting with .NET Core 2.1

Xcode CodeSign Incorrectly States Password is Incorrect