Visual Studio for Mac - Build very slow, stuck - xamarin

I have ported a Xamarin Studio app that use Xamarin Forms, iOS/Android to Visual Studio for Mac. All my other apps build fine but for some reason this specific app doesn't want to build at all, it is stuck half way in the build process.
I deleted the bin and obj folders.
I have done a Clean, even the clean takes long.
The packages folder is up to date etc.
I do have the latest update from the Stable branch.
Not sure what is wrong here?

I had this too. I opened XCode on the mac and there was an prompt for installing additional components waiting for me. I answered yes and then restarted VS.net when it completed and now it builds fine.​

I can second this; there is no visual indication that anything is wrong with the build it just churns away. Opening XCode and clicking yes to the dialog that additional components still needed to be installed worked for me as well.

Related

Visual Studio no folders or files included in .Net Core projects, and can't manually include them

This is happening with all new .Net Core projects (Console App, Class Library, Web Application etc), no matter the directory or drive I put them in.
The project is created and loads, but only the absolute bare minimum skeleton-of-a-skeleton is shown.
Quick screenshot:
If I tell it to show hidden files, I can see the whole project has been made:
Now if I select any file or folder, right click and choose 'Include in Project', nothing happens! I've tried closing and reopening Visual Studio, and have tried restarting my laptop, but still nothing happens.
Other projects work fine, e.g. WPF, Xamarin or anything that isn't done via .Net Core.
Is there a setting I may have missed or need to change somewhere? It's a strange issue indeed.
Thanks.
Turned out reinstalling Visual Studio was the only answer.
As in, full uninstall, delete the leftover folders in the old install location, then reinstall from scratch.
If I tried the update option, it failed at the start of the download. My guess is something messed up in Vistual Studio. It was fine before. The only thing I changed was that I recently installed AVG Antivirus, which seems way too strict on what processes it allows and disallows. AVG is now uninstalled.

files disappear from VS 2015 solution after saving

After installing VS 2015 Pro (14.0.25... with Update 3, licence key has been succesfully added), and creating a new project (especially in Javascript or TypeScript with Ionic 2 templates), when I open a file, (modified it or not), I save it and it disappear from Solution Explorer. Just before it disappear, the icon of the file is updated with a warning icon.
However, if I try to create a C++ project, there is no problem !
In a typescript project, after building, ts files appear again at the end of the build.
All my projects are located in c: disk. I've tried with and without using git.
The two extensions I've installed are : Ionic 2 templates and NPM Task runner. I uninstalled them, but the problem is still here.
When I restart VS, I can see again the files. But the problem is still here.
How to fix it ?
I had same issue on Windows 10.
It seems caused by windows update version 1709.
After I recovered my windows version to 1703, the problem was solved.
I can confirm that the 1709 (aka Fall Creator's Update) caused this. I was too low on space to keep the rollback. In another thread someone suggested that visual studio 2017 does not have this problem. I can confirm that is true; but this solution came (for me) with a few different problems. First, I can no longer deploy direct to my android phone. Second, my team-mates still on VS 2015 can no longer open the project at all! If you can move forward to VS 2017, you'll also need to install TypeScript SDK for Visual Studio 2017 before you can compile again.

Xamarin Tools for Visual Studio: Almost unusably slow

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.

Debugging Cordova App (android) with Visual Studio 2015 New Emulator

I am not sure if this is me doing something stupid or just up against the bleeding edge..
I am developing a simple Cordova app but that is academic since I can repeat this issue with the standard 'Wizzard produced' default application.
I had the app working and debugging fine with VS2013 using both Ripple and occasionally with a real device.
I don't have permanent access to the device so I thought Id try the new VS2015 CTP5 with emulator. So far so good. All builds ok and the app does get deployed to the emulator, and starts. However, VS is stuck in the 'deploying' process and never comes out. To the extent that I have to 'ctrl-Break' out of it. and the debugger never starts.. The last few lines of the build output are:
2> Built the following apk(s):
2> C:\Users\Brett\Documents\VisualStudioCordova\Projects\mblapp\mblapp\bld\Debug\platforms\android\ant-build\CordovaApp-debug.apk
2> Using apk: `C:\Users\Brett\Documents\VisualStudioCordova\Projects\mblapp\mblapp\bld\Debug\platforms`\android\ant-build\CordovaApp-debug.apk
2> Installing app on device...
2> Launching application...
2> LAUNCH SUCCESS
2> Command finished with error code 0: `C:\Users\Brett\Documents\VisualStudioCordova\Projects\mblapp\mblapp\bld\Debug\platforms`\android\cordova\run.bat --nobuild,--target=169.254.138.177:5555,--debug
2>
So there is an error there but I really don't get what it means..
Ok, So I went back to VS2013 but now the 2015 install has changed something and using Ripple it now breaks out of the code at unexpected places in the code.. not breakpoints.. and the javascript console says 'Paused at breakpoint' in its dropdown. I cant access the 2015 Emulator directly, but out of interest I left the emulator running after 2015 was closed and CAN connect AND debug using VS 2013.. great.. but its not a great way to start debugging..
I really like the look of the new Emulator and it does seem to work great with 2013.. so does anyone out there know how to make VS2013 deploy to the new emulator? .. I tried running it and did have some success. But I cant find where VS2015 has hidden its VHD file..
Or, does anyone know why VS2015 might not be deploying correctly.. Im happy to go with a solution that works.. Just that right now Im stuck not going forward, and its an uninstall 2015 and probable reinstall 2013 to go back...
Many thanks.
OK.. Ive posted this as an answer because it does deal with part of it.. and I did struggle a bit so it might help someone else.
Running the emulator from VS2013.
You need to go to the folder
C:\Program Files (x86)\Microsoft Visual Studio Emulator for Android\1.0
where the emulator is installed. Having run it at least once from VS2015, it had created a file called vsemu.vhd and vsemu.sdcard.vhd. Copy both these files to something similar in the same folder I used 'myemu'.
Then to start the emulator I created a simple shortcut with the target property:
"C:\Program Files (x86)\Microsoft Visual Studio Emulator for
Android\1.0\XDE.exe" /vhd bretts.vhd /video 1080x1920
this sets the resolution too.. You can find all the startup flags etc by using:
...XDE /?
Im not sure yet, but I think it stored the various app shortcuts in the sdcard file.. although I wouldn't swear to it. Ill repost if something changes there.
Ok Debugging.. I started VS2013 and set the debug target as 'Device'. This worked fine.. so far.
Id still love to know why 2015 is not deploying properly though, for now I'll just assume its the 'bleeding' part of the bleeding edge.
Cheers
There is a known issue in Visual Studio 2015 CTP5 with Cordova projects deploying to the Visual Studio Emulator for Android. The issue will be resolved in the next release.
In the meantime, here are a few workarounds to try:
Search your machine for Microsoft.VisualStudio.MultiDeviceHybridApps.dll. There will be two copies--one under "Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Emulator for Android\" (the VS Emulator version of the dll) and one in another folder under "Program Files\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\" (the folder name varies, but it is always some random hash; this is the Cordova version of the dll). Close out of VS2015 and replace the Microsoft.VisualStudio.MultiDeviceHybridApps.dll in the Emulator for Android folder with the one in the Cordova folder (delete the Emulator one, copy the Cordova one, and paste it in the Emulator folder). Then go to "C:\Users\your username\AppData\Local\Microsoft\VisualStudio\14.0\Extensions" and delete the contents of this folder.
Create a new Visual C++ Native-Activity Application (File > New > Project, under Installed\Templates\Visual C++\Cross Platform\Native-Activity Application (Android)) and run it, then return to your Cordova project.
Reinstall CTP5 and the Visual Studio Emulator for Android and reinstall.
Hope this helps!
Another workaround for webkit developers (Android and iOS), the Chrome remote debugger, check out here.
With this you can debug as you would do normally, this does work with the emulators of vs2015 ctp5!

Visual Studio runs comments

For some reason VS 2013 is completely ignoring my changes to the file.
Namely, even if I comment a whole section out it would still execute it!
I tried:
Clean build
restart computer
removing and including the same file again
Note: I am developing a cross platform application using Xamarin and VS.
Would appreciate any help!
Thanks
Probably you have compiled the project for Release, change that to Debug and build it again.
I doubt this question or answer would help anyone but here goes...
Solution: I had to update my SDK from the Android SDK Manager:
Open Android SDK Manager
Under Tools tick the checkbox next to the most recent Rev. ( I installed 23.0.5)
Click "Install packages..."
Background
After having the problem I described I noticed few other really strange things. For example VS would not let me modify any of my drawables. If I tried to delete, add or rename any drawable VS would get stuck and the only way to solve this was to force stop it.
Here is the bug for this issue Visual Studio hangs when including, excluding, or saving files in Android resource folders.
Once I installed the latest SDK everything was well.
Hope this helps

Resources