Bug 775 - Automatic stepover on properties
Summary: Automatic stepover on properties
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: Macintosh Mac OS
: Low enhancement
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2011-09-13 07:26 UTC by Chris Hardy [MSFT]
Modified: 2015-01-07 11:58 UTC (History)
8 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Chris Hardy [MSFT] 2011-09-13 07:26:39 UTC
Automatic stepover on properties, like in Visual studio would be another nice feature
Comment 2 Mikayla Hutchinson [MSFT] 2011-09-13 07:46:32 UTC
This would need to be implemented in SDB.
Comment 3 Sebastien Pouliot 2011-09-13 07:50:27 UTC
VS does so using one (of the many) attribute(s), i.e.
Comment 4 Mikayla Hutchinson [MSFT] 2011-09-13 07:56:50 UTC
Pretty sure properties don't have that attribute. This is a different feature, though SDB should support that too.

The VS debugger has an option, which can be toggled on/off in preferences, to step over properties. Interestingly, after it does so it pops up a dialog saying that it's done so, and explaining how to disable it. That implies the debugger is notified when such a step-over occurs. Perhaps this could be implemented on the MD side instead of the SDB side, by having MD automatically issue a step out command if it stops in a property.
Comment 5 Mikayla Hutchinson [MSFT] 2012-02-16 17:33:05 UTC
Zoltan, could we have an argument to the step request that allows us to specify whether the stepping operation should step over properties and operators?

See also bug 3262, it would probably make sense to also have a parameter to the stepping operation that would tell it whether to respect those attributes.
Comment 6 Mikayla Hutchinson [MSFT] 2012-02-16 18:10:01 UTC
I'm not sure whether the best option is to have some flags on the stepping request (StepIgnoreFlags.PropertiesAndOperators, StepIgnoreFlags.HiddenCode, StepIgnoreFlags.NonUserCode) or additional StepDepth values (StepIntoIgnoringProperties, etc).

We'll probably need a property on the StepEvent that indicates whether a property/operator was stepped over, so we can do the notification like VS does: http://stackoverflow.com/questions/2672996/your-step-into-request-resulted-in-an-automatic-step-over-of-a-property-or-opera
Comment 7 Zoltan Varga 2012-02-17 05:34:03 UTC
The .net debugging interface don't seem to contain this functionality, so it is probably implemented by vs itself:
Comment 8 Mikayla Hutchinson [MSFT] 2012-02-17 14:10:53 UTC

A simplistic approach would be that if we get a StepEvent after a StepInto command, and the current frame is a property or is hidden code, then we could automatically execute a StepOut command, then when that steps, we'd issue another StepInto command. This should result in the desired behaviour, I think.

I do wonder what perf would be like when stepping into a line that has many property getter invocations, since every property will cause two stopping events, and resultant roundtrips. But it's probably okay.
Comment 9 Zoltan Varga 2012-02-17 15:07:31 UTC
That shouldn't be a problem, a few stepping operations are pretty fast.
Comment 10 Jeffrey Stedfast 2012-02-17 21:12:30 UTC
This is now implemented in MonoDevelop, but the runtime (or compiler?) doesn't get stepping quite right.

example code:

using System;

namespace AutoStepOverProperties {
	public class Sample {
		bool blah;
		public string StringProperty {
			get {
				if (blah)
					return "blah";
					return "no blah";
		public int IntProperty {
			get; set;
		public string GetFubar ()
			return "fubar";
		public string GetFubar2 ()
			return "fubar2";
		public Sample (bool blah, int v)
			IntProperty = v;
			this.blah = blah;
	public class Program {
		public static void Main (string[] args)
			var sample = new Sample (true, 5);
			Console.WriteLine ("Sample: {0}:{1}:{2}", sample.StringProperty, sample.IntProperty, sample.GetFubar ()); // put breakpoint on this line
			Console.WriteLine (sample.GetFubar2 ());

run the program under the debugger and when the breakpoint is hit, press Step Into.

The expected behavior is that we end up in Sample.GetFubar() but the actual behavior is that we end up in Sample.GetFubar2()

What happens is that we land inside Sample.StringProperty, then MD automatically calls StepOut - once StepOut finishes, we call StepInto again. At this point we *should* be stepping into Sample.IntProperty (causing MD to auto-step over IntProperty), but the runtime seems to return at Sample.GetFubar2().
Comment 11 Jeffrey Stedfast 2012-02-17 21:17:13 UTC
oh, fwiw, I'm using StepSize.Min when I step out and step back in.

Originally I used StepSize.Line, but that didn't work either.
Comment 12 Rodrigo Kumpera 2013-09-08 19:05:57 UTC
Zoltan, is this still an issue?
Comment 13 Zoltan Varga 2015-01-07 11:58:37 UTC
This should work fine now.