我在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).
Run Code Online (Sandbox Code Playgroud) 我已经设法让自己处于一个状态,我没有运行devenv的实例,但后台仍然是MyApp.vshost.exe(没有可见的窗口或控制台).
我已经尝试过TaskManager,ProcessExplorer和命令行(taskkill /F /IM MyApp.vshost.exe),没有人抱怨,命令行甚至说'PID 5824已停止',但它仍然存在.
我知道我可以重启,但我宁愿深究这一点.
它看起来不像是这个问题(http://support.microsoft.com/kb/982551),因为我可以重新启动没问题(事实上,因此无法提供任何进一步的诊断,抱歉).
编辑
这就是我进入这个泡菜的方式:

作为一个简单的例子,我有一个WPF应用程序,主窗口上有一个按钮,因此代码背后:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
async void Button_Click(object sender, RoutedEventArgs e)
{
await Task<bool>.Run(() => this.DoOnThread());
}
async Task<bool> DoOnThread()
{
Thread.CurrentThread.Name = "MyTestThread";
Thread.Sleep(1000);
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我通过VisualStudio线程窗口中断"返回true"我可以获取ThreadID,如果我继续并让代码运行完成并等待一段时间直到线程退出,我得到"线程0x9ad34已经退出代码259(0x103) )"显示在VS输出窗口中.
我做错了什么,如何确保线程退出代码为0?
Am having a problem with a BackgroundWorker getting stuck. have thrown in loads of console.writeline's to help try and narrow down where the issue is, but am getting nowhere fast.
I noticed when going back through the output, I have this message... The thread 0x2d68 has exited with code 259 (0x103)
Can anyone tell me what that means?
EDIT - Below is my full code. To give some background, this app is processing requested received from a website to deploy …