4

I have a partial class split into 5 files of various names. I need to step into the code of one of the methods, but the debugger seems to always jump over them. Every other line works fine (including the constructor for that class), but the methods in the class all get skipped over. I've tried:

  1. Cleaning the solution
  2. Deleting the .sou files
  3. Deleting the bin and obj folders
  4. Restarting Visual Studio
  5. Restarting my machine
  6. All of the above again, several times.

I can only guess that the debugger has trouble with partial classes in general. Is there some workaround for this other than moving all of the code into one file?

Stephen Collins
  • 3,523
  • 8
  • 40
  • 61
  • 1
    I have many partial classes split over many *.cs files, and have never had problems with the debugger because of that. But I'm at a loss as to what to suggest. Maybe dissassemble the exe file using ILDAsm and see if the methods the debugger ignores are flagged with different attribute keywords? Or try to examine the pdb file so see if information is missing? (But I don't know how you examine a pdb.) – RenniePet Sep 23 '14 at 19:00
  • Try Googling "examine pdb file" maybe. For example http://www.codeproject.com/Articles/37456/How-To-Inspect-the-Content-of-a-Program-Database-P – RenniePet Sep 23 '14 at 19:03
  • Is any of the code auto-generated? – joelsand Sep 23 '14 at 19:12
  • Another link regarding examining the pdb file http://www.voyce.com/index.php/2012/09/24/examining-pdb-files-with-dbh/ Apropos, does the debugger let you set breakpoints in the methods, even though it won't step into them? – RenniePet Sep 23 '14 at 19:15
  • Yes, I can set breakpoints, and again, it will break in the constructor, but not in any other methods. – Stephen Collins Sep 23 '14 at 19:16
  • http://stackoverflow.com/questions/3098230/visual-studio-debugger-ignores-methods-when-doing-step-into – RenniePet Sep 23 '14 at 19:20
  • @RenniePet, I've seen this. There are no attributes on any part of this class, and it's 100% hand-written. – Stephen Collins Sep 23 '14 at 19:22
  • Are any of the methods `partial`? – John Saunders Sep 23 '14 at 19:41
  • A couple more questions: Are you compiling in Release or Debug mode? Is your code running concurrently (in multiple threads)? And these are methods being skipped, right, not property getters and setters? – joelsand Sep 23 '14 at 20:14
  • @JohnSaunders, no, none of the methods are partial. And to joelsand, I'm compiling in debug mode on all projects, and yes, there are a few threads running, but what's going on here is on a single thread. – Stephen Collins Sep 24 '14 at 12:36

2 Answers2

0

Make sure your partial classes are all in the same namespace. If all of your classes are not in the same namespace You can apply the partial modifier, everything will build but they won't actually be the same class.

Miniver Cheevy
  • 1,667
  • 2
  • 14
  • 20
0

I got this working by doing this:

In Visual Studio, go to Tools - Options..., scroll to Debugging/General and uncheck the box next to Enable Just My Code

As suggested here Partial class debugging

Jepzen
  • 2,942
  • 6
  • 40
  • 62