简体   繁体   English

Process.ExitCode属性返回的错误退出代码

[英]Incorrect Exit Code returned by Process.ExitCode Property

I have a native C++ application that I am running as a process during the execution of a C++/CLI application and I am seeing some strange behaviour with the exit code. 我有一个本机C ++应用程序,在执行C ++ / CLI应用程序的过程中,我正在作为一个进程运行,并且看到退出代码有一些奇怪的行为。 I expect the exit code to be 0 when the process exits correctly but Process.ExitCode returns -529697949. 我期望当进程正确退出时退出代码为0,但Process.ExitCode返回-529697949。 However, when I debug the C++ application I can see that the exit code being returned is actually 0. Why would the Process.ExitCode property not match this value? 但是,当我调试C ++应用程序时,我可以看到返回的退出代码实际上为0。为什么Process.ExitCode属性与此值不匹配?

The absolute most important assumption to make when a program misbehaves is to never assume it is a bug in code that's used by hundreds of thousands of programmers and runs on half a billion machines. 程序失常时要做出的绝对最重要的假设是, 永远不要假设它是数十万程序员使用并运行在十亿台计算机上的代码错误。 Assume it is a problem in your program first. 假设首先在您的程序中有问题。

Armed with that knowledge, take a better look at the number. 有了这些知识,就可以更好地了解数字。 A good strategy when the number looks large and random is always to convert it hex. 当数字看起来很大且随机时,一个好的策略总是将其转换为十六进制。 -529697949 = 0xe06d7363. -529697949 = 0xe06d7363。 Shazam, magic number, googles well too. Shazam,不可思议的数字,Google也很好。 That's the value of a Windows exception code. 这就是Windows异常代码的价值。 e0 makes it a fatal error, 6d7363 are ASCII codes that spell "msc". e0导致致命错误,6d7363是拼写为“ msc”的ASCII码。

Your program crashed on an unhandled C++ exception. 您的程序由于未处理的C ++异常而崩溃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM