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 ()
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)

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

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 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.