Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello guys/girls,

I am facing a really odd situation with c# console application...
The app I got uses some 3rd party component, that I don't have a control of. The only thing I know this 3rd party component fires 3 sub processes which run in their environment.
Everything is fine and run as expected, but the problem is that this 3rd party component has issues closing the processes/sub-processes and my console application does not close when it finishes performing work.
I've tried adding
C#
Environment.Exit(0)
at the end, but the console remains running and in the task manager I can see 3 processes of the same name (console app name). So after a while, when I connect to our working machine I can see tons of unclosed console windows that basically do nothing and just sit with RAM occupied.
But - when I click "X" in console window - it closes fine together with these "bogus" sub-processes without any problems...
Anyone know how could I programatically invoke "X" (close) event on the console application or close it in some guaranteed way?

Thanks!

What I have tried:

Tried calling "Environment.Exit(0)"
Posted
Updated 6-May-17 22:01pm
Comments
Menon Santosh 7-May-17 4:00am    
why don't you forcefully close that application

1 solution

you can do some thing like this

[^]
 
Share this answer
 
Comments
MK-Gii 7-May-17 4:35am    
works quiet well when I try to kill the process. But then the subprocesses exception out something. I assume this is a problem with the subprocess somewhere....
thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900