Bug 42200 - Debugger does not step into PCL methods (it just skip them) / hit breakpoints in PCL
Summary: Debugger does not step into PCL methods (it just skip them) / hit breakpoints...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Joaquin Jares
Depends on:
Reported: 2016-06-28 09:43 UTC by softlion
Modified: 2017-03-30 10:18 UTC (History)
7 users (show)

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

Test case that worked OK in Cycle 8 confirmation attempts (12.50 KB, application/zip)
2016-09-21 04:04 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 softlion 2016-06-28 09:43:09 UTC
New bug in this stable release:
you can not step into a method defined in a pcl lib from a method in the ios app.

- create an ios app
- creata a pcl project with a dummy class and method
- from within the ios app instantiate the class and call this method.
- debug the app using visual studio 2015 (latest versions with all updates) and a mac connection to an ios simulator (i used ihone 4s / ios 9.3)
- try to step into the pcl call

result: the debugger silently ignores all methods in the pcl.
Clean / rebuild does not fix the problem.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-21 04:04:21 UTC
Created attachment 17628 [details]
Test case that worked OK in Cycle 8 confirmation attempts

## Initial confirmation attempts: not yet able to confirm

- I was able to hit a breakpoint in a new template project iOS app and step into the PCL method when I followed the steps to reproduce as described in Comment 0.  (Test case attached.)

- As an additional check, I was also able to hit the breakpoint in the test case from Bug 42359 on simulator in the current Cycle 8 builds.

## Next steps

- Does this issue still occur for you with the Xamarin Cycle 8, XamarinVS 4.2.0 (or higher) versions?

- If so, does the attached test case show the problem in your environment: are you able to step into the PCL method `DummyMethod()` successfully after setting a breakpoint in `ViewController.cs`?

- If the attached test case _does_ work, if you would be able to zip up and attach a minimized test case that does _not_ work as expected, that would be perfect.

Thanks in advance!

## Additional information

The original description in Comment 0 sounds roughly similar to Bug 42359, but Bug 42359 does seem to be fairly strictly limited to device builds, and at that only device builds where "Project Properties > iOS Build > General [tab] > Enable device-specific builds" is ON.
Comment 2 softlion 2016-09-21 07:23:25 UTC
This problem is fixed.

But there is another problem on Android only: exceptions inside Task.Run() blocks are not catched by a global TaskScheduler.UnobservedTaskException handler.
Comment 3 softlion 2016-09-24 08:12:04 UTC
Hey, this problem is not fixed.
I just stumbled upon it.

Enable device specific build in not checked.

This is an extract of the class and method which is not hit. The class is in the pcl:

    public class SvgTransformParser<TMatrix>
        where TMatrix : class, IMatrix, new()
        private static readonly Regex MultitransformPattern = new Regex(@"(\w+\([\d\s\-eE,.]*\))");

        public static TMatrix ParseTransform(string pString) {

This method is called from an ios library project, which is called from an ios app project.

The method's content in the ios library project is :

    return SvgTransformParser<MatrixImpl>.ParseTransform(theString).Matrix;

When stepping in, the debugger steps into the Regex constructor.
When adding breakpoints (bp) in the ParseTransform method, the debugger never hits this bp.
Comment 4 softlion 2016-09-24 08:12:41 UTC
Note that this is in C8 (stable) + xcode 8 on iphone 5s ios 10.0 simulator.
Comment 5 softlion 2016-09-24 08:13:58 UTC
The PCL project is using Profile 111
Comment 6 Nathan 2016-10-18 14:25:53 UTC
I am also having this problem in XS on a Mac.
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2016-10-18 18:30:35 UTC
## Note to the Xamarin team

Especially in light of Comment 6, I suspect this might have the same underlying cause as Bug 45116.
Comment 8 Arash D 2016-10-27 10:59:33 UTC
Hi all,
This is my setup and i still can't get breakpoints to hit inside Async methods, Also the XS for macOS 10.12 is alot buggy like heck, huge bummer

Xamarin Studio Community
Version 6.1.1 (build 15)
Installation UUID: e581e12f-7977-4977-97cd-e93a87456527
	Mono 4.6.1 (mono-4.6.0-branch-c8sr0/abb06f1) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406010003


Not Installed

Apple Developer Tools
Xcode 8.0 (11246)
Build 8A218a

Not Installed

Not Installed

Xamarin Android Player
Not Installed

Version: (Xamarin Studio Community)
Hash: 3983064
Branch: cycle8-sr0-xi
Build date: 2016-09-23 15:34:54-0400

Build Information
Release ID: 601010015
Git revision: fa52f02641726146e2589ed86ec4097fbe101888
Build date: 2016-09-22 08:03:02-04
Xamarin addins: 75d65712af93d54dc39ae4c42b21dfa574859fd6
Build lane: monodevelop-lion-cycle8-sr0

Operating System
Mac OS X 10.12.0
Darwin A-Mac.local 16.0.0 Darwin Kernel Version 16.0.0
    Mon Aug 29 17:56:20 PDT 2016
    root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64
Comment 9 Rolf Bjarne Kvinge [MSFT] 2016-10-28 11:00:19 UTC
(In reply to Brendan Zagaeski from comment #7)
> ## Note to the Xamarin team
> Especially in light of Comment 6, I suspect this might have the same
> underlying cause as Bug 45116.

Bug 45116 only occurs when exceptions are thrown (and only in certain scenarios), and does not affect breakpoints / stepping in any way, so it's not related.
Comment 10 Joaquin Jares 2016-12-26 11:37:19 UTC
Just to separate the issues:
@softlion, your problem is an iOS app -> an iOS Library -> a PCL, and then breakpoints in the PCL are not hit? There was an issue pre-C8 with PCL that where indirect references but it should be solved now. If this is the issue then do tell and I'll tell you what to check. It may be an easy fix.

@Nathan @Arash this bug is for the debugger in VS. Please do add a new bug for VS for Mac (using Xamarin Studio for the product, because it's that team that is handling the issues). This bug is only seen by the Visual Studio team (not VS for Mac). A bug in the other product will get you more visibility.
Comment 11 softlion 2017-03-30 10:18:45 UTC
Fixed in latest beta.