Xamarin Debugger not hitting the breakpoints

1356

Answers

  • ThibaultDThibaultD SEMember ✭✭✭

    @SamuelOgbaghiorgis said:
    recently happend to me, no solution or work around give me the possibility to debug my application. Impossible to work in this way. Any other suggestion?

    Have you tried clearing all the obj/ and bin/ directories?

  • MatthewChanMatthewChan CAMember ✭✭
    edited November 2015

    I am still encountering this problem even after I clear the obj / bin directories for my iOS project. My PCL breakpoints are not being hit. I tried the usual tricks people have suggested (clean/rebuild , toggling the emulator to device back to simulator, deleting the bin / mdb files) and still have this issue. The only way I know my code where my code is entering in my PCL is if I change my DEBUG options in VS to throw on Common Language Runtime Exceptions then explicitly write in my PCL a dummy exception. I am using Xamarin.iOS 9.2.1.51, VS 2013 Update 5, and running on an iPhoneSimulator 6s iOS 9.1.

  • Reverting down to Xamarin.IOS 9.01 got my break-points back.

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

  • MaitreFouMaitreFou REMember ✭✭

    Hi,
    i have the same problem : everything worked well before,
    now none of the breakpoints get hit now.

    using Xararin Studio 5.10.2 (alpha channel after reading this post, but still not working).
    Xamarin.Android 6.0.0.41 business edition

    Anybody has an idea ?
    can't work anymore in this situation !

  • EmilSylvestJensenEmilSylvestJensen DKMember
    edited December 2015

    I am experiencing this more often lately as well. And nothing i do seems to help.

    Edit:
    Seems like this only happens in async methods.

  • MaitreFouMaitreFou REMember ✭✭

    uninstalled and installed old version and it it okay... for the moment!

  • MaitreFouMaitreFou REMember ✭✭

    to get it work I need to uninstall all then install this :

    gtk-sharp-2.12.26.msi
    Xamarin.VisualStudio_3.11.1594.msi (for xamarin.android sdk)
    XamarinStudio-5.9.7.22-0.msi

    If I do any of the updates that are proposed by Xamarin Studio after this install, then I get issues for debugging.
    I hope it can helps someone.

  • MikePetersMikePeters USMember ✭✭

    Can someone from Xamarin confirm the above post is the recommend solution?
    I have a clean visual studio 2015 and xamarin installation and I need to delete files from bin and obj every single time I debug, otherwise my breakpoints don't get hit.

  • AndreiAdamovichAndreiAdamovich BYMember
    edited January 2016

    Thanks to AndrewBurgess.4789, this worked for me, but have smth to add:
    I has path to project with symbol ' @ ', so when I moved from that folder to another (without special characters in path), everything started working fine.
    So you have to check your full path to output directory doesn't contain such or similar symbols.

    But the most strange was that it works few days ago (breakpoints were hitting, but local/watches and call stack was empty).

  • Just remove .suo file

  • Malcolm.JackMalcolm.Jack ZAMember ✭✭

    Still getting this issue on a plain Xamarin Forms project with Android as the target platform.
    There are no special characters in the folder name and Clean / Rebuild doesn't work.
    Project mdb files are not being generated.

    Debugger.Break() works - but the breakpoints are all donuts :(

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

    Update: Turns out my issue was related to the folder name issue mentioned by AndrewBurgess.4789.
    It turned out one of my root folders had an '@' sign in it. ie: Make sure the entire folder tree has no funny characters - not just the project folder.
    Bug logged here

  • bartdkbartdk USMember

    Did a reinstall of my machine a couple of days ago with all the latest installers available.
    Still having the issue of not hitting certain breakpoints.

    Anyone in the xamarin team working on this issue ? Rather anoying :(

  • ELeongELeong USMember

    Noticed that when changing Configuration from Debug -> Release -> Debug, developer instrumentation was getting unchecked and breakpoints will not work. enable this option and everything works fine.

  • MaitreFouMaitreFou REMember ✭✭

    @ELeong said:
    Noticed that when changing Configuration from Debug -> Release -> Debug, developer instrumentation was getting unchecked and breakpoints will not work. enable this option and everything works fine.

    anyone tried this ?
    I have a 5.9.7 working xamarin studio (this old version works well for me) so I don't want to install updates it if not sure, it's long to reinstall all applications...

  • same problem here with 5.10.2 in Xamarin Forms. For some reason the breakpoints don't work well. Some times i delete the bin/obj directories and work again but only for one time.

    This is very unproductive, also to delete every time bin/obj isn't solution for a developer.

  • MaitreFouMaitreFou REMember ✭✭

    @PeterBournakas said:
    same problem here with 5.10.2 in Xamarin Forms. For some reason the breakpoints don't work well. Some times i delete the bin/obj directories and work again but only for one time.

    This is very unproductive, also to delete every time bin/obj isn't solution for a developer.

    I agree with you, buying a licence and having to work in these conditions... very unproductive and frustrating !

  • Malcolm.JackMalcolm.Jack ZAMember ✭✭

    seeing some very weird behavior with the mdb files in the debug folder.
    The mdb file names are duplicating itself
    ie: the mdb file looks like: MyCompany.MyApp.dllMyCompany.MyApp.dll.mdb

    The mdb files are only duplicated for my app assemblies - the system assemblies all look ok

    very frustrating indeed :neutral:

  • Malcolm.JackMalcolm.Jack ZAMember ✭✭

    Just an update on the additional issue I was having:
    It was localized to a single file. (the usual clean / rebuild etc. didn't fix anything)
    I drag and dropped the file to a new location, and the breakpoints started working again.
    Thankfully when moving it back to the original location, the breakpoints continued to work.
    Go figure.

  • ImanHabibImanHabib SEMember

    I'm also having the issue of breakpoints not hit. It seems to be more common for execution to pass them by silently in my "lower level code", in particular callbacks from Bluetooth (BLE), (still in a PCL project).

    I'm having a Xamarin Forms Android in a Visual Studio 2015 solution with Xamarin 4.0.1.96 and Xamarin.Android 6.0.1.10.

    I've also experienced that the "lower level code" breakpoints sometimes get hit if I put a breakpoint on a "higher level" in the code BEFORE the low level code is run, e.g. in a UI button handler that issues a connect to a Bluetooth device.

    From other peoples' posts this seems to be a common problem, not pertaining to Bluetooth, I'm just mentioning Bluetooth to give an example.

    Furthermore, I'm also having several (but not all) of my assemblies' .mdb files duplicated as Malcom.Jack says above.
    Note that there is a duplicate copy of some of the .mdb files with each filename according to Malcom.Jack's pattern.

  • FaltysMartinFaltysMartin CHUniversity ✭✭

    Hi, I had this issue in VS after switching Debug -> Release -> Debug. After checking developer instrumentation was set for debug mode.
    I unchecked developer instrumentation and checked it again -> Solved problem, I'm hitting my breakpoints again.

    Cheerss

  • KrisAdamsKrisAdams GBMember ✭✭

    Hey guys,

    I have had a similar problem in Android with Forms. All the latest versions of XS, XF, etc.
    Occasionally debugging would stop hitting breakpoints on my Android simulator. So I put a breakpoint in the start of the app to do a sanity check every time I run it. As, its super frustrating when you think you are debugging, but aren't really.

    What I found when it occasionally stops hitting breakpoints is the following:
    I close XS. I delete the app from my simulator. I open XS again, I do a full clean / rebuild. I run the app again.
    This then means I need to go through the full first-time run of our app, which is slow, but then breakpoints work again.

    Cheers,
    Kris

  • BenPattinsonBenPattinson USMember ✭✭

    Just a quick note to say that we'r experiencing the same problems here. This is getting old, fast.

  • ImanHabibImanHabib SEMember

    I can't confirm this is part of the same issue, but I suspect it's related:

    Sometimes the app freezes when I've inserted a breakpoint (typically in "lower level code" (see my comment above)),
    but Visual Studio 2015 doesn't react by pausing at the breakpoint location in the code or enables the "play" button to continue, i.e. the only way out is to terminate the debug session. I haven't been able to confirm that it's actually caused by breakpoint insertion, but after removing all breakpoints, the app runs smoothly.

    My environment (and app) is the same as above, Android, Xamarin Forms, Visual Studio 2015.

  • SebastianSpanSebastianSpan DEMember
    edited April 2016

    Had the same issue. This was cause by defining the OutputPath in the "generic" property Group. Seems that xamarin does not support a generic outputpath definition.

    What I did:
    Open .csproj and moved OutputPath defined in PropertyGroup to specific PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> (same for Release Build definition)

  • ImanHabibImanHabib SEMember

    Thanks for shedding some more light on this prolonged issue, SebastianSpan.

    Unfortunately we have both OutputPaths (debug and release) defined in the PropertyGroups you mention, but still having the problem of Visual Studio 2015 "out of synch" with breakpoints that I mentioned above.
    (The app stops execution when hitting a breakpoint (inserted in Visual Studio) but without Visual Studio realizing by showing the "play button" to allow continued execution, or stepping etc. Soon Android also indicates that the app isn't responding and all that can be done is shutting down the app.)

  • RupertRawnsleyRupertRawnsley GBMember ✭✭✭
    edited April 2016

    @FaltysMartin said:
    Hi, I had this issue in VS after switching Debug -> Release -> Debug. After checking developer instrumentation was set for debug mode.
    I unchecked developer instrumentation and checked it again -> Solved problem, I'm hitting my breakpoints again.

    Cheerss

    This worked for me in Xamarin Studio 5.10.3.51 by going to Options > Android Build > Debugging Options > Enable developer instrumentation

    I switched this setting off, compiled the project, switched it on, and compiled again. This time the breakpoints worked, at least so far.

    Checking the project file diff in source control I noticed that it's added the <RunCodeAnalysis>false</RunCodeAnalysis>switch, which wasn't there before. Possibly relevant.

  • AndrewPageAndrewPage USMember
    edited June 2016

    Seeing this problem as well. Worse, it comes and goes. Sometimes rearranging the project and the namespace seems to bring some 'relief' for a few run cycles but the it pops up.

    However I have found one emerging pattern(maybe)

    IT seems to occur ~consistently in 'shared project' code. However I've found that setting breakpoints in the platform specific code(e.g. Droid or iOS) succeeds(i.e. I can set the breakpoint, start a debug session and have the breakpoint stay, does not turn into the "empty red donut" and can be hit. Now, I've arranged it so that the 'shared project code' can call back into the platform code so I can hit a breakpoint there and then just go back up the stack frame. To say the least a 'kludge' no end but it works.
    Now here's where it gets 'weird(er)' After having done this once I can now set/hit breakpoints in the shared project code again, at least for a few run cycles before I have to do this kludge thing again.

    This makes me think that it might be somewhere in whatever interface exists between the debugger and the class/assembly loader(i.e. perhaps when the program launches it iterates over the breakpoints it needs to set but the class/assembly in question is not loaded so it chokes and tosses the bpoint over the side and brands it with the "empty red donut of debugging death"). That SOMEWHERE in the last updates someone broke something in that connection.

    What continues to gall me is that I look back through 4 pages and a year's worth of postings on this issue and I do not see ONE single Xamarin badge... In any other company deploying IDE's this would be a f'in all hands on deck, show-stopper. Yet I see a handful of errors in bugzilla that have this issue's fingerprints on it with NO motion on them. Hello? Triage? Data mining?

    C'mon!!! Can we at least get an error/warning message when the launch is complete and the debugger brands our breakpoints with the "empty red donut of debugging death" to tell us WHY??? (Assembly not found, method not found, code not in the .NET revision we like ANYTHING THAT WE CAN SEND BACK TO YOU!!! A Breakpoint set but not found is a FREAKIN' error!!! We put it there for a reason!!!)

    ok, maybe it's our fault... we haven't done enough work for them them yet.

  • Nathan.0614Nathan.0614 USUniversity ✭✭

    Similar problem here Mac project breakpoints work fine. PCL project does not. Any response from Xamarin?

  • PhilipMurrayPhilipMurray GBMember ✭✭

    Same here, breakpoint not hit in either iOS or PCL project. This needs fixing ASAP.

  • BetsyGeorgeBetsyGeorge USMember

    In case it helps anyone working in Visual Studio, Xamarin iOS, I was having this problem - I could hit breakpoints in my iOS code, but not the PCL code when running my project on a phone. I was able to hit breakpoints in the PCL code when running on the iOS simulator.

    I spent several hours over the last week trying everything I could find and nothing worked.

    I just went in to my iOS project settings, iOS Build tab and unchecked the "Enable device-specific builds" checkbox and now it seems to be working - I am able to hit breakpoints in the PCL code. Hopefully this will last.

  • SebBartholomewSebBartholomew USMember ✭✭

    @BetsyGeorge Your solution worked for me. Thanks for sharing.

  • ShockerShocker RUMember

    @Malcolm.Jack said:
    Update: Turns out my issue was related to the folder name issue mentioned by AndrewBurgess.4789.
    It turned out one of my root folders had an '@' sign in it. ie: Make sure the entire folder tree has no funny characters - not just the project folder.
    Bug logged here

    I solved same problem. Path to solution (even not the folder of solution) had "$" symbol. After renaming folder, breakpoints work correctly.

    Thanks!

  • Nathan.0614Nathan.0614 USUniversity ✭✭

    @Nathan.0614 said:
    Similar problem here Mac project breakpoints work fine. PCL project does not. Any response from Xamarin?

    Still having the issue over a month later. Xamarin Studio on Mac. Even tried rolling back to an older version, no luck.

  • eesteineestein BRMember

    Completely agree with @AndrewPage... over a year now and we're still discussing it here... no fix yet, really?

  • FranciscoGGFranciscoGG ESMember ✭✭

    Any solution or workaround??

    It is really difficult to do our job without debugging...it stops in the ~30% of the breakpoints I set....

  • RogerSchmidlinRogerSchmidlin CHUniversity ✭✭✭

    Same here. I am able to set a breakpoint. But when I run my app the breakpoint shifts magically to some other line. The debugger never stops where I set my breakpoint, even though my debug writelines tell me that I went through. Happens on iOS and Android. I am back putting Debug.WriteLines everywhere!

  • @BetsyGeorge Your solution worked for me as well. ... this was brutal.

Sign In or Register to comment.