在 C# 程序中,main
抛出异常时定义的退出代码是什么?我知道您可以通过多种方式设置退出代码,如 this excellent answer 中所述。 .但令我感到非常惊讶的是,当从 main 中抛出异常时,我无法找到关于退出代码的 值被定义为 的文档。是否有一个标准来定义在这种情况下退出代码的值,或者它是否取决于操作系统(或机会,或其他任何东西)?
最佳答案
我观察到 -532462766
PS C:\Projects\Throw\Throw\bin\Debug> .\Throw.exe
Unhandled Exception: System.Exception: Exception of type 'System.Exception' was thrown at Throw.Program.Main(String[] args) in c:\Projects\Throw\Throw\Program.cs:line 13
PS C:\Projects\Throw\Throw\bin\Debug> $LASTEXITCODE
-532462766
关于c# - 从 main 中抛出异常的 C# 程序的退出代码是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43195148/