Bug 30318 - [XA 5.1] Xamarin.Android Breakpoints in Forms PCL project do not work after cleaning solution, redeploying, and restarting debugging
Summary: [XA 5.1] Xamarin.Android Breakpoints in Forms PCL project do not work after c...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger (show other bugs)
Version: 5.1
Hardware: PC Windows
: High blocker
Target Milestone: 5.1.4 (C5SR2)
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2015-05-21 14:56 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-10-26 08:58 UTC (History)
13 users (show)

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


Attachments
Test case (278.02 KB, application/zip)
2015-05-21 14:56 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Log files and version info (214.94 KB, application/zip)
2015-05-21 14:59 UTC, Brendan Zagaeski (Xamarin Team, assistant)
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:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2015-05-21 14:56:22 UTC
Created attachment 11287 [details]
Test case

[XVS.Android 3.11] Breakpoints in Forms PCL project do not work after cleaning solution, redeploying, and restarting debugging

At first glance, this looks very much like Bug 30057, but one key difference here is that I was _not_ able to reproduce the problem in Xamarin Studio on Windows.




## Regression status: REGRESSION in 3.11

### Bad
Xamarin   3.11.576.0 (b28d0a1)
Xamarin.Android   5.1.2.0 (2485523223ffb88567f101866d5f73da7a37ca53)

### Bad
Xamarin   3.11.570.0 (1201a03)
Xamarin.Android   5.1.2.0 (2485523223ffb88567f101866d5f73da7a37ca53)

### Bad
Xamarin   3.11.445.0 (5061f92)
Xamarin.Android   5.1.0.115 (d23da369e436488f38c8ab8fe8a9ae7d9ea5256b)

### Good
Xamarin   3.9.547.0 (20fd2f0)
Xamarin.Android   4.20.2.1 (86274adfc6418b4c3a9d67734eb871163859b51c)




## Steps to reproduce

1. Open the attached test case in Visual Studio. The only difference is the contents of `App.cs`.

2. Ensure you have a breakpoint or two set in the `Foo()` method.

3. Debug the app in the Debug configuration on emulator or device.

4. (Optional) Tap the "Tap this button" button. (The breakpoints will work this time.)

5. Stop debugging.

6. Clean the "FormsApp1.Droid" project.

7. (Optional) Delete the "FormsApp1" app from the device.

8. Repeat steps 3 & 4.




## Results

The app does _not_ resolve the breakpoints in the `Foo()` method, and the debugger does _not_ break on them after step 8.




## Expected results

The app _should_ resolve the breakpoints in the `Foo()` method in step 8 and the debugger _should_ break on them in exactly the same way as it does in step 4.




## Result in Xamarin Studio on Windows

The app resolves the breakpoints every time _unless_ you perform steps 1-6 in Visual Studio and _then_ switch to Xamarin Studio. (It seems Visual Studio is leaving something behind in the `bin` and `obj` folders that messes things up in either IDE.)




## Partial workarounds

A. After step 6, manually delete all of the `bin` and `obj` folders from the solution directory.

or

B. After step 8, stop and restart debugging again _without_ cleaning.




## Version info (brief)

Verbose version information will be included along with logs in a follow-up attachment.


### Android devices

- Xamarin Android Player 0.3.7 (1), Nexus 4 KitKat (API 19)


### Windows 8.1 (64-bit) in VMWare Fusion 6.0.6 (2684343) (with 2 CPU cores
assigned to the VM)

Xamarin   3.11.576.0 (b28d0a1)
Xamarin.Android   5.1.2.0 (2485523223ffb88567f101866d5f73da7a37ca53)
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-21 14:59:18 UTC
Created attachment 11288 [details]
Log files and version info

Note: I collected these logs with "Project Options -> Android Options -> Use Fast Deployment" OFF whereas the test case in comment 0 has this setting ON.

In my tests that setting didn't have an effect on the results. Nevertheless, apologies for that discrepancy.
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-21 17:37:12 UTC
> A. After step 6, manually delete all of the `bin` and `obj` folders from the
> solution directory.


In fact, it is sufficient to delete a single file (which is the only file left in the `bin` folders after cleaning):

> FormsApp1\bin\Debug\FormsApp1.dll.mdb
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-21 18:10:22 UTC
Ah ha. Thanks to the clue in comment 2, I can now reproduce in Xamarin Studio on Windows as well. It turns out the difference between IDEs is just the default behavior of cleaning a single project in VS as compared to XS.

To reproduce in Xamarin Studio, perform the same steps as in VS, but modify step 6:

> 6A. Clean the "FormsApp1.Droid" project.
> 6B. Clean the "FormsApp1" PCL project.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-21 18:19:22 UTC
Changing bug assignment from VS to Android per comment 3.
Comment 14 Peter Collins 2015-05-27 13:19:51 UTC
Unfortunately the original fix attempt did not address this issue, and as a result we will be moving to the SR2 milestone.
Comment 18 Peter Collins 2015-06-03 16:47:47 UTC
I believe there is an additional patch in master/1e703c7 that should resolve this issue. @Dean is there anything else that I'm missing?
Comment 19 Ben Beckley 2015-06-05 16:13:24 UTC
I am still encountering the issue when using XVS master 5.1.53 (1fa6e363). The breakpoint is being hit the first time around, but not after the Droid project is cleaned. Cleaning the Droid project, PCL project, or whole solution does not result in the FormsApp1.dll.mdb being deleted. Though deleted the .mdb file and deploying the app will result in the breakpoint being hit as expected.
Comment 21 dean.ellis 2015-06-09 12:08:46 UTC
Fixed in monodroid/master/5cbe5dd2
and 
monodroid/master/22d12104
Comment 22 Ben Beckley 2015-06-09 17:22:48 UTC
I have verified that Dean's fix works in XVS master 5.1.70 (and 5.1.71) as I am able to resolve breakpoints when following the original reproduction steps. Also, to be thorough, it is possible to reproduce the issue in the previous master XVS 5.1.69 build.

Test Environment : https://gist.github.com/BenBeckley/7d079b1b0a8fdb68c84a
Comment 23 Saurabh 2015-06-12 03:06:36 UTC
I have checked this Issue with latest build of C5SR2 and observed that breakpoint gets hit every time even after cleaning project. This is the screencast for the same: http://www.screencast.com/t/Ar4yNakRu

VS 2013
XVS 3.11.662
Comment 24 Udham Singh 2015-10-26 08:58:32 UTC
I have checked issues 34478, 35059 and 30318 with Xamarin.VisualStudio_4.0.0.1625_c77300203c9265206d832f9c60b52c17a068e4ed (latest from C6 lane) and observed that the fix for these issues have been merged with C6 lane builds.

Also I have checked these issues on mac with mono-android-6.0.0-22_cc4352949cff70188c7c4e3eded9086465536d20 (latest from C6 lane) and noticed that these issues are working fine.

Environment Info (Mac): https://gist.github.com/Udham1/8d6a3b03e8b498befb20
Environment Info (Windows): https://gist.github.com/Udham1/41dbc052b5379fec4ae2