简体   繁体   English

通过代码随机进行单元测试调试步骤

[英]Unit Test debugging steps randomly through the code

We've got a project which has recently been upgraded from being written under VS2010 (using .net Framework 3.5) to VS2012 (using .net Framework 4). 我们有一个项目,最近已从VS2010(使用.net Framework 3.5)编写的项目升级到VS2012(使用.net Framework 4)。 We work with TFS, so older builds are available to work on. 我们使用TFS,因此可以使用较早的版本。

When debugging the VS2010 versions of the build breakpointing the <TestMethod()> methods will work, stepping into and breakpointing on the called code works, and stepping through the code from start to finish works. 在调试VS2010版本的构建断点时, <TestMethod()>方法将起作用,进入被调用的代码作品并对其断点,并从头开始逐步完成代码。

In the 2012 version, breakpoints only really work in the <TestMethod()> code. 在2012版本中,断点仅在<TestMethod()>代码中真正起作用。 Once the code leaves the <TestMethod()> area, things get odd . 一旦代码离开<TestMethod()>区域,事情就会变得奇怪 Stepping into and through the code seems to simply step to random lines in the code. 进入并遍历代码似乎只是简单地步入了代码中的随机行。 Values resolve strangely and the debugger seems to hop forward through the code largely at random. 值解析异常,调试器似乎在很大程度上随机跳转代码。 Once the debugger returns to the <TestMethod()> code area, things go back to normal, and the correct results are returned from the called functions even though the values shows during debugging were all strange. 调试器返回到<TestMethod()>代码区域后,一切恢复正常,即使在调试过程中显示的值都很奇怪,调用的函数仍会返回正确的结果。

I can't really think how to describe what's going on any better than that. 我真的想不出如何更好地描述正在发生的事情。 I'm not in charge of building the software, and the people who are aren't aware of anything that they have changed that might have caused this issue. 我不负责构建软件,并且不了解可能会导致此问题的任何更改的人。

Does any of this sound familiar enough to anyone that they can suggest what setting might have been changed to produce this behaviour, or what I need to set under .net 4 in order to get unit testing working again? 这对任何人来说听起来是否足够熟悉,以至于他们可以建议更改哪些设置以产生这种行为,或者我需要在.net 4下进行设置才能使单元测试再次正常工作?

当调试器使用的源代码与用于编译要调试的程序集的源代码不同时,通常会发生这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM