Bug 56231 - Can't hit breakpoints after upgrading to 7.3.0
Summary: Can't hit breakpoints after upgrading to 7.3.0
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger ()
Version: 7.3 (15.2)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
: 56595 ()
Depends on:
Blocks: 56222
  Show dependency tree
Reported: 2017-05-11 16:15 UTC by Justin Toth
Modified: 2017-05-29 07:23 UTC (History)
5 users (show)

Tags: 15.2R
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 for Bug 56231 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:

Description Justin Toth 2017-05-11 16:15:28 UTC
Yesterday I upgraded to Xamarin.Android 7.3.0, and now none of my breakpoints get hit. I've tried many things to try to get breakpoints to work again, but no luck:

- Cleaning the solution
- Deleting the bin / obj folders
- Closing and reopening Xamarin Studio
- Restarting my Mac
- Creating a new Android project
- Rolling back to Xamarin.Android 7.2, Xamarin.Mac 3.2, and Xamarin Studio 6.2.1.

It doesn't make sense to me that even after creating a brand new project and running it with rolled back Xamarin versions, it still doesn't work. This should eliminate it being the code, and eliminate it being the Xamarin update, and yet it still doesn't work.

The pdb files are generated. I have my configuration set to Debug-Dev, this has Debug Information set to Full, and Define Symbols set to DEBUG;__ANDROID__

You can see that others are having the same issue: https://forums.xamarin.com/discussion/comment/272753
Comment 1 Claudio Redi 2017-05-11 16:36:56 UTC
Same here, only thing I did was to install Mac Visual Studio Version 7.0 (build 3146). I explicitly say to not upgrade any component unchecking everything except IDE but I see mono was upgraded to 5.0 after installing visual studio.
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-11 16:50:06 UTC
## Confirmation status: Confirmed backwards-compatibility breakage for Xamarin Studio

Please update to Visual Studio for Mac for compatibility with the new portable PDB debugging format that is used starting in Xamarin's "15.2 Release".  Thanks!

Additional information:

As announced at the Microsoft Build conference, Visual Studio for Mac [1] is now generally available [2]. It is the recommended environment for Xamarin developers on Mac moving forward. Visual Studio for Mac has all the features of Xamarin Studio, adds cloud and web development, and contains improvements for cross-platform mobile development.

To get started with Visual Studio on Mac, download and run the Visual Studio for Mac installer from [1]. It will leave Xamarin Studio unchanged, update the other Xamarin packages to the current versions, and install the Visual Studio for Mac app. Xamarin Studio can continue to be used alongside Visual Studio for Mac if desire, but as you found, it is not compatible with the new portable PDB debugging symbols file format used by Xamarin's "15.2 Release".

[1] https://www.visualstudio.com/vs/visual-studio-mac/
[2] https://blogs.msdn.microsoft.com/visualstudio/2017/05/10/visual-studio-for-mac-now-generally-available/

## Rolling back

> Rolling back to Xamarin.Android 7.2, Xamarin.Mac 3.2, and Xamarin Studio 6.2.1.

I believe you would also need to roll back to Mono 4.8.

(In case it's helpful, https://releases.xamarin.com/stable-release-15-2/ includes the full list of previous versions and download locations.)

## Status update

I will resolve this bug as "answered" for the moment.  If you find that updating to Visual Studio for Mac does not resolve the issue for some remaining scenarios, feel free to add a few additional notes about the scenario that's failing and set the bug status to REOPENED.  Thanks!

(I tested locally with just a simple "Android > Android app" project.  Breakpoints failed in the old Xamarin Studio 6.3 version, but worked successfully in Visual Studio for Mac 7.0 (build 3146).)
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-11 16:52:05 UTC
> feel free to add a few additional notes about the scenario that's
> failing and set the bug status to REOPENED

If any user other than the original reporter finds a scenario that's failing after updating to Visual Studio for Mac, please file a new bug report with the additional details (since only the original reporter of the bug can change the bug Status).  Thanks!
Comment 4 Claudio Redi 2017-05-11 16:56:38 UTC
@brendan: I tried to downgrade but it's impossible for me to download Mono 4.8.1 from archive... download speed is 1 byte per hour

Trying to download from here https://download.mono-project.com/archive/4.8.1/macos-10-universal/
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-11 17:03:42 UTC
> download speed is 1 byte per hour


One option is that it is likely you still have Mono 4.8.0 on-disk due to the way the Mono framework performs updates.  You can check if the following 2 commands work in a Terminal.app command prompt (you will need to enter an administrator password after the first command):

sudo unlink /Library/Frameworks/Mono.framework/Versions/Current

sudo ln -s /Library/Frameworks/Mono.framework/Versions/4.8.0 /Library/Frameworks/Mono.framework/Versions/Current

You can also try downloading from the Xamarin mirror, but I believe it is hosted on the same Microsoft CDN, so the download speeds might be the same depending on your geographical location and your ISP:
Comment 6 Claudio Redi 2017-05-11 17:09:16 UTC
Thanks Brendan, I really appreciate your help for now I won't innovate until I know what's going on. Right now I can't debug on Android but at least I can do it on iOS :) 

I don't want to risk to make a bigger mess for now.

Will be paying attention to the evolution of this problem since it's happening to a lot of people.
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-11 17:49:49 UTC
## Alternate possible temporary workaround for users who have hit this issue after _updating_ (as opposed to a fresh install on a new machine)

(For users who might wish to continue to use Xamarin Studio 6.3 for a little while before transitioning completely to Visual Studio for Mac.)

1. Set "Project > Active Runtime" to "Mono 4.8.0 (8f6d0f6) (/Library/Frameworks/Mono.framework/Versions/4.8.0)".

2. Rebuild the Android app project.

### Explanation

By default the Mono 5.0 installer will leave the Mono 4.8 tools installed alongside the new Mono 5.0 tools.  When the Xamarin.Android build process runs under Mono 4.8, it will generate the old .mdb debugger symbol file format for user assemblies, so the Xamarin Studio debugger will be able to use those symbols.  Do note though that the _framework_ debugger symbols files for Xamarin.Android are all shipped as portable .pdb files starting with Xamarin.Android 7.3, so stepping into _framework_ code (as opposed to _user_ code) still would not work as expected.
Comment 8 Claudio Redi 2017-05-11 18:03:30 UTC
Debugging is back, thanks Brendan Zagaeski!
Comment 9 Justin Toth 2017-05-11 20:06:10 UTC
Same for me, Visual Studio for Mac works, thanks!! 

One thought... Debugging no longer working and the suggestion to use Visual Studio now implies that Xamarin Studio is no longer supported, however Xamarin Studio updates are still being released, which implies it still is supported. I know you all are going through a transition right now, but maybe if it's made clear whether it's supported or not, it'll help others not lose time over this and future issues in Xamarin Studio.
Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-11 20:39:48 UTC
(Typo corrections for Comment 10, now marked non-public for tidiness.)

> "Xamarin Studio updates are still being released"

Today's new Xamarin Studio Stable channel version was released specifically to provide a prompt about updating to Visual Studio for Mac that displays the following text:

> Visual Studio for Mac is now available
> Visual Studio for Mac is Microsoft’s fully-featured IDE for developers
> on Mac. It has all the features of Xamarin Studio, adds cloud, web,
> and game development, and contains improvements for cross-platform
> mobile development.
> [Cancel] [Install Visual Studio for Mac]

> "if it's made clear whether it's supported or not"

In case it's helpful for reference, there is messaging about the status of Xamarin Studio and Visual Studio for Mac in the following locations:

Comment 12 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-11 21:27:57 UTC
(I'll also check with the team about making the wording in the new dialog a little clearer about _recommending_ that users update rather than just _offering_.)
Comment 13 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-18 16:05:08 UTC
*** Bug 56595 has been marked as a duplicate of this bug. ***
Comment 14 Justin Toth 2017-05-24 15:11:36 UTC
So unfortunately I can't use Visual Studio for Mac. I've tried for a few weeks and the intellisense and auto completion are totally broken, and I'm tired of fighting the IDE while trying to code. It seems like Visual Studio for Mac isn't ready for primetime yet...

@Brendan Zagaeski - I'm back to trying to get debugging working in Xamarin Studio. I saw your note on going to Project > Active Runtime, however there is no Active Runtime option under the Project menu. What am I missing?
Comment 15 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-24 15:39:44 UTC
> there is no Active Runtime option under the Project menu. What am I missing?

One thing to note is that that menu option only appears once a project is opened.

## Another possible temporary workaround

Another approach that would not require downgrading Mono 5.0 to Mono 4.8 (I tested briefly locally) is to switch back to using `mcs` for the compiler, and be sure that `xbuild` is used as the build tool.  This will similarly switch the build process back to generating .mdb debugger symbols rather than the new portable PDB symbols.

1. Add the following PropertyGroup element to the bottom of the .csproj file for your app project just before the closing </Project> tag:

<PropertyGroup Condition=" '$(OS)' == 'Unix' ">

2. Disable "Xamarin Studio > Preferences > Build > Build with MSBuild instead of xbuild" if it is enabled (it is disabled by default, but some users might have enabled it in the past).

3. Close and reopen the solution to ensure the new setting is used.

4. Clean and rebuild the project.

(See also the "Temporarily switching back ..." section on https://releases.xamarin.com/common-issues-from-the-xamarin-15-2-release-being-tracked-by-the-xamarin-team/ for a little additional background information.)