Locked Stepping into C# function using VS2010

  • Monday, January 25, 2010 11:15 PM
     
     
    I am wanting to step into a process in my C# program and added the buttons to the menu to do so but the "step into" or "step out of" buttons never highlite (like the step over button) so I cannot use them.

All Replies

  • Monday, January 25, 2010 11:25 PM
     
     
    The function you want to acces is in a DLL, you can acces the step into is F11 and step out is F10
  • Tuesday, January 26, 2010 6:11 PM
     
     
    Didn't work.
  • Tuesday, January 26, 2010 6:50 PM
    Moderator
     
     Proposed Answer
    Step back a second.  What exactly are you trying to do?

    In order to use most of the debugger functionality you must be running in the debugger and paused.  This includes any sort of step functionality.  To run the program under the debugger you can use F5 (default) to compile and run the program under the debugger.  While running the debugger you are actually just running your app with the debugger quietly listening in the background.  When certain events occur that the debugger is interested in then the debugger will break in.  Such events include exceptions and break points.

    Generally speaking you will put a breakpoint on the line of code you are interested in examining.  You can do so by either selecting the line and pressing F9 or clicking in the indicator margin.  A red dot appears when a BP is set.  While running in the debugger the debugger will break into the code whenever a BP is hit. 

    Once the debugger has broken into the process you can then take advantage of the debugger features such as stepping through code, viewing variable values, using the immediate window, etc.  While the debugger is in control the entire process is paused.  Using the stepping options you can single step through the program to get to lines you are interested in.  This is most useful when you want to see how certain lines of code impact the behavior of the system (such as variable values). 

    If your process spawns another process then you will not be debugging it by default.  So external processes will just run normally.

    A full discussion of how to use the debugger is beyond the scope of these forums.  Please refer to the following MSDN link for details on how to use the debugger: http://msdn.microsoft.com/en-us/library/sc65sadd.aspx

    Michael Taylor - 1/26/10
    http://p3net.mvps.org
    • Proposed As Answer by Nevin Janzen Friday, January 06, 2012 4:49 PM
    •  
  • Wednesday, January 27, 2010 4:11 PM
     
     
    When I used express 2008 it would goto each process call as expected when stepping. In VS 2010 one needs to put a break point in those proceses or VS will step over them. That is why I am needing "step into process" but that goes into the assemly language of the current process and not the called procress.
  • Monday, February 01, 2010 2:47 AM
    Moderator
     
     
    Hello tfcsd,

    What do you mean about process here. Actually, one debug session cannot debug two different process at the same time. Typically, in one debug session, we can step into functions in one process. And the Step Into works for me in Visual Studio 2010.

    OK. If you have two functions like,

    void A()
    {
       B();
    }

    void B()
    {
    }

    In this case, when Visual Studio 2010 breaks at B() calling in A(),
    1. If both A and B are in the same source files. we should be able to step into B directly by pressing F11
    2. If B is from another assembly referenced in the project. We should have the referenced assembly sources file and pdf file to step into B().

    So the problem should not be VS feature related but related to the particular cases. So if you need more help, please be more detailed about what function you want to step into. Is it implemented by you? If it is from referenced assembly, do you have sources for the assembly? If you have sources for the assembly, do you have pdb files? If all of these configured correctly, we should be able to step into the functions.


    Best regards,
    Ji Zhou
    MSDN Subscriber Support in Forum



    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Tuesday, February 02, 2010 12:51 PM
     
     
    AFAIK, seem's like the OP wants to use a break-pointer,
    and study their code.
    Coder24.com
  • Wednesday, May 12, 2010 6:27 PM
     
     

    In VS2003 the F10/F11 allows you to step through over code segments/blocks.  It looks like VS2010 wants a breakpoint at each line instead of defining an entry point and "stepping" through line by line from there.  Is this acurate?  Does F11 still work in VS2010 with an ASP.NET web app using C#?

    Thanks

  • Wednesday, May 12, 2010 6:34 PM
    Moderator
     
     

    F10 is mapped to Step Into.  F11 is mapped to Step Over.  These are partially controlled by the profile selected.  Confirm your settings via Tools\Options -> Keyboard.

    With some apps, like ASP.NET, single stepping is often not sufficient because the code you want to step into is an event handler.  To debug event handlers you will have to set a breakpoint otherwise there is no context in which you'll be able to step into the code.  Paint code is the same way when working with client apps.

    Michael Taylor - 5/12/2010
    http://msmvps.com/blogs/p3net

  • Monday, May 17, 2010 9:05 AM
     
     
    Hello tfcsd:

    How is the situation on your side?
    Do you need more assistance?

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
  • Wednesday, September 29, 2010 2:17 AM
     
     
    Step back a second.  What exactly are you trying to do?

    In order to use most of the debugger functionality you must be running in the debugger and paused.  This includes any sort of step functionality.  To run the program under the debugger you can use F5 (default) to compile and run the program under the debugger.  While running the debugger you are actually just running your app with the debugger quietly listening in the background.  When certain events occur that the debugger is interested in then the debugger will break in.  Such events include exceptions and break points.

    Generally speaking you will put a breakpoint on the line of code you are interested in examining.  You can do so by either selecting the line and pressing F9 or clicking in the indicator margin.  A red dot appears when a BP is set.  While running in the debugger the debugger will break into the code whenever a BP is hit. 

    Once the debugger has broken into the process you can then take advantage of the debugger features such as stepping through codec, viewing variable values, using the immediate window, etc.  While the debugger is in control the entire process is paused.  Using the stepping options you can single step through the program to get to lines you are interested in.  This is most useful when you want to see how certain lines of code impact the behavior of the system (such as variable values). 

    If your process spawns another process then you will not be debugging it by default.  So external processes will just run normally.

    A full discussion of how to use the debugger is beyond the scope of these forums.  Please refer to the following MSDN link for details on how to use the debugger: http://msdn.microsoft.com/en-us/library/sc65sadd.aspx

    Michael Taylor - 1/26/10
    http://p3net.mvps.org

    This is what I'm looking for, Thanks for your explanation! It's comprehensive, Now I understand more about it.