Console.Clear Method (System)

K

Kerry Brown

Using Microsoft Visual C# 2005 Express [2.0.50215]
With XP Pro

Console.Clear();
used as per the the sample at
http://msdn2.microsoft.com/library/209kyy3d(en-us,vs.80).aspx

is throwing an exception :
System.IO.IOException was unhandled
Message="The handle is invalid.\r\n"
Source="mscorlib"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)

at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean&
succeeded)

at System.Console.GetBufferInfo()

at System.Console.Clear()

at TestClear.Program.Main(String[] args) in
C:\VCSharp\kwb_testing\TestClear\TestClear\Program.cs:line 34

at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)

at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)

at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

... Can anyone throw some light on this ??
Regards
Kerry
 
W

Willy Denoyette [MVP]

Kerry Brown said:
Using Microsoft Visual C# 2005 Express [2.0.50215]
With XP Pro

Console.Clear();
used as per the the sample at
http://msdn2.microsoft.com/library/209kyy3d(en-us,vs.80).aspx

is throwing an exception :
System.IO.IOException was unhandled
Message="The handle is invalid.\r\n"
Source="mscorlib"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)

at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean&
succeeded)

at System.Console.GetBufferInfo()

at System.Console.Clear()

at TestClear.Program.Main(String[] args) in
C:\VCSharp\kwb_testing\TestClear\TestClear\Program.cs:line 34

at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)

at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)

at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

... Can anyone throw some light on this ??
Regards
Kerry


Please post Beta2 questions to the VS2005 Beta forum
http://forums.microsoft.com/msdn/ , these forums are meant to support
customers for the Visual Studio 2005 Beta 2 release and are replacing the
private whidbey NG's.

That said , the sample you are refering to works for me, I guess you run a
modified version.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top