Xamarin.Forms IOS Breakpoints Not Hit

后端 未结 6 1680
一个人的身影
一个人的身影 2021-01-04 04:05

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

相关标签:
6条回答
  • 2021-01-04 04:56

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

    0 讨论(0)
  • 2021-01-04 04:59

    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.

    0 讨论(0)
  • 2021-01-04 05:01

    An alternative solution is to disable linking in the iOS project (not PCL project). This worked for me.

    1. Go to iOS project settings
    2. iOS Build
    3. Linker Behavior: Don't Link.
    0 讨论(0)
  • 2021-01-04 05:01

    After doing lotsof digging finally got the solution, kindly look in the attached screen short.

    In VS 2019 Community edition.

    0 讨论(0)
  • 2021-01-04 05:05

    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

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

    2. Under the PropertyGroup for the "Debug|AnyCPU" configuration, change the DebugType to: portable

    3. Save the change and reload the project.

    4. 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 the portable 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.

    0 讨论(0)
  • 2021-01-04 05:06

    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.

    0 讨论(0)
提交回复
热议问题