Bug 5810 - Using 'Step Into' to traverse the Android Application template steps you into some invisible code and also breaks on some lines twice in a row
Summary: Using 'Step Into' to traverse the Android Application template steps you into...
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger ()
Version: 4.2.x
Hardware: PC Mac OS
: High normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-06-21 17:14 UTC by PJ
Modified: 2016-09-02 20:55 UTC (History)
3 users (show)

Tags: XATriaged
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 Developer Community or GitHub 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 PJ 2012-06-21 17:14:13 UTC
Start a new MFA application
Set a breakpoint on line 15 (int count = 1;)
Debug the application
After the breakpoint is hit, step into until you reach the end of execution

Expected behavior:
The debugger will re-focus on the next available user-visible code line that is capable of being stopped on (the OnCreate method).

Actual behavior: 
    VS: http://screencast.com/t/lihyjKHGJ
    MD: http://screencast.com/t/c3vFDuZQl3y
Focus moves to the end of the file for several iterations of 'Step Into' before finally returning to visible code
Also, the debugger stops twice on the same line for some of the lines (EG: `SetContentView(Resource.Layout.Main);

This breakpoint is not hit in MonoDevelop Mac. That bug is bug 5809.

Seen on:
MD (Windows, blocked on Mac)
MFA 4.2.3
Comment 1 Jonathan Pryor 2014-07-30 11:32:50 UTC
Re-tested. Observing different -- but still somewhat wrong -- behavior.

1. Create new project.
2. Set breakpoint on line 15 (`int count = 1;`).
3. Start debugging
4. Debugger breaks on line 15 (yay).
5. Step in; stopped at '{' of OnCreate(). (yay).
6. Step in; stopped at base.OnCreate(). (yay).
7. Step in; stopped at line 26 (button = FindView...). Wat?

    What happened to the SetContentView() call (line 22)?!

    This is clearly a bug.

8. Step in; stopped at line 28 (button.Click += ...). (yay).
9. Step in; stopped at line 31 ('};). (yay).
10. Step in; nowhere, because we're done.

(7) is clearly buggy.

After I tap the button, I break on line 28 (event handler invocation). Yay. From this point onward, it looks good.
Comment 2 Marek Habersack 2016-09-02 20:55:15 UTC
No longer occurs with current monodroid/master (ade94be41adf31a58b02e5feabd4b8bfaf522a4e)