Hi @BenoitB ,
You can use Environment.Exit(0) if you can make sure that the application should be closed, such as using threads for monitoring.
But it's best to check what in your code is preventing the command line window from closing, and perhaps you can provide a piece of code that allows us to reproduce the problem.
Can your application shut down gracefully when running in debug mode?
Best Regards.
Jiachen Li
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.