Just that. I found a similar question here : c# console, Console.Clear problem
but that didn’t answer the question.
UPDATES :
Console.Clear() throws : IOException (The handle is invalid)
The app is a WPF app. Writing to the console however is no problem at all, nor is reading from.
Console.Clear()works in a console application.When Calling
Console.Clear()in a ASP.NET web site project or in a windows forms application, then you’ll get the IOException.What kind of application do you have?
Update:
I’m not sure if this will help, but as you can read in this forum thread,
Console.Clear()throws an IOException if the console output is being redirected. Maybe this is the case for WPF applications? The article describes how to check whether the console is being redirected.