https://bugs.winehq.org/show_bug.cgi?id=37644
Bug ID: 37644 Summary: .NET 3.5 crash when running System.Console.Clear() Product: Wine Version: 1.7.30 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: james@jameswarner.us Distribution: ---
Created attachment 50099 --> https://bugs.winehq.org/attachment.cgi?id=50099 Example program, source code to said program and output log
When running System.Console.Clear() under .NET 3.5 in WINE (installed in a clean .wine through Winetricks), it will crash with: Unhandled Exception: System.IO.IOException: Invalid handle.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded) at System.Console.Clear()
This can be reproduced by running System.Console.Clear() under any application in .NET 3.5.
Attached is a demo application to reproduce this, the source code to produce this issue and the log generated.
WINE version: 1.7.30 under Debian (sid) x86.
https://bugs.winehq.org/show_bug.cgi?id=37644
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian@fds-team.de
https://bugs.winehq.org/show_bug.cgi?id=37644
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |dotnet Status|UNCONFIRMED |NEW CC| |focht@gmx.net Summary|.NET 3.5 crash when running |.NET console applications |System.Console.Clear() |using | |System.Console.Clear() | |crash when directly started | |in terminal Ever confirmed|0 |1
--- Comment #1 from Anastasius Focht focht@gmx.net --- Hello folks,
no need to go with .NET Framework 3.5 since 'System.Console.Clear' is present starting with .NET Framework 2.0.
A 32-bit WINEPREFIX with .NET 2.0 will do too for reproducing.
--- snip --- $ WINEDEBUG=+tid,+seh,+relay wine ./ConsoleClear.exe >>log.txt 2>&1 ... 002a:Call KERNEL32.GetStdHandle(fffffff5) ret=0037a26e 002a:Ret KERNEL32.GetStdHandle() retval=00000004 ret=0037a26e ... 002a:Call KERNEL32.GetConsoleScreenBufferInfo(00000004,0033f248) ret=0037a315 002a:Ret KERNEL32.GetConsoleScreenBufferInfo() retval=00000000 ret=0037a315 002a:Call KERNEL32.GetLastError() ret=0037a31b 002a:Ret KERNEL32.GetLastError() retval=00000006 ret=0037a31b 002a:Call KERNEL32.GetStdHandle(fffffff4) ret=0037a26e 002a:Ret KERNEL32.GetStdHandle() retval=00000008 ret=0037a26e 002a:Call KERNEL32.GetLastError() ret=0037a274 002a:Ret KERNEL32.GetLastError() retval=00000006 ret=0037a274 002a:Call KERNEL32.GetConsoleScreenBufferInfo(00000008,0033f248) ret=0037a315 002a:Ret KERNEL32.GetConsoleScreenBufferInfo() retval=00000000 ret=0037a315 002a:Call KERNEL32.GetLastError() ret=0037a31b 002a:Ret KERNEL32.GetLastError() retval=00000006 ret=0037a31b 002a:Call KERNEL32.GetStdHandle(fffffff6) ret=0037a26e 002a:Ret KERNEL32.GetStdHandle() retval=0000001b ret=0037a26e 002a:Call KERNEL32.GetLastError() ret=0037a274 002a:Ret KERNEL32.GetLastError() retval=00000006 ret=0037a274 002a:Call KERNEL32.GetConsoleScreenBufferInfo(0000001b,0033f248) ret=0037a315 002a:Ret KERNEL32.GetConsoleScreenBufferInfo() retval=00000000 ret=0037a315 002a:Call KERNEL32.GetLastError() ret=0037a31b 002a:Ret KERNEL32.GetLastError() retval=00000006 ret=0037a31b ... 002a:Call KERNEL32.FormatMessageW(00003200,00000000,00000006,00000000,00155518,00000200,00000000) ret=0037a408 002a:Ret KERNEL32.FormatMessageW() retval=00000011 ret=0037a408 ... 002a:Call KERNEL32.RaiseException(e0434f4d,00000001,00000001,0033f0f4) ret=79f97065 002a:trace:seh:raise_exception code=e0434f4d flags=1 addr=0x7b83b1d3 ip=7b83b1d3 tid=002a 002a:trace:seh:raise_exception info[0]=80070006 002a:trace:seh:raise_exception eax=7b826e65 ebx=7b8be000 ecx=80070006 edx=0033f038 esi=0033f0d4 edi=0033f0a0 002a:trace:seh:raise_exception ebp=0033f078 esp=0033f014 cs=0023 ds=002b es=002b fs=0063 gs=006b flags=00000283 002a:trace:seh:call_stack_handlers calling handler at 0x79f9a3c8 code=e0434f4d flags=1 ... System.IO.IOException: Invalid handle.
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 WINETest.Program.Main(String[] args)002a:Ret KERNEL32.WriteFile() retval=00000001 ret=7a0d6e22 --- snip ---
Starting the .NET console app directly from terminal creates a bare console. Since your app relies on extended CUI functionality (screen buffer) it needs to be run with with 'wineconsole' which provides this.
Use 'start.exe' helper which automatically does this for you ('CREATE_NEW_CONSOLE' ensures this because app is of 'IMAGE_SUBSYSTEM_WINDOWS_CUI' type).
--- snip --- $ wine start ConsoleClear.exe --- snip ---
IMHO no bug here. In case you have a GUI project (WinForms project) and want to do console debug/output, allocate a console with AllocConsole().
Regards
https://bugs.winehq.org/show_bug.cgi?id=37644
Jacek Caban jacek@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |54e117018cd4cc58c258da92686 | |bfad13946bde2 Resolution|--- |FIXED CC| |jacek@codeweavers.com
--- Comment #2 from Jacek Caban jacek@codeweavers.com --- Fixed in git: https://source.winehq.org/git/wine.git/commitdiff/54e117018cd4cc58c258da9268...
https://bugs.winehq.org/show_bug.cgi?id=37644
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.18.