Visual Studio 2010 debugger steps over methods and doesn't stop at breakpoints

后端 未结 12 1540
终归单人心
终归单人心 2020-12-15 16:59

My Visual Studio 2010 debugger sometimes has a very strange behaviour...

Sometimes it doesn\'t stop at breakpoints, but when it stops, and I want to step into a meth

相关标签:
12条回答
  • 2020-12-15 17:17

    Another source of confusion is iterator methods that use the yield return operator because they are rewritten by the C# compiler in such a way that stepping into them (F11) is kind of a "no-op".

    You must wait for the iteration to occur to break into the method's code.

    0 讨论(0)
  • 2020-12-15 17:18

    The most important thing to check is whether when trying to put a new breakpoint inside the method it refuses to step into, if the breakpoint is filled red liked the others, or half filled or has a special "look". If it does, hover over the breakpoint you created to find out why it isn't working.

    If the breakpoint looks normal but still you can't seem to step into the method, try clearing the shadow copy cache: http://weblogs.asp.net/mreynolds/archive/2003/08/11/23576.aspx

    Another thing to try is to make sure that you are indeed using the DLL you've just rebuilt by adding a MessageBox.Show (or something similar) to the method you can't seem to stop at, and make sure you get the box.

    0 讨论(0)
  • 2020-12-15 17:22

    In my case it was "Step Over Properties and Operators" in Tools -> Options -> Debugger. Just had to uncheck that and after that everything was fine, I could step into.

    0 讨论(0)
  • 2020-12-15 17:22

    I have experienced the same recently. Not sure what I did exactly though. Try to physically clean up your solution, i.e. delete all bin directories from all projects of the solution. That usually helps to solve a lot of problems.

    0 讨论(0)
  • 2020-12-15 17:24

    I struggled with this for a while. None of the answers given worked for me. I finally got it to work by doing the following:

    1. Make sure the project is in debug mode (all projects)
    2. From Windows go to a Command prompt and be sure to run as administrator
    3. Navigate to c:\windows\syswow64\ (or folder where gacUtil.exe is located)
    4. Run the following command (substitute path below to where your debug output version of the DLL is located.

    gacutil /i "C:\Users\John\Documents\Visual Studio 2008\Projects\Project1\Project1\bin\Debug\MyAppDLL.dll"

    You should get "Assembly successfully added to the cache"

    Now run your project and you should be able to step into the DLL code.

    0 讨论(0)
  • 2020-12-15 17:26

    Here are a couple of reasons and workarounds for why Visual Studio will avoid stepping into a particular method.

    • Just My Code is enabled. In certain circumstances the "Just My Code" setting will prevent you from stepping into a method / property. To avoid this you can disable "Just My Code" in the debugger options page (Tools -> Options -> Debugger -> Uncheck "Just My Code")
    • Symbols are not loaded for the target method. If the target method is a part of another DLL it's possible that symbols are not loaded for that DLL and hence Visual Studio will not be able to step into it by default. To force the symbols to load, open up the Modules view (Debugger -> Windows -> Modules), navigate to the DLL containing the method, right click and load symbols.
    • The method is explicitly marked with a debugger attribute such as DebuggerNonUserCode which causes the debugger to step over the method.
    • The method is actually a property or operator and you have "Step Over Properties and Operators" setting enabled (this is the default). This can be disabled via the debugger options dialog.
    0 讨论(0)
提交回复
热议问题