Bug 34562 - Xamarin.Android hangs VS for long periods when installing NuGet packages
Summary: Xamarin.Android hangs VS for long periods when installing NuGet packages
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: 5.1
Hardware: PC Windows
: High critical
Target Milestone: 6.0 (C6)
Assignee: dean.ellis
URL:
: 35797 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-05 11:59 UTC by Matt Ward
Modified: 2015-11-13 14:46 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
hangcallstack (30.53 KB, text/plain)
2015-10-05 11:59 UTC, Matt Ward
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Matt Ward 2015-10-05 11:59:23 UTC
Created attachment 13193 [details]
hangcallstack

Originally raised on the forum by Andrew Arnott:

http://forums.xamarin.com/discussion/52746/xamarin-android-hangs-vs-for-long-periods

When installing a NuGet package to a new Xamarin.Android project, VS hung for several minutes. I broke into VS with the debugger and found via the callstack (attached) that the hang is caused by the NuGet package manager enumerating references, causing the C# project system to request a synchronous design-time build on the UI thread, leading to MSBuild running a Xamarin.Android task. The Xamarin.Android task downloads many megabytes of data from the Internet. This seems very inappropriate for a design-time build, which is supposed to run in under 200ms. Please adjust your Xamarin.Android MSBuild targets to skip expensive tasks like this during design-time builds!
Comment 1 Peter Collins 2015-10-06 14:28:46 UTC
I'm able to reproduce this on the current stable as well as active Cycle 6 builds. I'm not entirely sure how much of an impact clearing the NuGet/Xamarin package caches has on this, however attempting to add GooglePlayServices - All from a clean state is certainly quite painful.

Steps to reproduce:
1. Delete the following cache locations if they exist:
> %LOCALAPPDATA%\NuGet\Cache
> %LOCALAPPDATA%\Xamarin\Android.Support.*
> %LOCALAPPDATA%\Xamarin\GooglePlayServices.*
2. Create a new hello world android template
3. Right click on the project/solution -> Manage NuGet Packages...
4. Search for "Google Play Services All", select and install that option once it appears.

With this workflow, you can see VS free up _briefly_ in between package additions. However if you're attempting to add 5+ packages or so (quite noticeable when adding all of the google play services packages), this results in a few minutes of unresponsiveness.
Comment 2 dean.ellis 2015-10-23 15:41:20 UTC
Fixed in monodroid/master/39ee3143

We added support for DesignTimeBuild property. The VS team also needed to add support for passing that property as part of the UpdateAndroidResources call.
Comment 3 Jose Gallardo 2015-11-12 07:11:43 UTC
*** Bug 35797 has been marked as a duplicate of this bug. ***
Comment 4 Peter Collins 2015-11-13 12:34:50 UTC
This is verified fixed against xamarinvs/cycle6/860fe435 (monodroid/cycle6/3efa14c)