I recently upgraded to the new Xamarin for Visual Studio, and since then, I can no longer hit breakpoints during IOS debugging. Android works fine, strangely.
I uni
Xamarin forms: Make sure that your view is bound with the binding context otherwise breakpoints will not hit. And the breakpoints appear as symbols not loaded.
Example :
public ExamplePage()
{
InitializeComponent();
BindingContext = App.Resolve<ExampleViewModel>();
}
That resolved the issue for me:)
I had the same issue with Visual Studio 2017 on Windows and latest Xamarin using the iOS simulator on remote Mac. Debugging started, but breakpoints were not hit.
Got it working by changing nothing on the Mac or iOS Build options; instead changed the generated Debugging information type in Visual Studio 2017 in Windows from "Full" or "Pdb-only" to "Portable".
I did this for the iOS Platform project as well as the shared Xamarin.Forms project (.NET Standard 2.0).
After this the breakpoints started getting hit in both the Shared project and the iOS platform project. Good times.
An alternative solution is to disable linking in the iOS project (not PCL project). This worked for me.
- Go to iOS project settings
- iOS Build
- Linker Behavior: Don't Link.
After doing lotsof digging finally got the solution, kindly look in the attached screen short.
In VS 2019 Community edition.
There is a bug in Xamarin.iOS
, which will is fixed in Xamarin.iOS 10.12.0.12 (494fcbc)
, which should be available in beta channel. The problem seems only to occur in a PCL, which is the case if you set a breakpoint in your portable project (Xamarin.Forms code).
There is a temporary workaround, which worked for me:
Possible temporary workaround: switch the portable class library project(s) to output "portable" PDB files rather than "full" PDB files
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
Save the change and reload the project.
Build, deploy, and start debugging the iOS app project again.
There is an issue on Android if you do the above steps. To be able to hit the breakpoints on Android again, you have to do this:
Long story short, if you manually delete the "bin" and "obj" folders for each of the projects that you have switched to
portable
, uninstall the app from the test device, and then clean and rebuild the solution, that should hopefully allow theportable
mode to work with Android too. Once you have performed those clean-up steps once, you should in theory not need to perform them again unless you switch the DebugType again.
Edit
On Android I still have troubles, so it's not the perfect way.
Go to your Visual Studio for Mac, Solution explorer and choose the project, Project->Option->Compiler->Debug information, choose “Full” in dropdown.
You need set this "Full" for EACH of those projects in the solution you want to debug otherwise the breakpoint will not kick in.