heisenbug

Program and debugger quit without indication of problem

心不动则不痛 提交于 2019-11-27 04:46:31
OK, not quite a Heisenbug but similar in nature. I'm developing a WPF application. When debugging, the logic reaches a certain point, then the application quits for no reason. VS debugger catches nothing and the only indication of a problem is the following in the output window: The program '[6228] SomeApp.vshost.exe: Managed (v4.0.30319)' has exited with code 1073741855 (0x4000001f). When debugging the release version, or indeed running the debug build out of the debugger (in fact all combos that aren't running the debug version in debugger), everything works fine. I'm trying to catch

$LastExitCode=0, but $?=False in PowerShell. Redirecting stderr to stdout gives NativeCommandError

扶醉桌前 提交于 2019-11-26 18:44:33
Why does PowerShell show the surprising behaviour in the second example below? First, an example of sane behaviour: PS C:\> & cmd /c "echo Hello from standard error 1>&2"; echo "`$LastExitCode=$LastExitCode and `$?=$?" Hello from standard error $LastExitCode=0 and $?=True No surprises. I print a message to standard error (using cmd 's echo ). I inspect the variables $? and $LastExitCode . They equal to True and 0 respectively, as expected. However, if I ask PowerShell to redirect standard error to standard output over the first command, I get a NativeCommandError: PS C:\> & cmd /c "echo Hello