69

In Visual Studio 2010, the Step Into Property/Function (F11) doesn't work as expected.

It doesn't step into property setters or getters.

I converted the solution from Visual Studio 2005 to 2010, the function i wanted to step into is a property in a separate class library.

How can I make it work as I expect?

Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87
Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939

2 Answers2

107

In VS 2010 it is the default setting that you step over properties and operators(like F10) even if you want to step into(F11). So here is the solution:

  • Go to Tools > Options menu in Visual Studio.
  • Go to Debugging > General menu item in left pane.
  • In right view you will see an option Step over properties and operators (Managed only). Uncheck this option and then you are all set.

enter image description here

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
  • 1
    Thanks for sharing what you found. I actually found documentation on this as the first hit when I googled "visual studio 2010 step into properties" http://msdn.microsoft.com/en-us/library/cc667388.aspx. What I'm trying to figure out is when you uncheck the "Step over properties..." option, it seems to have the reverse problem: It always steps into properties, even if you use the Step Over command. Isn't there a way to control whether you step over or into a property on a line by line basis (using keyboard shortcuts) like in Visual Studio 2005? – xr280xr Apr 19 '11 at 13:24
  • @xr280xr: It works for me to hit F10 instead of F11(Step into). If the property has no explicit getter and setter then it always steps over even with F10. If it has a getter/setter F10 skips the property whereas F11 will enter the property. – Tim Schmelter Apr 19 '11 at 15:32
  • not for me. If Step over properties and operators is unchecked, F10 always steps into property getters and setters. That's what I was referring to above. Thanks for letting me know yours works correctly. This wouldn't be the first time I've had VS 2010 completely lose its mind and stop working correctly. – xr280xr Jun 06 '11 at 20:14
  • 1
    Thanks! This worked for me. although now it steps into *everything*. It's unfortunate that the default behavior isn't a little more intelligent. That is, it could step over the simplest get or set which is just a single line of code equivalent to what VS itself would generate for a property. But some setters do all kinds of things; seems odd to not step into those. – Jon Coombs Oct 12 '13 at 06:25
  • @JCoombs If you only have a small number of properties that you're interested in stepping into, you can always leave the option checked but breakpoint the property accessors. Of course, in VS2010+ the "simplest" getters and setters are the ones without a body at all, and those *are* skipped over. – MattW Nov 14 '13 at 18:56
  • @JCoombs while debugging you can right click the line and toggle the [Step over properties and operators](http://stackoverflow.com/a/21360151/641833) setting. – Trisped May 09 '14 at 19:10
  • @Trisped Thanks; that's good to know as a more convenient way of accessing that setting. But it still doesn't give me a nice middle ground. When I'm debugging someone else's code (or my own older stuff), I don't necessarily remember which getters/setters have real code in them, so I end up stepping into tons of empty ones, or else skipping them all and missing part of the execution logic while debugging. – Jon Coombs May 14 '14 at 05:37
2

Worked for me on Visual Studio 2015: I closed VS and deleted folder: .vs (hidden folder, some times together with solution file) and opened again Visual Studio.

rcarvalhoxavier
  • 331
  • 5
  • 7