Breakpoints not being hit for Android and Xamarin Forms

AOCT.08AOCT.08 USMember
edited May 2015 in Xamarin.Android

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?

«1

Posts

  • TimFTimF USMember ✭✭

    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.

  • AlvaroRivoirAlvaroRivoir USMember ✭✭✭

    Same problem here, any news?

  • AlexanderGrfAlexanderGrf DEMember

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

  • AOCT.08AOCT.08 USMember

    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.

  • AlbertoPiccoAlbertoPicco USMember

    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!

  • AliRFarahnakAliRFarahnak DKMember ✭✭

    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..

  • MarcoTMarcoT USMember ✭✭
    edited May 2015

    deleting the bin and obj directories worked for me!

  • Bruno.1821Bruno.1821 USMember

    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.

  • AliRFarahnakAliRFarahnak DKMember ✭✭

    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..

  • ClintonLandryClintonLandry USUniversity

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

  • AndyEvansAndyEvans GBMember

    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.

  • JamesGreen.8031JamesGreen.8031 GBMember ✭✭
    edited June 2015

    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.

  • JamesGreen.8031JamesGreen.8031 GBMember ✭✭

    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

  • AlexvanMeertenAlexvanMeerten NLMember ✭✭

    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?

  • AlexvanMeertenAlexvanMeerten NLMember ✭✭

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

  • JamesGreen.8031JamesGreen.8031 GBMember ✭✭

    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.

  • TPlayTPlay USMember

    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 ........

  • ChrisLamontChrisLamont USMember, University
    edited October 2015

    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.

  • 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.

  • DanielZolnjanDanielZolnjan USMember ✭✭
    edited December 2015

    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

  • Malcolm.JackMalcolm.Jack ZAMember ✭✭
    edited January 2016

    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 :(

  • VitorLeitaoVitorLeitao USMember

    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

  • Malcolm.JackMalcolm.Jack ZAMember ✭✭

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

  • SanjayTejaniSanjayTejani USMember ✭✭✭

    Hello guys,

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

  • StephenGrahamStephenGraham GBMember ✭✭

    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.

  • SmathsSmaths USMember ✭✭
    edited March 2016

    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.

  • MattGoodmanMattGoodman USMember

    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!

  • AsifKAsifK AUMember

    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

  • AsifKAsifK AUMember

    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

  • praveenaHMpraveenaHM USMember ✭✭

    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.

  • StephenGrahamStephenGraham GBMember ✭✭

    @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.

  • 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 ?

  • MC85MC85 USMember

    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.

  • 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 ) :).

  • AaronFleischerAaronFleischer USMember

    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.

  • RenaudLaloireRenaudLaloire BEUniversity ✭✭

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

  • DamienTouchetteDamienTouchette USMember

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

  • Vaka.GopiNadhReddyVaka.GopiNadhReddy USMember ✭✭✭

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

  • BradChase.2654BradChase.2654 USMember ✭✭✭

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

  • BradChase.2654BradChase.2654 USMember ✭✭✭

    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!

Sign In or Register to comment.