Bug 38025 - "Step Out" gets confused by nested code
Summary: "Step Out" gets confused by nested code
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 4.6.0 (C8)
Assignee: Andi McClure
Depends on:
Reported: 2016-01-26 09:39 UTC by 999komi
Modified: 2016-11-03 14:47 UTC (History)
5 users (show)

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

code to reproduce the bug (619 bytes, text/plain)
2016-01-26 09:39 UTC, 999komi

Description 999komi 2016-01-26 09:39:45 UTC
Created attachment 14732 [details]
code to reproduce the bug

Use the code in the attached file. (As written, it's a test for NUnit, but I saw the same behavior in PCL code under Android.)

1. Set a breakpoint at the commented line.
2. Run the test in debug mode. You will hit the breakpoint.
3. Unset the breakpoint.
4. Open the "locals" panel so you can see the local variables.
5. Repeatedly hit "step out". 
6. EXPECTED BEHAVIOR: Each time you step out, the value of n should increase by 1. ACTUAL BEHAVIOR: n increases to 3, then drops to 1 on the next step out. What has happened is that instead of stepping out of the current call, the debugger continued until it stepped out of a nested call to the same method.
Comment 1 David Karlaš 2016-03-07 11:03:12 UTC
I'm moving this to runtime because fix will be there... I can reproduce this also on console application: https://gist.github.com/DavidKarlas/2ab7635d68d3d6f431a4
Comment 2 Andi McClure 2016-05-04 22:46:19 UTC
I have a slightly simpler console repro


Break on line 12
On break, type "Step out" once
On the second visit to line 12 it will execute line 12, *then* break on completion.
Comment 3 Andi McClure 2016-05-06 16:00:50 UTC
I believe I have a fix for this but it cannot work unless https://bugzilla.xamarin.com/show_bug.cgi?id=32350 is also fixed. I am talking to David K about getting a fix for 32350
Comment 4 Andi McClure 2016-09-13 19:04:57 UTC
A fix for this was checked in to master around 2016-06-04. It is in 4.6.0.
Comment 5 Naqeeb 2016-11-03 14:47:53 UTC
I have checked this issue with latest C8SR1 build and observed that it is working fine. Here is the screencast for the same: http://www.screencast.com/t/rF1UFxsnBAsL

Environment info: https://gist.github.com/NaqeebAnsari/b05cff1a8be94ee81ec9e90e0fd32c6e

Hence closing this issue.

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

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.

Note You need to log in before you can comment on or make changes to this bug.