I have a installation of Visual Studio 2017 Community Edition with Xamarin. I just created a new PCL Project and wanted to debug the application. But to my surprise, when I debug the Xamarin Android Project,my breakpoints don't hit at all.
I compared it with my another installation at my office place where the debugger does work. In this installation, once the build and deploy succeeds, the debugger is attached. I say this because the ribbon control at top to start the android emulator is grayed out.
But in the problematic installation, its not grayed out. It shows build and deployed succeeded in the Output windows. Then , in the status bar it shows Start Debugging Android Application, followed by Debugging Android Application. Then the debugger doesn't attach (as the ribbon control is enabled at the end)
Note: I have selected the Xamarin Debugger in the Android projects Debugging options.
Answers
Are you using the hyper-v android emulators? If so check the hyper-v emulator processor properties in the hyper-v manager. Make sure the compatibility checkbox is checked
Its actually not working for all emulators (Android SDK Emulators and Visual Studio Emulator For Android). Plus, when it is also not working when debugging on a physical device too.
@KshitizShakya Assuming that the Breakpoint's don't hit means you are able to see the App getting deployed and run.
Now, In the Droid Project - Can you check if you are able to hit the BreakPoints in MainActivity.cs?
Also, can you also check if the Solution is set to Debug rather than Release.
If possible, can you try and create a blank android app and see if you are able to debug the same?
I have the same issue. I have tried clean project, the same. Of course I try it in Debug config.
I do not know which package fixed it, but I had to install other packages in VS 2017 installer.
Having the same problem, it's driving me insane. Nothing seems to work. New install of full VS2017RC with all packages didn't work (some people said that it would help). I have it just as the OP described.
Also, though it may be a separate problem - each time I launch VS, I see a notification that a new version of Xamarin is available - "Click here" but if I click it nothing happens and I don't have anything about updating in Options->Xamarin. Not a single line, word, hint.. and I can't even log into my Xamarin account from VS, which is the third problem. Duh.
Please help, I really need the debugger working
@csharpx @KshitizShakya
Is the app still getting deployed to the emulator/device and can you manually run it from there without the debugger connected? Can you send the logs from Visual Studio? Go to Help > Xamarin > Zip Logs (last 7 days) and this will create a zip file you can attach. Thanks!
Guys, I don't think it is related to VS2017 : I just upgraded Xamarin to the latest stable version and now, using the simulator, no breakpoints are hit if code is inside separate pcl libraries. Breakpoints are hit in main project.
Hope this help.
I> @RenaudLaloire said:
This is the exact behaviour for me but Im using VS2015 Enterprise. Breakpoints are hit in the iOS app and the Forms dll but nothing in any PCLs. Just won't load the debug symbols.
Dave
Yes, this is exactly the case, I just verified : it does hit breakpoints on ios / android + Shared PCL but does not hit breakpoints on others PCL dlls.
Are there any solution for this problem?
It is the last upgrade from Xamarin that create the problem?
Related:
When this bug will be resolved?
I can't seem to make debugging with Visual studio where I test instruments for an App
Still exists in version 2.3.4.214-pre5
I have the same issue. VS 2017 enterprise. It doesn't matter what project I'm using, even blank solution.
I guess breakpoints stopped working after I had updated to 2.3.4.247 from 2.3.4.231 on 18th of May. I used vs 2015 enterprise. Over the weekends I reinstalled windows and all programs. I have installed all updates for windows 10 x64 system including creators update. I have installed all available updates on mac for xcode, xamarin studio. I tried few versions of xamarin nugget package. Even latest available for me - 2.3.5.239-pre3 . But breakpoints just don't work. At all. Even in ios project in AppDelegate class.
Same here Visual Studio 2015 Enterprise.
Attempted to follow step 13 in https://bugzilla.xamarin.com/show_bug.cgi?id=52760
But suggested code change is not possible.
I wish i could just roll back.....
Have you guys tried removing the app from either the emulator or the device by using the adb -e uninstall package_name.
use adb -d uninstall ... for device.
I'm using Xamarin for Visual Studio version 4.5.0.443 in VS2017 and debugging will not work for PCL projects.
Can't hit breakpoints in a PCL project on iOS device, however they are being hit on simulator. Tested with a a new CrossPlatform Master Detail Forms PCL app, in both VS 2015 (Xamarin 4.5.0.476 - Xamarin.iOS 10.10.0.35) and VS 2017 (Xamarin 4.5.0.443 - Xamarin.iOS 10.10.0.30)
no breakpoints working in "existing" projects". new projects work. not debugging PCL projects.
can not code without breakpoints working. should be priority fix not wait 6 months to get it fixed. lost 6 hours today on breakpoints not working and will lose more hours tomorrow.
Did anyone find a fix for this? It's stopped me cold.
Update: I was able to resolve this using the workaround described here:
https://bugzilla.xamarin.com/show_bug.cgi?id=56893
Open the portable class library .csproj file in a text editor. For example, right-click the project in the Solution Explorer and select Unload Project, and then right-click it again and select "Edit ...".
Under the PropertyGroup for the "Debug|AnyCPU" configuration, change the DebugType to:
portable
Thanks Adrian, your solution fixed my problem
I don't have any issue with debugging a PCL project. So I tried to check the DebugType in 3 projects that I tested earlier. In all the 3, this is set to 'full'. May that is the correct value rather than 'portable'?
+1 @AdrianFrielinghaus.8287 's work around worked. Thanks!
Hi everyone,
I am new in Xamarin and trying to make cross platform application. I have the same problem. I could not solve it like @AndrewMcCormack.
I use;
Microsoft Visual Studio Enterprise 2017 Preview (VSPreview) this is nessecary for Xamarin Live Player
Version 15.3.0 Preview 2.1
VisualStudio.15.Preview/15.3.0-pre.2.1+26608.5
Microsoft .NET Framework
Version 4.6.01055
Installed Version: Enterprise
Visual C# 2017 00369-60000-00001-AA274
Microsoft Visual C# 2017
Xamarin 4.6.0.560 (33bfa20)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android SDK 7.3.1.2 (9dbc4c5)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 10.11.0.126 (7571635)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Installed Xamarin Updater.
Installed Xamarin Live Player on my Iphone
I have not Mac, I downloaded Xamarin Player on my Iphone and pair to Visual Studio. So when I start debugging or press live player on device box, I can see for example simple hello world application on my device (Iphone 6s).
But breakpoints don't hit.
By the way sample code(Color Control) from xamarin web site, I downloaded and tried, Breakpoint in there is working. I am struggling during 3 weeks to solve this problem. No debug no development
I tried what you say and another bugzilla etc... But degugger does not hit breakpoints, again again.
My created project property;
VS 2017 Preview C#
Cross Platform App (Xamarin.Forms or Native)
Blank App
UI Technology
-Xamarain Forms
Code Sharing Strategy
-Portable Class Library (PCL)
+1 @AdrianFrielinghaus.8287 's work around worked. Thanks!
if you are using .netstandard project type, you can also set DebugType as Portable
like this:
I'm using a Shared Project, but this still worked for me. FYI.
<DebugType>Portable</DebugType>
Can anyone explain why it still works, even though I'm not using PCL? Just curious.
A million dollar question indeed...
The Portable PDB debug type is not restricted to being used for PCL projects. It is applicable to any project type. See for example https://github.com/dotnet/core/blob/master/Documentation/diagnostics/portable_pdb.md (from a quick web search).
(As a side note, this fairly old thread has changed precise causes in the gap in conversation between March and May. The new Bug 56893 mentioned on May 31 is specific to newer versions and is not directly related to the older bug mentioned on March 9.)
This is how i solved it:
Right click on your Android project -> Properties -> Build -> Uncheck "Optimize Code".
And Android project -> Properties -> Build -> Advanced -> Debugging information -> set it to "Full".
This Solution worked for me. Thanks
+1
+1 @AdrianFrielinghaus.8287 's Thanks, Solved!
Not working in 2021. Did anything changed in last two years ? Runnig project on VS2019 for mac. Breakpoints are hitting when I run on iOS simulator but not for android. Any Leads ?