Click here to Skip to main content
16,019,614 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

When I execute my program. Breakpoints does not hit?

I am very new to programming please help.

Thanks!
Posted

Few things.

Perhaps obvious but when you say that you execute your program do you mean that you run it from Visual Studio, not that you run the exe for example by double clicking it.

Another thing, since this is make sure that you run it in debug mode (in VS from Debug menu select Start Debugging). If you for example press Ctrl+F5 that will run the program without debugging.
 
Share this answer
 
Comments
msshaw2013 21-Dec-11 1:00am    
Yes Sir! I am debugging the program from visual studio. Thanks so much
Wendelius 21-Dec-11 1:02am    
You're welcome :) So it hits the breakpoints now ?
Sergey Alexandrovich Kryukov 21-Dec-11 1:01am    
Well, considering recent post by OP... (sigh), these suggestions are not redundant... :-) ...my 5.
--SA
Wendelius 21-Dec-11 1:02am    
Thanks :)
msshaw2013 21-Dec-11 1:41am    
Yes. It does. Thanks Mika & SAKryukov
Press F9 harder! Well, jokes aside: first, makes sure your breakpoints work in principle, debugging is enabled, etc. To check it up, fist place you break point where the code runs in all cases, for example, on first statement on your entry point method.

Now, let's assume debugging is working. Put your break point where you wanted again. What, the execution is not stopped there. Excellent! Your debugging was successful and you have detected your first bug: in the order of execution the code you are interested in is never called. Great! Now you know what to do: activate a content menu and find all places where your method in question should be called. Put your break point at the beginning of your method and all the calls of it, and the beginning of each of the calling method. Repeat debugging process. Sooner or later you will find all the ropes and solve your problem.

Good luck,
—SA
 
Share this answer
 
Comments
koolprasad2003 20-Dec-11 23:49pm    
good suggestion.5.
Sergey Alexandrovich Kryukov 21-Dec-11 0:59am    
Thank you, Prasad.
--SA
msshaw2013 21-Dec-11 0:27am    
Sounds Excellent. I have one more question? How to activate content menu? Thanks
Sergey Alexandrovich Kryukov 21-Dec-11 0:58am    
No kidding? There is a special menu key on your keyboard, on the right of right Alt. Hello..! Where have you been? In worst case, right mouse button.
--SA
Wendelius 21-Dec-11 0:56am    
Good answer, 5. Please see also other possibilities I added.
Debug your program instead of running it.
 
Share this answer
 
v2
Comments
msshaw2013 20-Dec-11 18:51pm    
Yes Sir! I am debugging the program...But it does not hit.
Sergey Alexandrovich Kryukov 20-Dec-11 19:27pm    
Frankly, I wouldn't probably get it, too. Perhaps it needs some explanation. (I did not vote.)

Please see my answer.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900