Bug 636 - Cannot set a breakpoint at constructor initializer
Summary: Cannot set a breakpoint at constructor initializer
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2011-09-05 06:06 UTC by Marek Safar
Modified: 2012-02-20 09:01 UTC (History)
5 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 Marek Safar 2011-09-05 06:06:10 UTC
using System;

namespace test3
	class A
		public A (int a)
			: this (a.ToString ()) // SET breakpoint here
		private A (string f)
	class MainClass
		public static void Main (string[] args)
			new A (9);

MD does not stop at specified breakpoint
Comment 1 Zoltan Varga 2011-09-27 15:23:46 UTC
-> MD for now.
Comment 2 Mikayla Hutchinson [MSFT] 2011-09-27 15:40:38 UTC
Is there any debugger log output?
Comment 3 Jeffrey Stedfast 2011-12-06 14:59:25 UTC
Resolving breakpoints in type CtorInitBreakPoint.A
	iterating over breakpoints in: /Users/fejj/Projects/CtorInitBreakPoint/CtorInitBreakPoint/Main.cs
		pending breakpoint: /Users/fejj/Projects/CtorInitBreakPoint/CtorInitBreakPoint/Main.cs:33
		iterating over methods...
			method = Void CtorInitBreakPoint.A:.ctor (Int32)
			location = /Users/fejj/Projects/CtorInitBreakPoint/CtorInitBreakPoint/Main.cs:34
			location = /Users/fejj/Projects/CtorInitBreakPoint/CtorInitBreakPoint/Main.cs:35
			location = /Users/fejj/Projects/CtorInitBreakPoint/CtorInitBreakPoint/Main.cs:35
		range = 34 to 35
			method = Void CtorInitBreakPoint.A:.ctor (String)
			location = /Users/fejj/Projects/CtorInitBreakPoint/CtorInitBreakPoint/Main.cs:38
			location = /Users/fejj/Projects/CtorInitBreakPoint/CtorInitBreakPoint/Main.cs:39
			location = /Users/fejj/Projects/CtorInitBreakPoint/CtorInitBreakPoint/Main.cs:39
		range = 38 to 39
		location = null; insideLoadedRange = False

Here's what the line numbers look like:

32        public A (int a)
33            : this (a.ToString ()) // SET breakpoint here
34        {
35        }
37        private A (string f)
38        {
39        }

It looks like the soft debugger is giving us wrong line offsets for ctors in both ctors above. The line ranges should be: 32-35 and 37-39, but the soft debugger is giving us 34-35 and 38-39 respectively.

This code is using MethodMirror.Locations to iterate over the locations of each method.
Comment 4 Zoltan Varga 2011-12-06 22:22:22 UTC
mcs line info problem:

7        public A (int a)
8            : this (a.ToString ()) // SET breakpoint here
9        {
10        }

Line number table for method test3.A:.ctor (int):
ILd -> 9
ILd -> 10
ILd -> 10
Comment 5 Zoltan Varga 2011-12-06 22:22:54 UTC
It would be nice to add tests for the line number info emitted by mcs for various cases.
Comment 6 Marek Safar 2012-02-20 09:01:37 UTC
Fixed in master