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