相关疑难解决方法(0)

什么是线程退出代码?

调试时,"输出"窗口中的线程退出代码究竟是什么?它给了我什么信息?它在某种程度上是有用的还是只是一个不应该打扰我的内部东西?

The thread 0x552c has exited with code 259 (0x103).
The thread 0x4440 has exited with code 0 (0x0).
Run Code Online (Sandbox Code Playgroud)

可能有某种可能的退出代码列表及其重要性吗?

c# debugging multithreading exit-code

112
推荐指数
2
解决办法
12万
查看次数

Backgroundworker中的测试执行突然终止于具有许多childelements的元素

我的一般设置:我们编写了一个带有小gui的excel导入器,允许非程序员使用"Button.Click"等命令编写和执行gui-tests.底层框架是TestStack.White.在导入excel文件和一些其他用户交互之后,测试在System.ComponentModel.BackgroundWorker内启动,只要我不查看(或甚至与包含大量childelements的元素交互),它就可以正常工作.

但是,只要我与TestStack.White.UIItems.WindowItems.Window或具有大量元素的TestStack.White.UIItems.UIItemContainer进行交互,testexecution就会结束.

通过交互,我的意思是从简单的东西,如非空检查或分配到局部变量或类似要求它的子计数.结束测试的一些例子:1)

if(theElement != null){ //everything after this line does not happen. The operator doesn't seem to be overloaded
   doStuff(); //it never reaches this point
}
Run Code Online (Sandbox Code Playgroud)

2)

UIItemContainer pointOfInterest = theElement; //everything after this line does not happen
Run Code Online (Sandbox Code Playgroud)

3)

System.Diagnostics.Debug.WriteLine("AmountOfElements: " + UIAnchor.Items.Count); //the output doesn't come. everything after this line does not happen
Run Code Online (Sandbox Code Playgroud)

在没有数百个元素的窗口中,所有三个示例都按预期工作.

我的意思是很多元素,例如一个内部有ScrollView的Window,它有一个包含数十个甚至数百个条目的表,其中每个条目包含3-4列文本或复选框或类似的东西.

BackgroundWorkers RunWorkerCompleted以及Disposed也不会被调用.我没有得到任何异常,即使有目的地放置了try/catch块我也没有得到任何东西.调试器到达导致问题的那一行,就是这样.之后没有任何事情发生,即使等待1小时.

相反,我得到了几个不同的"线程{某些十六进制ID}已退出代码259(0x103)." 在Visual Studio的输出窗口中.这是我上次的测试执行:

The thread 0x830 has exited with code 259 (0x103).
The thread 0xfc0 has exited with code 259 (0x103). …
Run Code Online (Sandbox Code Playgroud)

c# white-framework backgroundworker ui-automation

18
推荐指数
1
解决办法
379
查看次数