Bug 38025

Summary: "Step Out" gets confused by nested code
Product: [Mono] Runtime Reporter: 999komi
Component: DebuggerAssignee: Andi McClure <andi.mcclure>
Severity: normal CC: andi.mcclure, mono-bugs+mono, mono-bugs+monodevelop, mono-bugs+runtime, naqeeba
Priority: High    
Version: unspecified   
Target Milestone: 4.6.0 (C8)   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: code to reproduce the bug

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.