I have a Xamarin Android app that we've been using for years now. Recently, we started seeing a problem where we can't trace into or set breakpoints in certain methods/classes. If I set a breakpoint, it doesn't stop at it and if I try to trace into it, it goes to a completely different area of the code. This may be related to the fact that we recently had to enable Multi-Dex support, but I'm not sure if that is related. I have several developer seeing the same problem. We are using Visual Studio 2015.
I noticed that if I set the linker option to "Sdk and User assemblies", my debugging problems go away. however, I then see crashes because it appears the linker is removing methods that are needed.
Related
I have a Xamarin Forms 5 application that is having issues being debugged via Visual Studio.
The application has a root view with tabs and each has a ListView control. The application runs fine without any issues when started without debugging.
When debugging it seems that the ListViews are continually re-creating the cells, the descendants count just keeps going up indefinitely. To the point where the UI is unusable in any meaningful way due to the connection being swamped and the CPU continually hit.
It behaves this way when running either Android or iOS, hardware or simulator.
I've just loaded the exact same projects and solutions into JetBrains Rider 2021.3 and debugging using Rider works flawlessly, using both simulators and hardware.
The only common denominator is the Visual Studio debugger.
At this point I'm not entirely sure how to address the issue with debugging via Visual Studio. Are there any configuration options that would be worth experimenting with to try and solve this?
Please include your visual studio and xamarin forms version.
Possible issue : On vs you can change hot reload option in tool -> Option -> Hot reload. In the xamarin forms section, try to change the option from "Only change XF 5.0" to "Full Page".
note : the english name of those option might not be exact (my vs is in another language).
I need some help. I have put in dozens of hours into a VB.NET project, it has been built in release mode and distributed. Now I have to make some changes to it, and I am unable to debug it properly. My code changes result in behavior where my code is not even recognized.
Also, I installed Visual Studio 2013 recently (moving from 2010), but this project behaves the same in both environments.
I believe that my code has become 'optimized'. The error window tells me that code is being skipped over, and that my code is optimized and JIT is checked.
I have turned off JIT, and I have tried everything to make this project work again that I could think of. I am desperately wanting to know how I can get this project to be in a state where it will debug each line of code again when I make changes.
I can even purposely write bad code, and the debugger does not see it.
This project is now in debug mode, not release. I have checked and followed threads on every thing that other people have done to solve this issue, but nothing works for me.
Either my project launches and works properly as it is coded, or if I change any code only the form launches with no code being run - at all.
please help.
I finally figured it out. The applications that I was struggling with were all built in Visual Studio 2010 on Windows 10. I was trying to work with these in Visual Studio 2013 on Windows 7.
Once I tried to work with them on Windows 10 (visual Studio 2013 this time), they started working and debugging just fine.
I think it may have been DLL assembly paths? Took me more than a week, but I figured out my issue by moving from Win7x64 to Win10x64.
I have a Xamarin.Forms Android app that I have been developing in Visual Studio 2015 for several months.
Until today, I have been able to reliably debug the app in both the Android emulator and on a physical device. Now, suddenly, debugging the app in either of these environments results in numerous exceptions.
For example, during its startup sequence, my app initializes Xamarin Insights:
Insights.Initialize(apiKey, Forms.Context);
This has been working fine for months, but now it throws the following exception:
Java.Lang.SecurityException: ConnectivityService: Neither user 10133 nor current process has android.permission.ACCESS_NETWORK_STATE.
I can work around this exception, either by commenting the above code line or by explicitly assigning permission ACCESS_NETWORK_STATE, but it wasn't necessary previously and I believe it is a red hering, since it is one of numerous new random exceptions that occur when debugging the app in Visual Studio.
I have reverted my codebase to a known working revision (one that is being successfully used by beta testers) and nothing changes.
I have tried restarting Visual Studio and rebooting the computer. I have also tried cleaning the solution (both from within Visual Studio and by physically removing all build artefacts) but none of these efforts have helped.
I am guessing that something has been corrupted in Visual Studio, but in view of the time it takes to reinstall, I am hoping that someone may have a suggestion for a quicker fix.
As you said that it works well if you add the "uses-permission" in the Mainfest, if so, do you debug your app in release mode or debug mode?
Like this document here:
https://developer.xamarin.com/guides/android/advanced_topics/working_with_androidmanifest.xml/
In the Release build version of the manifest (at obj/Debug/android/AndroidManifest.xml), these permissions are not automatically configured. You could add it from the project property.
Seeing an issue when debugging in Visual Studio. All of the values under watch, and in the hover over window show up incorrectly. the only values that show properly, are values that are local to the method I am currently stepping through.
For example the watch value for 'this' when debugging shows the following under value
0x00000000ffac0388 { btnBack=0x00000000ffaccf20 btnReply=0x00000000ffacd200 btnForward=0x00000000ffacd420...}
some other variables show this, even though the variable is there.
error: 'this.foo' does not exist
The machine recently had windows 7 64 installed, since then this problem has occured.
Visual studio has been reinstalled on this machine, and we verified that the settings in visual studio were exactly the same as a different PC that is the same machine and config.
We finally figured out what the issue was. The devenv.exe was being set to run in xp compatibility mode (sp3). Doing a rebuild of the project after removing the compatibility mode fixed the issue.
Can you provide a bit more information to help us track down this problem. In particular
What operating system was installed before upgrading to Windows 7 64 bit?
Did you install Visual Studio before or after the upgrade?
Is there any other version of Visual Studio installed on the machine?
If you set your application to be x86 specific does the problem still repro?
What language is your code written in (assuming C#)?
When facing weird debugging issues, I find that deleting the solutions User Options file (.suo) usually fixes the problem. You will loose your bookmarks, breakpoints, any special exception handling, and so on.
If that fails then clear all your Visual Studio "temporary" files. Check out the "Clear Recent" script at http://missico.spaces.live.com/blog/cns!7178D2C79BA0A7E3!370.entry. Modify it for your own needs. For instance, I dislike Flash, so you may want to remove the call to ClearStupidFlash and the other non-Visual Studio calls. Clear your solution then "rebuild all".
If the problem still exists, then something else is going on.
Following my last question (see: Problem in hosting ActiveX on Vista (in a Visual Studio 6 C++ application)) I ran into a strange problem. I hope this’ll be a simpler issue to the experts here:
Each time I run certain application like iexplorer or firefox, the Visual Studio 6 suddenly opens up in debug mode with a message “User breakpoint called from code at 0xSOMETHING”.
I can press F5 to continue but the applications run slowly and needless to say I have no wish to debug these applications…
My guess is that when I worked on my VC++ application I placed breakpoints at windows methods like CAxDialogImpl::Create(), AtlAxCreateDialogA() etc’, and for some reason it was kept somewhere.
Of course I now removed all the breakpoints and re-compiled the project but still this keeps happening!
I checked in the tools->options but the “Just-in–time debugging” is not marked.
Any idea?
(I use Visual Studio 6 which I installed on Vista)
Thanks a lot,
Erik
Not sure this helps but anyways:
Try disbaling the default debugger option. (It says Dr. Watson but it depends what you have set as the default debugger)
http://www.bridgetonova.com/2007/09/how-to-disableenable-windows-default.html
Also as per this post Visual Studio 6 is not supported on Vista. Only Visual Basic is.
http://www.itwriting.com/blog/167-visual-studio-6-on-vista.html
You should probably re-ensure yourself that you have removed all calls to DebugBreak() and manual break-points. Also try to ensure that when you recompile you re-register everything to point to the right places (i.e. the activex pointed to by the guid in the registry is actually the latest recompile).