Bug 31248 - [VS] Position of breakpoint changed on debugging the android application, with multiple breakpoints.
Summary: [VS] Position of breakpoint changed on debugging the android application, wit...
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Radek Doulik
: 33738 ()
Depends on:
Reported: 2015-06-19 10:21 UTC by Rajneesh Kumar
Modified: 2016-02-02 19:20 UTC (History)
12 users (show)

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

Mdb_Pdb file attached. (3.48 KB, application/octet-stream)
2015-10-08 14:02 UTC, Rajneesh Kumar
Mdb_Pdb_Dll file attached (5.86 KB, application/octet-stream)
2015-10-08 14:51 UTC, Rajneesh Kumar
pdb dump of "working" build (14.70 KB, text/plain)
2015-10-14 12:17 UTC, Radek Doulik
pdb dump of "non-working" build (14.30 KB, text/plain)
2015-10-14 12:17 UTC, Radek Doulik

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 for Bug 31248 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Comment 1 Joaquin Jares 2015-09-21 12:09:57 UTC
*** Bug 33738 has been marked as a duplicate of this bug. ***
Comment 2 Radek Doulik 2015-09-21 15:26:32 UTC
@joj, you looked into that bug. is it VS bug or XA? should I reassign it to you or should I look into it?
Comment 3 Peter Collins 2015-10-01 11:45:10 UTC
I believe this should now be fixed in monodroid master  ( https://trello.com/c/UfWgSEmB/217-xa-rework-pdb-mdb-conversion-to-generate-mdb-in-outputdir-of-project)
Comment 4 Mohit Kheterpal 2015-10-01 16:02:53 UTC
I have checked this issue with XVS and observed that this issue still exist.

Hence reopening this issue.
Comment 5 Joaquin Jares 2015-10-01 18:51:54 UTC
Answering radek: thi repros in XS too. I think it’s XA.
Comment 6 Radek Doulik 2015-10-02 12:21:49 UTC
Tried to reproduce it here in XS. It works OK. I will try it on Windows as well, maybe it is something related to Win, pdb2mdb maybe?
Comment 7 Peter Collins 2015-10-02 12:33:55 UTC
I believe this was a windows only issue, and after talking with Dean yesterday I was under the impression that this would potentially be fixed by the recent pdb2mdb changes in master?
Comment 8 Joaquin Jares 2015-10-02 14:15:11 UTC
It is a windows only-issue related to pdb2mdb. It's supposed to be working too, but our tests show that the issue is still present. We're bumped to HEAD of monodroid, so that should be ok too. The fix from Dean got in day before yesterday, though, so this might be solved by simply testing with the latest bits from yesterday.
Comment 9 Radek Doulik 2015-10-06 11:16:45 UTC
So the mdb on windows doesn't contain row 55 for the delegate method, which seems related.


    <method token="0x6000015" signature="System.Void MyRegressionTest.MainActivity/&lt;OnCreate&gt;c__AnonStorey0::&lt;&gt;m__0(System.Object,System.EventArgs)">
        <entry il="0x0" row="51" col="4" file_ref="1" />
        <entry il="0x1" row="53" col="5" file_ref="1" />
        <entry il="0x8" row="53" col="5" file_ref="1" />
        <entry il="0xe" row="54" col="5" file_ref="1" />
        <entry il="0x34" row="54" col="26" file_ref="1" />
        <entry il="0x39" row="54" col="12" file_ref="1" />
        <entry il="0x3e" row="55" col="4" file_ref="1" />
      <locals />
      <scopes />


    <method token="0x6000015" signature="System.Void MyRegressionTest.MainActivity/&lt;&gt;c__DisplayClass1::&lt;OnCreate&gt;b__0(System.Object,System.EventArgs)">
        <entry il="0x0" row="51" col="4" end_row="51" end_col="5" file_ref="1" />
        <entry il="0x1" row="53" col="5" end_row="53" end_col="22" file_ref="1" />
        <entry il="0xe" row="54" col="5" end_row="54" end_col="58" file_ref="1" />
        <entry il="0x3f" row="54" col="0" file_ref="1" />
        <entry name="CS$0$0000" il_index="0" scope_ref="1" />
        <entry index="0" start="0x0" end="0x40" />

I will check older versions, to see if that generated mdb for that anonymous delegate changed.
Comment 10 Radek Doulik 2015-10-08 10:09:33 UTC
I see the same behavior in XS from stable channel (XA 5.1.6). My guess is that it might be a change in the MS C# compiler output?

@Rajneesh, could you please attach MyRegressionTest.dll.mdb and MyRegressionTest.pdb from the working version (stable XVS
3.11.590)? Do you know which C# compiler does it use?
Comment 11 Rajneesh Kumar 2015-10-08 14:02:53 UTC
Created attachment 13244 [details]
Mdb_Pdb file attached.


I have attached MyRegressionTest.dll.mdb and MyRegressionTest.pdb from the working version (stable XVS 3.11.590) within this comment.

And it is using  Visual C# Compiler version with VS 2015

Screencast: http://www.screencast.com/t/bvtsuRS8y

Comment 12 Rajneesh Kumar 2015-10-08 14:04:32 UTC
Changing its status Needinfo to Confirmed.

Comment 13 Radek Doulik 2015-10-08 14:44:06 UTC
@Rajneesh, thanks!

I forgot to ask for the dll file as well. Could you please attach the MyRegressionTest.dll?
Comment 14 Rajneesh Kumar 2015-10-08 14:51:31 UTC
Created attachment 13245 [details]
Mdb_Pdb_Dll file attached

I have attached MyRegressionTest.dll.mdb, MyRegressionTest.pdb and MyRegressionTest.dll from the working version (stable XVS 3.11.590) within this comment.

Also With VS 2012 it is using  Visual C# Compiler version 4.6.0079.0  

Screencast: http://www.screencast.com/t/zPfwL6y3H5Rm

Comment 15 Radek Doulik 2015-10-12 10:35:11 UTC

The mdb from last attachment indeed contains the row 55 in the delegate method.

    <method token="0x600000b" signature="System.Void MyRegressionTest.MainActivity/&lt;&gt;c__DisplayClass5_0::&lt;OnCreate&gt;b__0(System.Object,System.EventArgs)">
        <entry il="0x0" row="51" col="4" file_ref="1" />
        <entry il="0x1" row="53" col="5" file_ref="1" />
        <entry il="0xe" row="54" col="5" file_ref="1" />
        <entry il="0x46" row="55" col="4" file_ref="1" />
      <locals />
      <scopes />

Now to find out whether that difference exists in the pdbs already.
Comment 16 Radek Doulik 2015-10-14 12:15:20 UTC
So, in the working pdb, the delegate indeed contains the line 55

** <OnCreate>b__0

	line 51 at [000000BC][0001:000000BC], len = 0x1	C:\Users\Rajneesh\Downloads\MyRegressionTest\MyRegressionTest\MainActivity.cs
	line 53 at [000000BD][0001:000000BD], len = 0xD
	line 54 at [000000CA][0001:000000CA], len = 0x38
	line 55 at [00000102][0001:00000102], len = 0x1

while the non-working pdb, hides that part (with 16707566 = 0xfeefee value)

** <OnCreate>b__0

	line 51 at [0000005A][0001:0000005A], len = 0x1	n:\Xamarin\MyRegressionTest\MyRegressionTest\MainActivity.cs
	line 53 at [0000005B][0001:0000005B], len = 0xD
	line 54 at [00000068][0001:00000068], len = 0x31
	line 16707566 at [00000099][0001:00000099], len = 0x1

It looks to me that this happens outside of XA. I guess it is result of how newer MS C# compiler behaves?

Zoltan, what is your opinion on this? (I guess as you work on sdb, you might know more about that)
Comment 17 Radek Doulik 2015-10-14 12:17:05 UTC
Created attachment 13330 [details]
pdb dump of "working" build
Comment 18 Radek Doulik 2015-10-14 12:17:41 UTC
Created attachment 13331 [details]
pdb dump of "non-working" build
Comment 19 Peter Collins 2015-10-19 19:14:37 UTC
On my Windows 10 box here, I am able to reproduce this issue consistently when only swapping out the XVS version installed on disk. I can reproduce this issue in both XS and VS 2015, and from what I can tell it doesn't appear to be a result of me using a different c# compiler.

If I create a new hello world template and set a breakpoint on the button.Text assignment in the  click delegate, I am able to consistently hit that break point where I set it using the current stable XVS (3.11.1537). However, after installing the current cycle 6 alpha, the breakpoint is resolved on one of the trailing braces of the delegate.

I also able to resolve breakpoints as expected using the current stable and the attached test case.
Comment 20 Radek Doulik 2015-10-22 07:46:35 UTC
Peter, the behavior you describe is fixed by Dean change IIRC, it just wasn't applied to C6 branch yet, works OK with master. That's the mdb location issue, the project assembly mdb file is missing in the bin/<Configuration>/. Dean, do you know when it will land in C6 branch?

The issue I am trying to fix is the remaining issue with the end brace breakpoint. I think this issue should not block C6 and is compiler related AFAIK. I am trying to make a workaround for it in the pdb2mdb translator.
Comment 21 dean.ellis 2015-10-22 07:48:43 UTC
The other change is just waiting for Cherry Pick approval.. afaik its good to go
Comment 22 Radek Doulik 2015-10-22 09:00:15 UTC
BTW, I am unable to reproduce the end brace issue locally. So I think the issue
applies only to some VS or MS C# versions.

I use VS 2015, MS Visual C# Compiler
Comment 23 Peter Collins 2015-10-26 14:03:36 UTC
My mistake. I definitely conflated this and Bug #34478 in Comment #19.

The core behavior being tracked here is the first debugger stop during app launch resolves wrong trailing brace on startup. I can reproduce that on our current stable, and this behavior has been the same all the way back to at least C5SR2 (XA I see the same behavior in XS, VS 2012, 2013 and 2015.

I'm unable to reproduce this specific issue on XA 4.20.x builds (XVS 3.9.x). In this case, the debugger does not stop _anywhere_ on app start up. Neither the second breakpoint (on the first brace) nor the second brace are ever hit during debugging.

I'm going to lower the severity here slightly, I believe that this is not something we need to attempt to rush to fix for cycle6-baseline. This behavior has been the same in the stable channel for roughly four months now, and my perceived impact of the issue at hand is not critical enough to warrant us breaking freeze.