Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conhost process stays opens

I have an win-form c# that opens a console application. When i launch the form, which automaticly launches it opens a process

conhost.exe

I tried everything to be able to auto close it, but no solution so far. Any ideas?

this and similar code i tried:

foreach (Process proc in Process.GetProcessesByName("conhost.exe"))
{
    proc.Kill();
}
like image 387
Rien Avatar asked Oct 22 '25 14:10

Rien


1 Answers

I got to this question by a different route - working on a C# console app that was leaving conhost.exe/vhost.exe running after it should have exited.

Adding an Environment.Exit(0) at the end of processing fixed that.

like image 138
Dan Field Avatar answered Oct 25 '25 02:10

Dan Field



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!