i am running a c# wpf application as a console application so i have both ,a wpf and console window .
i want the console window to hide on a button click in wpf window and reappear on another click .i don't want the window to close and open again,i just want to show/hide the window on button click so that i can see the debug messages when i click on the button .
I asked the question about how to open/close the console window programatically , and here is the solution How to open/close console window dynamically from a wpf application? . But opening and closing gives me a exception every-time when the console window is cloase and a console.writeline function is called .