locked
Breakpoints not being hit for Android and Xamarin Forms RRS feed

  • Question

  • User121294 posted

    Hi all. I've seen a lot of issues with breakpoints not being hit for Xamarin. The most recent issues seem to state that this is only affecting iOS and is fixed on Android, but I am having the issue with Android, and it seems to be more prominent/happen all the time after I performed the latest Xamarin upgrade.

    I am running the latest version of Xamarin for VS, we are using Xamarin Forms, and we have a PCL as our shared library. I've tried debugging on an actual device and on emulators (Genymotion) running both Android 4.4.4 and 5.1.0, but no matter what, no breakpoints are hit.

    I've tried the following "fixes" previously mentioned in various places on the forum, but none seem to work: - Restart computer/VS - Do clean solution and rebuild solution - Delete bin and obj folders - Make sure fast deployment is unchecked

    Are there others having any issues? If not, does anyone else know how to resolve it?

    Monday, May 11, 2015 5:02 PM

All replies

  • User119398 posted

    I'm having the same problem with Android. I've had some luck with deleting the mdb files for my app, but that doesn't always work.

    Tuesday, May 12, 2015 4:52 PM
  • User84937 posted

    Same problem here, any news?

    Tuesday, May 19, 2015 7:18 PM
  • User54258 posted

    Same problem here as well. Actually this makes developing quite hard.

    Wednesday, May 20, 2015 12:17 PM
  • User121294 posted

    My issue ended up being resolved by upgrading to one of the latest Alpha versions of Xamarin. (It broke other functionality like .ipa deployment for Apple), but at least I'm able to hit breakpoints.

    Sometimes the debugger still crashes, but not very often any more. So I would recommend upgrading Xamarin from their Alpha release channel and see if that helps you.

    Wednesday, May 20, 2015 1:06 PM
  • User126228 posted

    Same problem here, on Windows 8.1, Xamarin Studio/VS2013.

    CAUSE (IMO): The issue seems to be caused by rebuild process that does not delete *.dll.mdb files. In fact if you try to execute a Clean you will notice that in \bin\Debug those files are still there. So with a Build or a Rebuild (Rebuild is a Clean + Build) you will have the old .mdf files and debugger will not work.

    MY SOLUTION: The only thing that works in my case is manually (or better with a script) delete all *.dll.mdb files from \bin\Debug of all solution projects (so Android project AND and PCLs).

    Let me know if this helps!

    Friday, May 22, 2015 3:15 PM
  • User36175 posted

    I cant hit the breakpoint when i try to debug my android project, also tried with Alpha same issue.

    I also tried to delete the whole \bin\Debug folder..

    Tuesday, May 26, 2015 9:52 PM
  • User107505 posted

    deleting the bin and obj directories worked for me!

    Wednesday, May 27, 2015 9:17 AM
  • User107608 posted

    I had the same problem in Xamarin Android. My project was cleaning just fine, deleting everything on both bin and obj folders so I was clueless as the other suggestions.

    What worked for me was manually uninstalling the application on the tablet I'm using for debugging purposes. Not only my application, but the Mono Android Support and the Mono Shared Runtime.

    In my case, as I'm testing multiple projects, I had installed 3 Mono Android Support (16, 19 and 21 if I remember correctly) and I believe this was causing issues, so I let the software install all from 0, I only have Mono Android-19 Support, which is the one I'm using and my debugger works just fine.

    Wednesday, May 27, 2015 1:25 PM
  • User36175 posted

    I did the following.

    1. Deleted the bin and obj directories
    2. Uninstalled the Application
    3. Uninstalled the Mono Runtime

    And im still not able to hit the breakpoint hmm..

    Wednesday, May 27, 2015 6:08 PM
  • User102481 posted

    Uninstalling the shared run time, mono android support and application then running again worked for me.

    Thursday, May 28, 2015 5:50 AM
  • User137867 posted

    none of these solutions are working for me. What makes it frustrating is that debugging my app was working fine, then just stopped and that debugging still works on the sample Forms apps. Tried on different physical devices and the emulator, tried different versions, tried deleting all bin / obj folders / manually deleting app.

    Xamarin Forms looks like a good solution but at the moment this issue makes it unusable as a development tool.

    Thursday, June 25, 2015 9:32 AM
  • User53128 posted

    It's just suddenly stopped working here as well. I'm getting a bit fed up with the overhead of battling with my tools lately. I'm making no progress at all.

    I'm opting for a complete reinstall of Xamarin, Xamarin Studio and Android SDK.

    Everytime I close an Android x86 emulator it pops up an error message saying that it crashed. I've been seeing lots of what look like system errors in the Android Device Log window in Visual Studio as well.

    We'll see I guess.

    Thursday, June 25, 2015 12:28 PM
  • User53128 posted

    Ahhh OK, seems I'm not the only one with the x86 error. It seems to be related to using GPU Acceleration:

    Issue: Emulator crashes on exit when emulator is using GPU acceleration

    Thursday, June 25, 2015 12:44 PM
  • User68779 posted

    Deleting the bin and obj directories didn't work for me. Very frustrating how much time I spend on the tool not working correctly. I hardly dare to install updates anymore because there is a good change that something will not work after. But this one just suddenly came up. I did install Android SDK 4.1.2. Mayby that caused it?

    Friday, June 26, 2015 3:13 PM
  • User68779 posted

    Sorry didn't mean to troll. Deleting all *.mdb files solved the problem.

    Friday, June 26, 2015 8:32 PM
  • User53128 posted

    I feel the same about the tools at the moment. I've been provided with two beta builds in the last two days by Xamarin in order to test it on their behalf.

    I didn't pay for this. I've got deadlines to hit.

    Saturday, June 27, 2015 8:53 AM
  • User138972 posted

    Is there a solution to this problem? I find the feedback from Xamarin absolutely useless. I have this problem where my app runs fine but crashes where I put a breakpoint. No reason other than Object reference not ........

    Thursday, October 8, 2015 4:53 PM
  • User64972 posted

    This problem just started for me as well and I've had it before. I've tried all suggestions. Any official response from Xamarin?

    Also, the small icons in the breakpoint panel have disappeared.

    Monday, October 19, 2015 7:42 AM
  • User166197 posted

    I've found that the name of the folder that contains your project can make a difference. Do you have any spaces or punctuation characters in yours?

    The folder name is often the same as the project name, but it doesn't have to be. I had a Xamarin Android project called "Engagement (Android)" within a solution, and by default it was stored on disk at ...\Engagement (Android)\Engagement (Android).csproj

    No matter what I did, it wouldn't hit breakpoints. Brand new projects that I added (called Test1, Test2, etc) - debugged perfectly.

    When I changed the folder name to "Engagement_Android" (keeping the same project name) - it started hitting breakpoints again.

    Other symptoms that went with this included the "Clean Project" option not clearing all the files from the bin/debug folder (it left behind the project's main DLL and PDB file).

    The thing that nailed it for me was noticing that when I did a clean build, the bin/debug folder did not contain an "MDB" file for the main exe (in this case Engagement Android.dll.mdb) and so was not been packaged into APK file.

    It turns out that the MDB files are the way that debugging information gets packaged up into the APK - without it you can't debug! I think they are created by a tool called PDB2MDB.exe during the build process.

    If you try this, bear in mind it is the physical folder name not the project name that is important. Also, you need to edit the SLN file because it contains a reference to the path of each project in the solution - so make the change there too.

    Monday, November 30, 2015 5:03 PM
  • User180128 posted

    It seems that adding/removing breakpoints while debug session is running causes this. (or something along those lines)

    Fix that works for me: 1) stop debugging 2) delete all breakpoint (in VS, Debug > Delete All Breakpoints) 3) Build

    then you can add new breakpoints and launch app/debug new breakpoints will start hitting again until they stop at some point and you repeat above steps

    Friday, December 18, 2015 10:39 PM
  • User186214 posted

    Same Issue here: Xamarin Studio + Xamarin Forms (Android) + Visual Studio Android Emulator = breakpoints not hit.

    Deleting the bin/debug *.mdb files did not work :(

    Edit: Renaming the Android folder not to contain periods ('.') did give a nicer exception dialog - still not breakpoints though :(

    Monday, January 11, 2016 2:45 PM
  • User94013 posted

    On my case the solution was closing visual studio, go to the project folder, delete all folders and items inside the bin/ folder, reopen visual studio, do a Clean All / Build all, and then breakpoints worked again on Debug mode

    Tuesday, January 12, 2016 10:22 AM
  • User186214 posted

    solution found. see this thread. Folder tree had '@' sign in one of the root folder names.

    Saturday, January 16, 2016 8:14 PM
  • User185802 posted

    Hello guys,

    i am also in queue with the same problem, if any one find solution then post a comment here :wink:

    Tuesday, February 9, 2016 12:11 PM
  • User127089 posted

    Using VS2013 my Xamarin Forms Android project had parentheses in the path and debugging worked OK. Upgraded to VS2015 and although project converted painlessly enough - after five hours of trying various solutions could not get debugging to work. Saw post by AndrewBurgess.4789 and so changed path to remove parentheses and debugging now working OK. Thanks Andrew.

    Monday, February 29, 2016 1:53 PM
  • User59024 posted

    Just to add to the list of those having the issue. I've have not hit a breakpoint running Xamarin.Forms 2.0.1.6505 on Visual Studio 2012. None of my breakpoints in the PCL are hit, though breakpoints in my iOS project are hit.

    I've attempted the following without success:

    • Delete bin and obj folder for PCL and iOS project
    • Double checked the file path did not contain strange characters
    • Switched from Debug -> Release -> Debug
    • Deleted .suo file
    • Clean/Rebuild
    • System reboot

    Fortunately breakpoints are working the Xamarin IDE, I don't know how I would have made progress without the "backup" IDE allowing me to stop at my breakpoints. Would love to hear any successes regarding this issue.

    Tuesday, March 22, 2016 5:38 PM
  • User158671 posted

    Setup - Visual Studio 2015 update 2, Android solution with many projects, Xamarin 4.0.3.214, Xamarin.Android 6.0.3.5

    My breakpoints were not getting hit in my startup project, but were in other assemblies. After a lot of searching and trial and error, I was able to fix this issue once I changed the assembly name of the startup project to match the namespace. I won't go into why they were different in the first place (by default, they should be the same), but now they match and I am able to stop at breakpoints again!

    Tuesday, May 3, 2016 11:24 PM
  • User224595 posted

    Great thread, helps me to find all the possible reasons why debugger was not hitting :smile: Finally I f ound a new reason for debugger issue. I didi all listed above and also things which people shared in other thread, in past 2 days. In my case $ this beautiful shit was sitting in my project directory path which was reason debugger issue. So my project was sitting folder structure as below: C:\DevProjects*$*CodeParadise\PinIT\PinIT When i just copied the same project to C:\DevProjects\PinIT ALL WORKED WELL

    Thursday, May 12, 2016 6:23 AM
  • User224595 posted

    Great thread, helps me to find all the possible reasons why debugger was not hitting :smile: Finally I f ound a new reason for debugger issue. I didi all listed above and also things which people shared in other thread, in past 2 days. In my case $ this beautiful shit was sitting in my project directory path which was reason debugger issue. So my project was sitting folder structure as below: C:\DevProjects*$*CodeParadise\PinIT\PinIT When i just copied the same project to C:\DevProjects\PinIT ALL WORKED WELL

    Thursday, May 12, 2016 6:26 AM
  • User166736 posted

    Hi Asif Khan,

    Thank you for your update this is helped for me, The issue is when i copied the same application i was store the application in another path. when i come to the first path it worked for me. Once again thank you.

    Thursday, September 29, 2016 11:11 AM
  • User127089 posted

    @AOCT.08 said: Hi all. I've seen a lot of issues with breakpoints not being hit for Xamarin. The most recent issues seem to state that this is only affecting iOS and is fixed on Android, but I am having the issue with Android, and it seems to be more prominent/happen all the time after I performed the latest Xamarin upgrade.

    I am running the latest version of Xamarin for VS, we are using Xamarin Forms, and we have a PCL as our shared library. I've tried debugging on an actual device and on emulators (Genymotion) running both Android 4.4.4 and 5.1.0, but no matter what, no breakpoints are hit.

    I've tried the following "fixes" previously mentioned in various places on the forum, but none seem to work: - Restart computer/VS - Do clean solution and rebuild solution - Delete bin and obj folders - Make sure fast deployment is unchecked

    Are there others having any issues? If not, does anyone else know how to resolve it?

    Thanks for starting this thread and identifying possible solutions. Cleaning my projects fixed this issue for me. Thank you.

    Tuesday, November 1, 2016 12:33 PM
  • User121614 posted

    Hi all,

    This issue is back ( for me at least ). Xamarin Studio 6.2 ( build 1821). I have deleted the bin & obj folders, rebuild, restarted .... nothing works.

    Can anyone confirm this problem ?

    Friday, February 24, 2017 10:31 AM
  • User226843 posted

    Same issue after installing Xamarin for Visual Studio latest stable build 4.3.0.784.

    It appears to only affect certain PCL assemblies; breakpoints in my Droid & "Base" assemblies work as expected. No errors are seen.

    Friday, February 24, 2017 2:47 PM
  • User121614 posted

    In my case, none of the breakpoints work :(; whether they're in the droid project,shared project or forms. Seems like such a basic feature to have but ..... I had to resort to the old style of debugging ( console lines ) :).

    Friday, February 24, 2017 10:33 PM
  • User304878 posted

    I am having the same issue on 4.3.0.784. No breakpoints working on iOS Simulator/Device. Android seems to work.

    I have tried all the normal fixes.

    Friday, March 3, 2017 8:01 PM
  • User13348 posted

    Same for me : it does hit in android project + shared project but never in PCL projects ...

    Monday, March 6, 2017 9:34 AM
  • User306015 posted

    Im just gonna add a same here. But I can do Debugger.Break() to trigger the debugger so I know its attaching properly.

    Wednesday, May 3, 2017 4:08 PM
  • User248173 posted

    i change my mono 5 to mono 4.8.1, then it works fine with me

    Tuesday, May 16, 2017 12:29 PM
  • User139040 posted

    Same here, debugging doesnt work on Android. Works on UWP. This is in 2017, 2017 preview, and 2015 since updating Xamarin.

    Tuesday, May 16, 2017 4:32 PM
  • User139040 posted

    I downgraded VS 2015 to Xamarin.VisualStudio_4.4.0.34.msi. One day I will be able to remove VS2015, one day I swear!

    Tuesday, May 16, 2017 4:55 PM
  • User248173 posted

    @"BradChase.2654"

    the problem is with mono 5, so you have to download mono 4.8.1, then install it

    Wednesday, May 17, 2017 6:28 AM
  • User308644 posted

    @"Vaka.GopiNadhReddy" Thanks in advance

    Can you please provide us link to download Mono 4.8.1 as well as is this workaround doable for xamarin for Visual studio Win 10 not MAC as well as not xamarin studio !

    Wednesday, May 17, 2017 11:45 AM
  • User248173 posted

    @MohamedElhefnawy

    i using xamarin studio in mac, it works for me.

    link for mono 4.8.1(for windows and mac):

    download.mono-project.com/archive/4.8.1/

    *for Visual studio Win 10: *

    follow this post

    https://www.visualstudio.com/vs/older-downloads/

    Rolling back to 15.0 is the recommended fix for Visual studio.

    Wednesday, May 17, 2017 11:54 AM
  • User139040 posted

    @"Vaka.GopiNadhReddy" Thanks for all that Vaka.

    Wednesday, May 17, 2017 2:56 PM
  • User277909 posted

    It is amazing how useless these forums can be

    Sunday, May 21, 2017 3:25 AM
  • User189218 posted

    Sometimes this issue may occurs because of your folder name. I was facing this issue from 2 days because i placed my project root folder inside a folder with same name of my project root folder name.

    i.e. My project folder name is MessaginApp (which contains your sub project folder i.e. MessagingApp.Core,MessagingApp.Droid,MessagingApp.iOS)

    and i placed this folder MessagingApp inside folder with name MessagingApp. That causes not hitting breakpoints and i am not able to debug my project . When i placed MessagingApp folder not inside with same name folder then i am able to debug and hitting breakpoints.

    Thursday, May 25, 2017 11:44 AM
  • User176558 posted

    Fortunately (in my case) you have Visual Studio and Xamarin Studio. While everything worked fine in most projects, I had one project which did not hit the breakpoints in Xamarin Studio for Android (iOS worked fine). Running the same project in Visual Studio for Mac "fixed" the problem, now breakpoints are hit.

    Tuesday, June 27, 2017 7:17 AM
  • User365180 posted

    Visual Studio 2017 running Xamarin Forms 2.5.1.527436 - the solution for me was just to delete the bin and obj directories from my Android project. I imagine it's because there's a stale debugging binding that doesn't get re-built on it's own.

    Thursday, July 5, 2018 2:09 PM
  • User395471 posted

    remove bin, obj, the app and also the mono runtime. then still failed. i had to enable the "Use shared runtime" in project settings -android options again. Then it worked for me on VS2019

    Monday, June 29, 2020 11:16 AM