Bug 10587 - Breakpoint on opening brace of method breaks in wrong location
Summary: Breakpoint on opening brace of method breaks in wrong location
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger ()
Version: 4.6.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2013-02-22 14:02 UTC by Eric Maupin
Modified: 2017-06-28 21:42 UTC (History)
6 users (show)

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


Attachments
Screenshot of issue (13.37 KB, image/png)
2013-02-22 14:02 UTC, Eric Maupin
Details


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:
Status:
RESOLVED FIXED

Description Eric Maupin 2013-02-22 14:02:07 UTC
Created attachment 3454 [details]
Screenshot of issue

Placing a breakpoint on the opening brace of a method breaks on the first line, instead of the brace.
Comment 1 Eric Maupin 2013-02-22 15:48:13 UTC
Actually, this applies to all opening braces. Loops, if statements, etc..
Comment 2 Dominique Louis 2013-02-26 14:17:28 UTC
Hi Eric,
  I can confirm that this behaviour is consistent between MfA on both XS and VS-Addin.

Can I ask in what situation you would want it to break on a curly brace?
It seems to me the logic of breaking on the first line that contains code after the curly brace makes more sense. 

Whenever I've stuck a break point on a curly brace it has usually been by mistake, so I'm pleased that the Xamarin compiler understands that and does the right thing, saving me time. In both cases the code on that next line has not been evaluated yet.

Now if we want this to be consistent with VS, then we'd need to discuss this further.


D.
Comment 3 Eric Maupin 2013-02-26 14:52:35 UTC
Technically there's really no difference. Breaking on the curly brace is just a visual cue that you are absolutely before any code in the block is executed. We do want consistency with VS's debugger in VS, whether XS acts like this or not isn't my concern.
Comment 4 Jeffrey Stedfast 2013-03-18 13:32:54 UTC
This *may* require compiler changes, as the VM simply provides the line/column info from the mdb files that the compiler generates.
Comment 5 Atsushi Eno 2013-05-22 15:28:42 UTC
I believe we historically had this sort of issue. Sounds like general mcs issue, or could be runtime issue. CCing mareks and lupus.
Comment 6 Marek Safar 2013-05-23 03:49:25 UTC
This has been fixed (implemented) in 3.0 mcs.

@Dominic, breaking on { is usually useful in scenarios like

void Foo ()
{
}

You want to break on the method or another good example are auto properties (not supported by VS yet)

public int Prop { get; set; }
Comment 7 Eric Maupin 2013-05-23 13:13:49 UTC
(In reply to comment #4)
> This *may* require compiler changes, as the VM simply provides the line/column
> info from the mdb files that the compiler generates.

(In reply to comment #5)
> I believe we historically had this sort of issue. Sounds like general mcs
> issue, or could be runtime issue. CCing mareks and lupus.

(In reply to comment #6)
> This has been fixed (implemented) in 3.0 mcs.

Guys, unless it's changed, projects compiled with VS are still going through csc, so perhaps pdb2mdb is what should be looked at.
Comment 8 Cody Beyer (MSFT) 2017-06-28 21:42:08 UTC
Breakpoints are occurring at the bracket, when testing using the latest stable (15.2)