Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 17804 [details]
VS debugger not hitting the breakpoints when using bait-and-switch trick on iOS
Breakpoints placed in a PCL called using bait-and-switch trick are not hit on iOS.
No problem on Android and when not using the bait-and-switch trick on iOS.
# Steps to Reproduce
1. Download sample
2. Open solution in Visual Studio
3. Deploy TestBreakpoint.iOS to iOS (I'm using the simulator and iPhone 5 iOS 10.0)
4. Make sure you have a breakpoint set on line 10 in file Class1.cs in project Breakpoint.iOS.
5. In the app, click on the message.
# Expected Results
Tapping message should cause breakpoint set in step 4 to be hit
# Actual Results
The counter in the message does increase as expected, but breakpoint is not hit
Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Installed Version: Community
Xamarin 220.127.116.115 (7603786)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android 18.104.22.168 (c1d1c79)
Visual Studio extension to enable development for Xamarin.Android.
Xamarin.iOS 10.0.0.1 (29910bb)
Visual Studio extension to enable development for Xamarin.iOS.
iOS simulator 0.10.0.6
Do you have any update on this issue ?
Sorry, but no, there is not. This has been brought to the developers' attention, and is currently on the milestone for the next release. We plan to have a beta available sometime during the next month.
Yes, would be very helpful
I do not believe this workflow is supported as the Bait and Switch(Advanced PCL Trick) approach is mostly the inner workings of NuGet.
Specifically NuGet will *always* prefer a platform library to a PCL one. Because of this, Bait and Switch is possible.
As for debugging this item, you would directly need to reference your iOS library implementation to your iOS startup project and exclude the PCL invocation. You can add a copy of TestBreakpoint(PCL) "MyClass.cs" to the TestBreakpoint.iOS project and then the debugger should work just fine while you're testing the functionality preparing your library for NuGet.
You could potentially keep it on the NuGet end and ship symbols with your library http://docs.nuget.org/ndocs/create-packages/symbol-packages in which you can setup a CI environment to debug that way. It's really up to you at that point.
Hi, it happens not only when using nuget
have a look at https://github.com/escamoteur/Plugin.MediaLibrary
if you try to set a breakpoint in th iOS part of the plugin project and run the sample it won't hit the breakpoint
I'm sorry but as the creator of this bug report, I cannot accept this bug being updated to "RESOLVED ANSWERED", for two reasons:
- I'm not using nuget at all in the original sample I've attached, so comment#4 is irrelevant.
- this is a very common pattern, it works perfectly on Android, and I expect the same behavior on iOS.
Could you please reopen and fix this issue ?
Can you please try this project structure and let me know if it works for you in Visual Studio?
Please note: You may need to delete the bin/obj folders inside each project for a fresh cache.
I've ensured the Assembly names are correctly defined in the Breakpoint.iOS project and it seems to break fine for me:
I was able to replicate the original behavior in Xamarin Studio, so it seems like a potential issue with how Xamarin.iOS names Assemblies in each IDE. Secondly, I was able to change the Assembly name within XS and load the project in both VS/XS(Mac) and VS(Windows) in which the debugger now hits the appropriate breakpoint as shown above in the screenshot. I will have to investigate this further in the morning.
Xamarin 22.214.171.1241 (2c75d6d)
Xamarin.Android 126.96.36.199 (0a4ab55)
Xamarin.iOS 10.4.0.1 (7c50b27)
I confirm the "TestBreakpointWorks" does work in Visual Studio (it breaks fine).
What's the difference compared to the original project (apart from renaming the assembly) ??
I have compared both original and modified projects and found that if an order of dependency declarations in the TestBreakpoint.csproj file will be as follows:
then the debugger breaks correctly, otherwise (as was done in the original project) will not.
Sorry for the typo, I meant TestBreakpoint.iOS.csproj file
That's really interesting, I will try with my project if that solves it too
@Artem Thanks for getting to this before I did. Yes this is indeed due to how Visual Studio creates ProjectReferences and then how Xamarin Studio does. Thus the behavior between VS and XS is inconsistent.
I can indeed confirm that this behavior works in my sample project
Thus the PCL project must be first in the Project References followed by the implementation.
This should be fixed on the latest stable. Marking as Fixed for internal verification. Please reopen if you are still seeing the issue.