Automatic Property and Operator Step-Over
Properties and custom operators generally perform simple tasks that rarely require debugger support. Visual Studio can be configured to automatically step over these items, rather than stepping into them during debugging.
Properties and Operators
When you create properties or overloaded operators in your classes and structures, you should aim to make them as simple as possible. Many properties just allow access to an object's state without performing any calculation; properties that are complicated or slow to execute should really be changed to methods. Custom operators are generally used only for quick functions too.
By default, Visual Studio provides a handy feature when debugging. When a property or operator is encountered, it is stepped over, rather than stepped into. This gives the equivalent effect of pressing F10 when you actually press F11. This can be useful because it stops the debugger from jumping around within you code unnecessarily, which can be distracting.
The first time that the feature is automatically used, Visual Studio shows a dialog box to let you know what happened. It includes the message, "Your step-into request resulted in an automatic step-over of a property or operator."
The dialog box asks if you want to continue being alerted in this manner. If you select, "Yes", the dialog box is displayed next time that a property or operator is stepped over automatically. This can be just as distracting as when a property is stepped into unexpectedly. If you choose, "No", the message is disabled. In either case, the step-over operation continues.
Whilst automatic step-over is useful, there are situations where it is important to step into a property or operator. To do so, when you reach the line that contains the property call, right-click the line and select, "Step Into Specific" from the context-sensitive menu that appears.
Disabling Automatic Step Over
You might not like the automatic step-over feature and may prefer that properties are stepped into by default. This allows you to press F11 to step into such code and F10 to step over the current line according to your wishes. If so, you can disable the automatic step-over. To do so, open the Options dialog box by choosing "Options" from the "Tools" menu.
With the Options dialog box open, expand the "Debugging" section of the tree view to the left and select "General". The right side of the dialog box updates to show a number of options. Locate the "Step over properties and operators (Managed only)" option and uncheck the box to disable the feature.
24 January 2013