Bug 2308 - Breakpoint in object initializer does not get hit
Summary: Breakpoint in object initializer does not get hit
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC All
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2011-12-02 06:56 UTC by David Roth
Modified: 2012-02-17 11:41 UTC (History)
2 users (show)

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 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 David Roth 2011-12-02 06:56:52 UTC
Setting a breakpoint in an object initializer does not work, the breakpoint never gets hit.


var user = new User()
["breakpoint"]  Name = "My Name", // Breakpoint does not get hit
   Age = 12,  
Comment 1 Jeffrey Stedfast 2011-12-06 15:18:04 UTC
So the problem here seems to be that the soft-debugger doesn't have a location listed for any of the initializer lines (closest match would be the "var user = new User ()" line)

This means that MonoDevelop doesn't have the info available to figure out the correct location to set the breakpoint.

This is either a soft-debugger bug or a compiler bug for not injecting the needed info.
Comment 2 Zoltan Varga 2011-12-06 22:08:43 UTC
As usual, this is an mcs problems. For this code:

11    public static void Main ()
12    {
13	var user = new A()
14	{
15	Name = "My Name", // Breakpoint does not get hit
17    }

It generates the following line number table:

IL0 -> 12
IL0 -> 13
IL13 -> 17
IL13 -> 17
Comment 3 Zoltan Varga 2011-12-06 22:19:23 UTC
With HEAD, you can run md with MONO_SDB_ENV_OPTIONS=loglevel=10 to have sdb dump its line number tables in the application output window.
Comment 4 Zoltan Varga 2011-12-08 08:10:55 UTC
-> mcs.
Comment 5 Marek Safar 2012-02-17 11:41:08 UTC
Fixed in master