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.
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 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.
I'm wondering if there are any workarounds for this issue, as I am plagued by frequent crashes -- though it isn't clear whether the crashes are caused by Resharper, Xamarin Tools or the mixture of C# and F# projects.
When I restart Visual Studio and load a solution containing Xamarin Forms projects, the entire display locks up. After one to three minutes, I get a pop-up saying that an update for Xamarin for Visual Studio is available (Clicking on the pop-up has no effect, so I'm assuming this is a false positive). A few seconds after that, it attempts to connect to my Mac, which is often unsuccessful as I work on my laptop and that connection is only available when I'm at home.
Only when the connection to the Mac has failed am I able to interact with Visual Studio, and then, about 30% of the time, attempting to build, clean or rebulid simply results in a pop-up saying "The operation could not be completed". The only way to fix that is to restart Visual Studio, causing the whole grinding process to restart again.
Xamarin themselves have referred me to these forums. Obviously this is not a pure software question, so I'll try to distill this into specific answerable questions.
Is there a way to prevent the false positive that tells me a new version of Xamarin for Visual Studio is available when it clearly isn't?
Is there a setting that I can use in order to opt in to connecting to the Mac, rather than attempting to make a connection and killing startup time when I know in advance that the connection will not be made?
Has the build problem "This operation could not be completed" been reported anywhere? I haven't found any instances of this problem related to Xamarin or Resharper. But it is frequent.
Does this consistently happen? We've had this problem over the years, but it's gotten much better. Make sure all your machines are synced with the latest Stable update. If on Beta/Alpha, this is typical as we push builds often. The strange part is that you say it's trying to update Xamarin Studio, we actually don't ship Xamarin Studio for Windows anymore: https://www.xamarin.com/faq#xpq6. So it might be a good idea to uninstall a previous version of Xamarin Studio on Windows if it's there.
This is a good point. It's something that might need a small papercut bug filed. Feel free to log an issue here and I can coordinate the status: (https://bugzilla.xamarin.com/enter_bug.cgi?product=Visual%20Studio%20Extensions). In the past I've seen a couple ways around this. 1) Make a seperate .sln that might be called .Windows which will only load Windows native projects (Android, UWP, etc). This way the step is skipped completely. 2) You can simply unload the iOS project until you need to reload the project and work on the iOS side. However I do agree there should be a project property/IDE setting that should say "Start Xamarin Mac Agent on Startup".
That error is really vague. We would need to gather some logs(log files can be gathered from %LOCALAPPDATA%\Xamarin\Log or using Help->Xamarin). This operation could not be completed typically has an error/exception following it like This operation could not be completed: Invalid Pointer. So we would need to dig into logs here and see if we can get a Stack Trace when it happens. I would also try deleting your .suo in the .vs hidden folder of your project directory.
Im tearing my hair out with this one Im afraid and am down hours and hours.
Firstly I wanted to install VS Community to use with Unity. Im running windows 8.1 pro.
But I had trouble installing. Long story short there were some fonts in windows\fonts that the VS installer didnt like. So I moved the fonts and the installer ran through successfully. I then installed the VS 2013 Tools for Unity.
So then I imported the Unity VS tools to my project. Now my unity project hangs when unity opens. I fixed unity by removing the Unity VS stuff form the project directory.
I started getting errors on screen that said "An unhandled exception System.Configuration.ConfigurationErrorsException) occurred in ZAPrivacyService.exe[3168]
The Just In Time Debugger was launched without necessary security permissions etc etc
Also the above error message appears very frequently and even if i ignore the dialogue it just keeps popping up every minute or so. I just off the JIT prompts but then I get an error message saying that no JIT is available. instead of the other error message. ZAPrivacyService seems to be part of ZoneAlarm. So I downloaded and reinstalled it. No joy. I tried uninstalling the Unity VS tools. I then went to Programs and Features to remove VS. However when I click on VS I only get the option to change. So I click change and the VS splash screen briefly appears. Then nothing. I also tried rerunning the VS installer(from the ISO and the web exe) and the same thing happens.
I do want to get VS running I thought a reinstall could fix it. But not to even be able to reinstall.....
Also how can I set Vs to ignore everything except the projects im working on IN VS?
Any ideas????
Thanks