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();
}
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?
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
.
I've even tried making MyService
constructor public
and taking away all static
methods, and it still doesnt work.
Edit:
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
.
Edit 2:
I've deleted my PDB files and cleaned solution. Still nothing.
Some ideas.
Debugger.Break()
in your code instead of a breakpoint
in VSHave you been adjusting the date on your computer at all? This can really screw up a build process. If so, delete all your obj/bin folders manually and recompile.