Xamarin.Forms: Android breakpoints not hit - c#

I recently upgraded to Visual Studio 2022, and since then, I can't hit breakpoints any longer during Android shared project debugging, even if they seems to be loaded correctly.
I've set debugType on Pdb only on both projects.
Tried clean/rebuilding many times, remove app and restart emulator but still no luck. Any idea about this issue?
I'm using XF 5.0.0.2337.

As officail community said:
Enable Use Fast Deployment on the Android project.

I updated my Samsung device (Samsung Experience is 9.5) and now the breakpoint works again. Fast deployment/restarting/re-installing was not enough.

Related

Xamarin Android App crashes when attempting to debug on a physical device

I am attempting to debug an android app created using Xamarin Forms in Visual Studio 2022. However, the app crashes on launch and no output is shown. When running the app normally, there are no issues. Running or debugging the app on the emulator poses no problems, either. Unfortunately, I have no other information to provide that I can think of.
There seems to be a bug with Visual Studio 2022. I came across similar issue, I've fixed it by changing in your csproj file:
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
To
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
It worked like a charm for me :)
Just hit this problem, the work around that worked for me was disable "Use Fast Deployment" in the Properties->Android Options.
The build was crashing before any debugger or log output was generated.

Unable to create Xamarin project

I am a new Xamarin user, and have installed the Visual Studio 2015 Community installation, with all the Xamarin options enabled. This was done on both a Windows 8.1 and Windows 10 machine, both of which were fresh installations.
On both PCs, I am receiving the same exact errors. As soon as a Xamarin.Forms.Portable project is created, it loads with the following errors:
I have tried reinstalling Visual Studio multiple times, and made sure to install all features. I also tried the steps highlighted here, to no avail.
I do not know how to proceed. I am new to Xamarin, and need to create an application which works on both Android and iOS devices, so from what I can see, this is the project type I need to choose.
Is there something which I have missing, that needs to be installed? These errors are appearing as soon as a new project is created, so I'm assuming that the default configurations should be fine.
I also tried adding Xamarin.Android.Support.V4 through NuGet, however this in turn caused more errors.
These all appear to be warnings, not errors. You should still be able to deploy to emulator or device.
The XamlCTask errors are probably related to the fact that, annoyingly, the versions of Xamarin Forms nugets are not aligned across the different platforms with a clean installation of VS2015 Community. Right click on your SOLUTION, go down to Manage Nugets for Solution, and update Xamarin Forms. I was fighting these warning for a long time before figuring that out.
Do NOT update all Nugets -- packages are being pushed that are incompatible! This was true recently in the Android universe -- updating all Nugets to latest stable would break your app. This appears to be resolved now (I'm at the latest stable in all categories with working projects) but be mindful that you may need to roll back to "minimum required" rather than "latest stable" if you have errors. A new issue has come up with the latest Xamarin Forms and 3rd party Nugets creating troublesome Resources.cs errors.

Could not find type...Platform issues in Visual Studio

I just jumped back into a project that previously had no issues. We just upgraded to visual studio 2012. This morning I open my project to work on my code. I am getting designer issues all over the place.
"If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU"
It all seems to be coming from this platform issue. I have had zero issues in the past. I cannot find any information on how to fix this. I even go to open the designer on a file that previously worked (pre VS2012 install) and that fails.
So I went back to VS2010...without changing anything and attempted to open the same designer on the same file that previously worked and I also get an app crash.
Did somehow my visual studio 2012 install cause all of this?
Make sure that you are choosing the right CPU architecture for your designer. If it is ARM then you might see that message. You can check your CPU settings for your project like this:

"Unable to step. Process is not synchronized" error in VS2010 after upgrading .NET Framework

I had Visual Studio 2010 installed on my Windows 7 desktop, that I was using primarily to debug ASP.NET solutions. Everything was working great, until one of the Windows updates installed a new version of the .NET Framework. Now I get the following message when I try to place a breakpoint and then do a "debugger step" in my C# code:
To make matters worse, it doesn't happen all the time. I tried to find any pattern, but the best way I can describe it is sporadic.
Any idea how to fix this?
I just got this in Visual Studio 2015. I was debugging on a separate thread, hit the breakpoint but could not continue. A reboot did not fix it.
I deleted all of my breakpoints, reset the two that I actually wanted and it works!
Can I suggest you try using the resharper test runner. I have also been hitting this error a lot in VS2017 15.5.2 I have found its something to do with the VS test system.
Even though this solution is a product recommendation (I don't work there) it solved my issue and I was able to get things debugged.

WPF DotNET Application will run in debug mode, but .EXE will not run

I wrote a WPF application in C# using VS 2010. The application will run fine in debug mode using Visual Studio, but when I go to run the .EXE from the bin\release folder, nothing happens. I do not get any error messages from windows and there are no errors or warnings in VS. I have tried to build, rebuild and clean the solution (in every possible order) with no luck. My solution contains 2 projects, both of which use .NET 4.0 framework, and I have .NET 4.0 installed on my PC. I have tried on both XP and Win7 and still nothing.
I also just noticed that the output from Debug when I run the application in debug mode says: "Cannot find or open the PDB file" after each .Dll it loads.
I am compiling to the Release folder every time, but i did try changing it to the debug folder and clean/rebuild just to see if that would make a difference, and it didnt, so I changed it back, tried it again, and still nothing.
Any Ideas?
Here are a couple of ideas that come to mind
If you are on a x64 machine, try changing the application from being AnyCPU to x86. This the mode that applications default to in debug mode and it's possible an issue running in x64 is causing a problem in release builds
Possible the Release binaries are out of date. Delete the binaries from the Release folder, rebuild and run the newly generated runs
Run the release build under the debugger in Visual Studio and see if it till crashes
I was experiencing the above issue too, however none of the other solutions worked for me.
My Application logs in Event Viewer listed event ids 1018 and 1022. This appeared to be bizarrely related to an ASP.NET 2.0 dll (bizarre; as this was a blank WPF project only). The logs contained messages like this:
Windows cannot open the 64-bit extensible counter DLL
ASP.NET_64_2.0.50727 in a 32-bit environment
In the end it turned out to be resolved when I disabled my anti-virus. I had read that this resolution worked for someone with McAfee; and it also worked for my environment, which has Avast.
I assume you tried on a machine that doesn't have visual studio installed, and also none of the components you are using for development.
You have only one option: start the application with a debugger on the machine that causes problems and check for exceptions there. (use WinDBG for example - it's light and easy).
This looks like a problem with missing dependencies, but might be something else also.
The Debugging Labs should give you enough information on how to use windbg to find your problem:
.NET Debugging labs
Also use this:
WinDBG Cheat Sheet
(JaredPar) answer looks right (x64), but if not try right clicking on the EXE and running in admin mode for win 7.
I had a very similar issue.
Check out this setting on your App Pool entry:
Go to Advanced Settings.
Change 'Enable 32-bit Applications' to 'TRUE'.
This worked for me!
I'm going to go with a wild guess that:
Either you have some odd corruption in your .NET Framework installation
There is some debug/release-specific code using #if DEBUG or the such that is substantially different to cause issues.
You have not compiled recently into Release yet (Try changing it to Release before compiling your latest code and make sure you get no errors).
Those are the only things I can think of off the top of my head.
I had run into a similar issue, I was missing a custom folder in the release mode I was referencing in the constructor. Adding the folder to the release fixed the problem.

Categories