If you kill the process, the operating system will clear the process memory, but there will be no GC inside the .NET runtime, and no finalizers will be executed.
Edit: (the above was correct only if you killed the process, and not when using the "Final Task")
If you send “Finish task”, it will send the corresponding WM_CLOSE message box to the program and will not end the process immediately, and .NET will be able to complete the work normally.
Edit: (one more addition)
If you stop debugging, it is roughly equivalent to TerminateProcess() , which will immediately shut down the process.
source share