VS2012断点不会击中

编程入门 行业动态 更新时间:2024-10-24 04:30:01
本文介绍了VS2012断点不会击中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个类,看起来像这样:

I have a class that looks like this:

public class MyService { private MyService(){} public static string GetStuff() { var stuffDid = new MyService(); return stuffDid.DoStuff(); } private string DoStuff() { //do stuff } //other private helpers }

很显然,我留下了很多了,但那是一般的外壳。

Obviously I left a lot out, but thats the general shell.

现在,我有一个单元测试:

Now, I have a unit test:

[Test] public void MyTest() { var results = MyService.GetStuff(); }

我把我的单元测试断点,我可以看到结果有数据。但是,我从字面上设置遍布为MyService 断点并没有被击中,除非我把它们放在一个大括号。我不能理解,因为结果有数据,我的收益语句为MyService 应击中了吧?

I set breakpoints on my unit test, and I can see that results has data. However, I set breakpoints literally all over MyService and nothing gets hit unless I put them on a curly brace. Which I can't understand since results has data, my return statements in MyService should be getting hit, right?

我缺少的东西吗?难道我完全忘记了事物的最基本的规则是什么?在为MyService 没有被击中怎么来的?如果我手动踏进去与 F11 ,它只是啤酒花周围,甚而不去直通每一行像我期望的那样。此外,当我踏上直通手动我倾向于打某些代码后我应该本来打它。而且任何开关语句似乎默认为无论第一个选项是,即使寿正在切换应明确进入不同的情况下,值。

Am I missing something? Did I completely forgot the most basic rules of something? How come nothing in MyService gets hit? And if I manually step into it with F11, it just hops around and doesnt even go thru every line like I would expect. Also when I step thru manually I tend to hit certain code after I should have hit it originally. And any switch statements seem to default to whatever the first option is, even tho the value being switched should CLEARLY enter a different case.

我甚至试图使为MyService 构造公共,并带走所有的静态方法,它仍然不工作

I've even tried making MyService constructor public and taking away all static methods, and it still doesnt work.

编辑:我的测试和核心的代码在同一个解决方案,但不同的项目(测试分别和核心)。其他测试没有问题击中核心破发点,仅此于特定的测试(即测试只测试为MyService

My Tests and 'Core' code are in the same solution, but different projects(Test and Core, respectively). Other tests don't have an issue hitting break points in Core, only this on particular test(the only test that is testing MyService.

编辑2:

我已经删除了我的PDB文件和清理解决方案仍然一无所获

I've deleted my PDB files and cleaned solution. Still nothing.

推荐答案

原来,这是涉及到代码覆盖亮。

It turns out this was related to Code Coverage being on.

关闭它固定的问题。

您可以了解如何通过下面的链接

You can find out how to disable code coverage by following below link

禁用代码覆盖率

更多推荐

VS2012断点不会击中

本文发布于:2023-11-12 04:29:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580514.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:断点

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!