Visual Studio 2008“随机”在测试运行时挂起

时间:2022-10-30 16:34:03

We are using VS 2008 Team System with the automated test suite, and upon running tests the test host "randomly" locks up. I actually have to kill the VSTestHost process and re-run the tests to get something to happen, otherwise all tests sit in a "pending" state.

我们正在使用VS 2008 Team System和自动测试套件,并且在运行测试时,测试主机“随机”锁定。我实际上必须杀死VSTestHost进程并重新运行测试以使某些事情发生,否则所有测试都处于“挂起”状态。

Has anyone experience similar behavior and know of a fix? We have 3 developers here experiencing the same behavior.

有没有人经历过类似的行为并知道修复?我们这里有3个开发人员遇到相同的行为。

3 个解决方案

#1


4  

This may be related to an obscure bug that causes unit tests to hang unless the computer name is UPPERCASE. Crazy, I know - but I had this problem and the fix worked for me.

这可能与导致单元测试挂起的模糊错误有关,除非计算机名称是大写的。疯了,我知道 - 但我遇到了这个问题并且解决方案对我有用。

Bug report on MS Connect
Workaround on MS Connect
TFS Blog Article about this issue
HowTo edit the registry to change your computer name

有关MS Connect的错误报告MS Connect上的解决方法TFS博客有关此问题的文章如何编辑注册表以更改您的计算机名称

The easiest approach is to tweak the registry. You need to edit two keys:

最简单的方法是调整注册表。您需要编辑两个键:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName

Change value ComputerName to be upper case in both keys, and restart. Tests then magically work.

将值ComputerName更改为两个键中的大写,然后重新启动。然后测试神奇地工作。

#2


2  

When you say lock up, do you mean VS is actually hung, or do the tests not run?

当你说锁定时,你的意思是VS实际上是挂起的,还是测试没有运行?

The easiest way to track down what is going on would be to look at a dump of the hung process. If you are on Vista, just right-click on the process and choose to create a memory dump. If you are on Windows XP, and don't have the Debugging Tools for Windows installed, you can get a memory dump using ntsd.exe. You'll need the process ID, which you can get from Task Manager by adding the PID column to the Processes tab display.

追踪正在发生的事情的最简单方法是查看挂起进程的转储。如果您使用的是Vista,只需右键单击该过程并选择创建内存转储。如果您使用的是Windows XP,并且未安装Windows调试工具,则可以使用ntsd.exe进行内存转储。您将需要进程ID,您可以通过将PID列添加到“进程”选项卡显示来从任务管理器获取该进程ID。

Once you have that, run the following commands:

完成后,运行以下命令:

ntsd -p <PID>
.dump C:\mydump.dmp

You can then either inspect that dump using WinDBG and SOS or if you can post the dump somewhere I'd be happy to take a look at it.

然后,您可以使用WinDBG和SOS检查该转储,或者如果您可以在某个地方发布转储,我很乐意看一下它。

In any case, you'll want to likely take two dumps about a minute apart. That way if you do things like !runaway you can see which threads are working which will help you track down why it is hanging.

无论如何,你可能希望在一分钟左右的时间内进行两次转储。这样,如果您执行类似!runaway的操作,您可以看到哪些线程正在工作,这将帮助您找出它挂起的原因。

One other question - are you on VS2008 SP1?

另一个问题 - 你在VS2008 SP1上?

#3


2  

I would try running the tests from the command line using MSTest.exe. This might help isolate the problem to Visual Studio, and at least give you some method of running the tests successfully.

我会尝试使用MSTest.exe从命令行运行测试。这可能有助于将问题隔离到Visual Studio,并至少为您提供一些成功运行测试的方法。

#1


4  

This may be related to an obscure bug that causes unit tests to hang unless the computer name is UPPERCASE. Crazy, I know - but I had this problem and the fix worked for me.

这可能与导致单元测试挂起的模糊错误有关,除非计算机名称是大写的。疯了,我知道 - 但我遇到了这个问题并且解决方案对我有用。

Bug report on MS Connect
Workaround on MS Connect
TFS Blog Article about this issue
HowTo edit the registry to change your computer name

有关MS Connect的错误报告MS Connect上的解决方法TFS博客有关此问题的文章如何编辑注册表以更改您的计算机名称

The easiest approach is to tweak the registry. You need to edit two keys:

最简单的方法是调整注册表。您需要编辑两个键:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName

Change value ComputerName to be upper case in both keys, and restart. Tests then magically work.

将值ComputerName更改为两个键中的大写,然后重新启动。然后测试神奇地工作。

#2


2  

When you say lock up, do you mean VS is actually hung, or do the tests not run?

当你说锁定时,你的意思是VS实际上是挂起的,还是测试没有运行?

The easiest way to track down what is going on would be to look at a dump of the hung process. If you are on Vista, just right-click on the process and choose to create a memory dump. If you are on Windows XP, and don't have the Debugging Tools for Windows installed, you can get a memory dump using ntsd.exe. You'll need the process ID, which you can get from Task Manager by adding the PID column to the Processes tab display.

追踪正在发生的事情的最简单方法是查看挂起进程的转储。如果您使用的是Vista,只需右键单击该过程并选择创建内存转储。如果您使用的是Windows XP,并且未安装Windows调试工具,则可以使用ntsd.exe进行内存转储。您将需要进程ID,您可以通过将PID列添加到“进程”选项卡显示来从任务管理器获取该进程ID。

Once you have that, run the following commands:

完成后,运行以下命令:

ntsd -p <PID>
.dump C:\mydump.dmp

You can then either inspect that dump using WinDBG and SOS or if you can post the dump somewhere I'd be happy to take a look at it.

然后,您可以使用WinDBG和SOS检查该转储,或者如果您可以在某个地方发布转储,我很乐意看一下它。

In any case, you'll want to likely take two dumps about a minute apart. That way if you do things like !runaway you can see which threads are working which will help you track down why it is hanging.

无论如何,你可能希望在一分钟左右的时间内进行两次转储。这样,如果您执行类似!runaway的操作,您可以看到哪些线程正在工作,这将帮助您找出它挂起的原因。

One other question - are you on VS2008 SP1?

另一个问题 - 你在VS2008 SP1上?

#3


2  

I would try running the tests from the command line using MSTest.exe. This might help isolate the problem to Visual Studio, and at least give you some method of running the tests successfully.

我会尝试使用MSTest.exe从命令行运行测试。这可能有助于将问题隔离到Visual Studio,并至少为您提供一些成功运行测试的方法。