You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exception when running Minecraft Console Client as a script #8
When starting MCC through a script / redirected input, the following exception occurs:
Unhandled exception. System.TypeInitializationException: The type initializer for 'ConsoleInteractive.InternalContext' threw an exception.
---> System.IO.IOException: The handle is invalid.
at System.ConsolePal.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
at System.Console.get_BufferWidth()
at ConsoleInteractive.InternalContext..cctor() in C:\mcc-repos\Minecraft-Console-Client\ConsoleInteractive\ConsoleInteractive\ConsoleInteractive\InternalContext.cs:line 14
--- End of inner exception stack trace ---
at ConsoleInteractive.ConsoleBuffer.DrawPrefix() in C:\mcc-repos\Minecraft-Console-Client\ConsoleInteractive\ConsoleInteractive\ConsoleInteractive\ConsoleBuffer.cs:line 200
at ConsoleInteractive.ConsoleReader.KeyListener(Object cancellationToken) in C:\mcc-repos\Minecraft-Console-Client\ConsoleInteractive\ConsoleInteractive\ConsoleInteractive\ConsoleReader.cs:line 86
at System.Threading.Thread.StartCallback()
Activity
breadbyte commentedon Aug 10, 2022
The error here is that
GetBufferWidthis returning an invalid handle.Checking if the console input is redirected using
Console.IsInputRedirectedmay be useful for creating code paths for when input is redirected.This might require major changes in the way we handle printing to the console if
GetBufferWidthand/orGetBufferLengthis inaccessible.breadbyte commentedon Dec 6, 2022
Found out that running a debugging session through VS Code also triggers this.
Useful, since we don't have to fire up a docker instance for testing.
We could make a separate handler in MCC- this requires us to expose a
IsConsoleInteractiveproperty or something similar.