Bug 56222 - Breakpoints are not working after installing Mono Framework MDK
Summary: Breakpoints are not working after installing Mono Framework MDK
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: 6.3 (15.1)
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 15.3
Assignee: David Karlaš
Depends on: 56231
  Show dependency tree
Reported: 2017-05-11 12:19 UTC by Ionut Holbia
Modified: 2017-06-07 07:58 UTC (History)
11 users (show)

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

Test case (too simple) that does NOT show the issue (348.79 KB, application/zip)
2017-05-11 18:02 UTC, Brendan Zagaeski (Xamarin Team, assistant)
logs 5/30 (14.88 KB, application/zip)
2017-05-30 18:18 UTC, Andrew

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:

Description Ionut Holbia 2017-05-11 12:19:35 UTC
After updating to Mono framework MDK breakpoints were not working anymore in my Xamarin Mac project.
The breakpoints that were not working were in a PCL library. Breakpoints that I had in AwakeFromNib (main xamarin.mac project) function worked fine.
I don't know if the issue was related to PCL libraries or that the code were I wanted to break, was not executed on the Main UI thread.

After downgrading to Mono 4.8.1 everything worked fine again.
Comment 1 Andrew 2017-05-11 15:12:14 UTC
verified.  same here.  

Xamarin Studio Mac. no breakpoints working with Mono
Visual Studio Preview Mac.  limited breakpoints working.

I have downgraded to 4.8.1
Comment 2 Ruben Buniatyan 2017-05-11 16:47:57 UTC
Same here.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-11 18:02:02 UTC
Created attachment 22097 [details]
Test case (too simple) that does NOT show the issue

## Confirmation status

Not yet confirmed in a minimal Xamarin.Mac app, but this is quite possibly the same Xamarin Studio compatibility issue with the new portable PDB debugging format that I _have_ replicated with Xamarin.Android apps (Bug 56231, Comment 2).  Visual Studio for Mac worked successfully for me for the Xamarin.Android project.  (See below for some additional information about updating from Xamarin Studio to Visual Studio for Mac.)

## Steps attempted to replicate

1. Open the attached test case in Xamarin Studio.

2. Set a breakpoint on PortableLibrary1/MyClass.cs, line 12.

3. Build and run the application in the Debug configuration.

(This test case calls the method in MyClass.cs on a background thread.)

## Results

Xamarin Studio breaks successfully on PortableLibrary1/MyClass.cs line 12.

## Testing environment info (brief)

Xamarin Studio 6.3 (build 864) (6c2f673)

Mono (2017-02/9667aa6) (64-bit)

Xcode 8.3 (12169), Build 8E162

macOS 10.12.4
US English locale, US Eastern time zone

## Suspicion

This issue might be caused by the new portable PDB debugging file format used by Mono 5.0 and the rest of the Xamarin "15.2" release (https://releases.xamarin.com/stable-release-15-2/).  Using Visual Studio for Mac with the Xamarin "15.2" release is strongly recommended.  It is possible my attached test case is too simple to hit some newer part of the portable PDB format, and so it still works in the old Xamarin Studio version 6.3.

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 fully forwards-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/

## Possible next steps

- The first recommended thing to try for any user seeing an issue with breakpoints in Xamarin Studio would be to update to Visual Studio for Mac.

- If the latest Stable channel version of Visual Studio for Mac shows the same issue, then if the original reporter or another user might by chance have a small Xamarin.Mac test case or some hints about how to modify the attached test case to replicate the issue, that would be excellent.

- Alternatively, if the attached test case fails for the original reporter, you can reply with that information too.  In that case, the issue might depend some specific environment that does not quite match my local test environment.

Comment 5 Kirill Osenkov 2017-05-11 22:51:37 UTC
Setting status to Assigned
Comment 6 Ionut Holbia 2017-05-12 07:30:48 UTC
With Visual Studio for Mac everything works fine.
Comment 7 Andrew 2017-05-12 13:13:22 UTC
breakpoints work about 20% of the time in Visual Studio Mac.  the other 80% of the time nothing get hits.  Yes, it is better than Xamarin Studio with 0% being hit.  For some reason, Visual Studio Mac, iOS projects hit the breakpoints better than Android.  still not always
Comment 8 Andrew 2017-05-12 13:14:13 UTC
I would use Xamarin Studio, but files do not want to be saved after changes and I lose hundreds of lines of code (it a known bug and told it being fixed)
Comment 9 William McAinsh 2017-05-15 14:15:12 UTC Comment hidden (obsolete)
Comment 10 Ruben Buniatyan 2017-05-15 18:07:15 UTC Comment hidden (obsolete)
Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2017-05-15 18:22:19 UTC
For Comment 9 and Comment 10,

> in VS2017

As a caution, note that this bug is filed against the "Xamarin Studio" product category in Bugzilla, and the original descriptions from Comment 0 and Comment 1 are discussing Xamarin Studio.  If there are consistency issues with the debugger attachment in Xamarin Studio and Visual Studio for _Mac_, this bug will be focused on those issues on _Mac_.

For issues on Windows, I would recommend following other bugs.  Bug 56225 appears to be one applicable report for Windows, and [1] appears to be another.

[1]  https://developercommunity.visualstudio.com/content/problem/49033/cannot-debug-xamarinandroid-app-debuggerapp-immedi.html
Comment 12 Lluis Sanchez 2017-05-16 11:00:53 UTC
Xamarin Studio is not supported anymore, so you should switch to Visual Studio for Mac. If VS for Mac still has issues with breakpoints I'd need the about box information and the IDE log after such problem happens (you can get it using the Help -> Open Log Directory). Thanks!
Comment 13 Lluis Sanchez 2017-05-18 14:28:51 UTC Comment hidden (obsolete)
Comment 14 Andrew 2017-05-30 18:17:56 UTC
This is not fixed as of Mono

=== Visual Studio Community 2017 for Mac ===

Version 7.0.1 (build 24)
Installation UUID: b9d9479e-fe89-42b5-9c2b-4644399bb238
	Mono (2017-02/5077205) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500010001

=== NuGet ===


=== .NET Core ===

Runtime: Not installed
SDK: Not installed
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.2 (12175)
Build 8E2002

=== Xamarin.iOS ===

Version: (Visual Studio Community)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

=== Xamarin.Android ===

Version: (Visual Studio Community)
Android SDK: /Users/drew/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)
		7.0    (API level 24)
		7.1    (API level 25)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 25.0.6
SDK Build Tools Version: 25.0.3

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Xamarin.Mac ===

Version: (Visual Studio Community)

=== Build Information ===

Release ID: 700010024
Git revision: 7ab1ca2ced6f584e56b7a0d4d321d00775cd95c9
Build date: 2017-05-19 05:44:51-04
Xamarin addins: 08d17158f3365beee5e60f67999e607cce4b3f93
Build lane: monodevelop-lion-d15-2

=== Operating System ===

Mac OS X 10.12.5
Darwin 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
Comment 15 Andrew 2017-05-30 18:18:58 UTC
Created attachment 22560 [details]
logs 5/30
Comment 16 Lluis Sanchez 2017-05-31 08:53:51 UTC
Comment 17 Andrew 2017-05-31 13:17:35 UTC
going research today.

seems to be PCL projects are not working with breakpoints.  found a few things on the forums to try today.  I report back later.  

Any engineer is welcome to remotely connect to my computer and troubleshoot the issue.
Comment 18 David Karlaš 2017-06-01 06:06:36 UTC
Can someone who has this problem attach YourPclProjectName.dll and YourPclProjectName.pdbb file from bin/Debug folder?
Comment 19 David Karlaš 2017-06-01 20:16:44 UTC
Also try updating Xamarin.Forms to latest stable version(
Comment 20 David Karlaš 2017-06-07 07:58:42 UTC
If anyone can still reproduce this please read Comment 18 and 19.