Click here to Skip to main content
15,887,344 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I installed the new version of Visual Studio Community 2015.

Opened old Visual Studio 2010 projects. They compiled okay. Then when I needed to debug them I found out something strange.

When I try to Step Over(F10) just skips lines of code like they weren't there.

http://i.imgur.com/xB1nGQp.png[^]

For example I start debugging in line 33, then F10 sends me right to line 43.

How is that?

And is it configurable.
Posted
Comments
Krunal Rohit 5-Nov-15 10:09am    
Lines 34, 35 are blank,
36 has some calculation,
37 is blank,
38 has condition and that is obviously going for false, hence it will also skip 39,40 and 41,
42 is again blank
and 43 - there you are.

-KR
Zhivko Kabaivanov 5-Nov-15 11:24am    
How to disable this skipping?
Richard MacCutchan 5-Nov-15 12:03pm    

int result = 1 - 100;
if (result > 0)

Result will never be greater than zero.
Zhivko Kabaivanov 5-Nov-15 12:04pm    
I know that
The problem was that Optimized code is skipped.
Richard MacCutchan 5-Nov-15 12:12pm    
Which probably means that you are not working on the debug version of your code.

1 solution

This behavior is consistent with debugging optimized code.

You can verify what code was generated by going to Tools -> ILDasm, loading your executable and inspecting that function. Or, while on a breakpoint in the Debugger, Debug -> Windows -> Disassembly (or click Alt+8).

This may be a new feature in 2015, as my 2013 does not optimize that assignment/test out...
 
Share this answer
 
Comments
Philippe Mori 5-Nov-15 12:18pm    
I would think that any version of Visual Stidio would optimize away such unreachable code when debugging an optimized version of an application.

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