【问题标题】:Why am I seeing multiple "The thread 0x22c8 has exited with code 259 (0x103)." messages为什么我看到多个“线程 0x22c8 已退出,代码为 259 (0x103)。”消息
【发布时间】:2014-04-19 04:15:27
【问题描述】:

我在我的 Winforms 应用程序中收到了大量这些消息,即使我从未明确创建过任何线程。为什么会这样?我四处寻找解释,但很难说出这样的询问。

我正在使用 Visual Studios 2013,这是我关心的调试输出:

The thread 0x23a4 has exited with code 259 (0x103).
The thread 0x2884 has exited with code 259 (0x103).
The thread 0x27ec has exited with code 259 (0x103).
The thread 0x1978 has exited with code 259 (0x103).
The thread 0x1534 has exited with code 259 (0x103).
The thread 0x1ad8 has exited with code 259 (0x103).
The thread 0x2938 has exited with code 259 (0x103).
The thread 0x22c8 has exited with code 259 (0x103).

【问题讨论】:

标签: c# multithreading visual-studio exit-code


【解决方案1】:

来自 MSDN 文档:

备注

此函数立即返回。如果指定的线程还没有 终止并且函数成功,返回的状态是 STILL_ACTIVE。如果线程已经终止并且函数成功, 返回的状态是下列值之一: 退出值 在 ExitThread 或 TerminateThread 函数中指定。回报 线程函数的值。线程的退出值 过程。重要 GetExitCodeThread 函数返回一个有效的 应用程序定义的错误代码仅在线程之后 终止。因此,应用程序不应使用 STILL_ACTIVE (259) 作为错误代码。如果线程返回 STILL_ACTIVE (259) 作为 错误代码,测试此值的应用程序可以解释它 表示线程仍在运行并继续测试 线程终止后线程的完成,这可能 将应用程序置于无限循环中。

所以基本上它仍然不时检查当前线程。

这似乎是一个错误:

http://connect.microsoft.com/VisualStudio/feedback/details/812144/vs2013-reports-incorrect-thread-exit-code

【讨论】:

  • 关闭这些消息很容易(我使用的是 VS 2013)。只需右键单击输出窗口并取消选中Thread Exit Messages 框。对我来说,我还必须取消选中 Module Load Messages 以整理输出。
猜你喜欢
  • 1970-01-01
  • 2014-12-06
  • 1970-01-01
  • 2012-08-23
  • 1970-01-01
  • 1970-01-01
  • 2013-09-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多