Bug 56781 - Not hitting breakpoints in Xamarin.Forms IOS project
Summary: Not hitting breakpoints in Xamarin.Forms IOS project
Status: RESOLVED DUPLICATE of bug 56893
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: 4.5.0 (15.2)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Joaquin Jares
Depends on:
Reported: 2017-05-24 04:27 UTC by Stephen Marcus
Modified: 2017-06-05 23:09 UTC (History)
11 users (show)

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

"GOOD" test case that successfully hits breakpoints in iOS app project (139.95 KB, application/zip)
2017-06-05 22:10 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 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 Stephen Marcus 2017-05-24 04:27:31 UTC
Since installing the last two Xamarin updates, I can no longer debug a Xamarin.Forms IOS-targeted app.  None of the breakpoints are hit.

I have tried dozens of "solutions" from online forums, to no avail.

This is halting my app development work.
Comment 1 Alex Soto [MSFT] 2017-05-24 13:40:06 UTC
Are you using Visual Studio or Visual Studio for Mac? Also please include your full build logs, test case (to reproduce) and all your version information.

 To get full build logs just set the log verbosity to diagnostic at the following locations:
 - On Visual Studio for Mac: Preferences > Projects > Build
 - On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run

 On Visual Studio Windows you also want to add `-v -v -v -v` to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting `Properties`.
 Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

 The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version information (you can use the "Copy Information" button).
Comment 2 Sherlock 2017-05-24 13:55:33 UTC Comment hidden (obsolete)
Comment 3 YLNK 2017-05-26 14:07:18 UTC Comment hidden (obsolete)
Comment 4 Alex Soto [MSFT] 2017-05-26 14:21:26 UTC
Setting back to new so VS team can gather the info they need in order to fix this
Comment 5 Stephen Marcus 2017-05-26 15:26:06 UTC
Hi all, sorry if I did not clarify the failing conditions: I cannot hit break-points using an iOS physical device.  I do not use a simulator.
Comment 6 smorsi27 2017-05-27 18:35:01 UTC Comment hidden (obsolete)
Comment 7 Solvum Developer 2017-05-30 14:49:56 UTC Comment hidden (obsolete)
Comment 8 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-01 03:32:01 UTC
I will tentatively mark this bug as a duplicate of Bug 56893 based on the similarity of the scenario as described in Comment 0.

If the original reporter of the bug from Comment 0 finds that the possible temporary workaround below is not effective for their particular usage scenario, the reporter of the bug can feel free to change the status of the bug to REOPENED.  (Other users watching this bug will not be able to adjust the status of the bug, but they may file new bug reports if the temporary workaround is ineffective for a particular scenario.  If possible, a minimal test case attached to any new bug report for a scenario where the temporary workaround is ineffective would be perfect.  Thanks in advance!)

## Possible temporary workaround (from Bug 56893, Comment 2): switch the library project(s) to output "portable" PDB files rather than "full" PDB files

First, ensure you have updated to Visual Studio 2017 (26430.12) from May 30 (or XamarinVS for Visual Studio 2015) plus the corresponding Stable channel updates for Mac (including Xamarin.iOS  These latest versions include a fix for one possible cause of issues with breakpoints on iOS.


1. Open the portable class library .csproj file in a text editor.  For example, right-click the project in the Solution Explorer and select Unload Project, and then right-click it again and select "Edit ...".

2. Under the PropertyGroup for the "Debug|AnyCPU" configuration, change the DebugType to:

3. Save the change and reload the project.

4. Build, deploy, and start debugging the iOS app project again.

(In Visual Studio 2017, the DebugType setting can also be changed to "portable" under "Project Properties > Build [tab] > Advanced [button] > Debugging information".)

*** This bug has been marked as a duplicate of bug 56893 ***
Comment 9 buchholz.bastian 2017-06-01 08:57:49 UTC
The workaround in Comment 8 fixed it for me!
Comment 10 Stephen Marcus 2017-06-05 21:06:57 UTC
This works for the PCL, but does not work for the IOS project itself. I still can't get break-points inside the IOSD project.  The DebugType is "full" inside the IOS .csproj file.
Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-05 22:10:41 UTC
Created attachment 22706 [details]
"GOOD" test case that successfully hits breakpoints in iOS app project

## Steps attempted to replicate the results in Comment 10

1. Open the attached template project (Cross Platform > Master Detail, Xamarin.Forms, Portable Class Library (PCL)) in Visual Studio 2017.

2. Set a breakpoint at AppDelegate.cs line 15.

3. Start debugging the iOS application in the "Debug|iPhone" configuration on a device.

## Results

The debugger breaks successfully on the breakpoint at AppDelegate.cs line 15.

## Testing environment info (brief)

### Windows

Xamarin.VisualStudio (1be4f0c)

Microsoft Visual Studio Enterprise 2017 
Version 15.2 (26430.12) Release
Microsoft .NET Framework
Version 4.7.02046

Windows 10 (64-bit) Version 1703 (OS Build 15063.332)
US English locale, US Eastern time zone

### Mac

Xamarin.iOS (d15-2: d2270eec)
Mono (2017-02/5077205)

Xcode 8.3, Build version 8E162
macOS 10.12.4
US English locale, US Eastern time zone

### Devices

iPad Mini 2, iOS 8.0

## Next steps for the reporter of the bug

1. Check if the test case attached to this comment is able to hit a breakpoint successfully in AppDelegate.cs, line 15 in your environment.

2. If this test case _works_, then the next step would be to determine what is different about your original app project compared to the test case.

  - One possible first piece of information to provide to help determine the differences would be to attach back the .csproj file for your iOS app project.

  - Another possible test would be to try setting the DebugType to `portable` in your iOS app project .csproj file.  (When using Visual Studio for Mac, iOS app projects and libraries both produce `portable` debug symbols now as of the "Xamarin 15.2 release", so it is valid to use the `portable` DebugType for iOS application projects on Windows too if it helps.)

3. For thorough bookkeeping, attach back your detailed environment info, similar to the information provided in this comment.  For example, gather your Windows version, and then save the version info from Windows and Mac into text files and attach the files back on the bug report.

- Windows: Help > About Microsoft Visual Studio > Copy Info [button]
- Mac: Visual Studio > About Visual Studio > Show Details > Copy Information [button]

Thanks in advance!
Comment 12 Stephen Marcus 2017-06-05 23:03:24 UTC
Yup... cleaned and rebuilt, and removed OBJ and BIN, and it finally worked.  Thanks.
Comment 13 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-05 23:09:46 UTC
Ah good.  Thanks for the follow-up info.  I'll set this bug back as a duplicate for bookkeeping.

*** This bug has been marked as a duplicate of bug 56893 ***