Visual C# Developer Center > Visual C# Forums > Visual C# IDE > Breakpoints are not getting hit
Ask a questionAsk a question
 

AnswerBreakpoints are not getting hit

  • Tuesday, March 04, 2008 7:32 AMedu lorenzoMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I know this is probably a non-issue for most but it has been bugging me for about 3hours now. I can't seem to be able to debug and step through my app's code.

    1. web.config debug="true"
    2. debug is set to full
    3. project properties are ok

    the left red circle is ok and does not say symbols are not loaded

    help please....

Answers

  • Wednesday, March 05, 2008 8:23 AMDragoslav Zaric Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I had similar problem once and I was also wandering how is this possible. The trick was that when you load page, code goes trough all web controls that you have on your page , and also trough page_load of those controls, so if you take that into account it may be some logic inside loading those controls that affects final outcome in your cs page. That was my problem, and I am 100% sure it is same for you.

     

    Just place breakpoint inside pade_load of all web controls that you have on your cs page and also on cs page, and when first breakpoint is hit, go from there with F11,

     

    good luck !!

     

All Replies

  • Tuesday, March 04, 2008 8:03 AMAtul GuptaMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Is this a web application? Is this with VS 2005? VS 2008? Do you get any error shown when you try to debug?

  • Tuesday, March 04, 2008 8:22 AMRick van den Bosch Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    Are you debugging your web application from Visual Studio (by pressing F5 or clicking the run button), or are you starting the application by opening it in Internet Explorer (and attaching to the right process)?

    Are you using the integrated ASP.NET Development server, or is your application hosted in IIS. If the latter is the case, is IIS configured to A) work with the right ASP.NET version and B) enable you to debug your application?

    Are you sure the breakpoint should be hit? Normally you recieve an error stating you cannot debug if for example configuration is wrong in IIS. If breakpoints are simply not hit, this sounds a bit like you've placed a breakpoint in a piece of code you aren't hitting. Please try putting a breakpoint in a page_load (or any other method you are certain of hitting) and try again.

    You're not starting the web app by pressing CTRL + F5, right Wink

    Hope this helps.

  • Tuesday, March 04, 2008 2:50 PMDragoslav Zaric Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Start application with F5, not ctrl+F5. Also if code that you want to debug is in Global.asax then you must change web.config file and save it (just press space somewhere inside web.config) and press F5 and code will go trough global.asax

    greet
  • Tuesday, March 04, 2008 11:11 PMedu lorenzoMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    @Atul
    Yes sir, web application. VS2008. The red circles are there and not hollowed out.

    @Rick
    Yes I am hitting F5 on my keyboard and not Ctrl+F5.
    Yes I am sure the breakpoints SHOULD be hit as I am browsing the page that belongs to the particular .cs file where I placed the breakpoint. And also, yes, I tried the breakpoint on the Page_Load but it is not getting hit.

    @Dragoslav
    No sir, am only trying to hit a breakpoint on a certain page I want to debug.

    The thing is, when I create a new web application and place a breakpoint there, it works properly. So from that I believe my error is between the keyboard and my chair Smile or probably my app property settings.

    Thank you all for the replies, this is greatly helping me towards the right direction.

    As an addition:
    This used to be a "Breakpoint will not be hit.. No Symbols are loaded" before. I fixed it by loading the PDB thru the Debug-Windows-Modules then loaded the correct and matching PDB.
    Now the breakpoints are no longer hollow, no error messages or warnings but at the same time, no use. Sad


  • Wednesday, March 05, 2008 8:23 AMDragoslav Zaric Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I had similar problem once and I was also wandering how is this possible. The trick was that when you load page, code goes trough all web controls that you have on your page , and also trough page_load of those controls, so if you take that into account it may be some logic inside loading those controls that affects final outcome in your cs page. That was my problem, and I am 100% sure it is same for you.

     

    Just place breakpoint inside pade_load of all web controls that you have on your cs page and also on cs page, and when first breakpoint is hit, go from there with F11,

     

    good luck !!

     

  • Wednesday, March 05, 2008 4:11 PMmonkieboy Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    are you adding controls by dragging and dropping? this can sometimes cause the initialise methods from not working soemhow. try dropping another control onto the page rebuilding and running it then removing the control via the designer and then going into your code and tidying up any of the nasty code VS makes for you.
  • Sunday, November 01, 2009 10:59 AMSithara Das Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi all,

    I too have th same problem.
    I'm running microsoft visual studio 2005. 
    In my website there is only single aspx file.  I have inserted a breakpoint in page_load
    But once the page is loaded, the page_load is getting hit only for a short period of time.
    After that it is gone.(the yellow color comes in the page_load just for 1 secs).
    Do i need to change any settings in web.config
    Pls  guide me to solve this problem