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!

Can someone at Xamarin please a bug to track this and link to it from here?


  • mattwardmattward GBMember Xamurai
    edited October 2015

    I have opened bug 34562 for this. You can add yourself to the cc list if you want be notified of updates.

  • DeanEllisDeanEllis USXamarin Team Xamurai

    Hi Andrew

    Thanks for the bug report. I will investigate this for you. So you know the background the Nuget package in question which I suspect is google play, have to download the android resources from google its not something we can ship directly in the package AFAIK. We are currently not sure what the design experience will be if we don't do that in a "design time build" but I will test it out, our concern is that resources will be missing so the designer won't behave as it should (or fail).

    Do you know if there is an MSBuild property that we can hook into to we know its a design time build? Nothing obvious is showing up in the docs.


  • DeanEllisDeanEllis USXamarin Team Xamurai

    According to this http://blogs.msdn.com/b/msbuild/archive/2005/11/19/493508.aspx there is a "BuildingProject" property which we might be able to use. But it looks like its undocumented.

  • AndrewArnottAndrewArnott USMember ✭✭

    Hi @DeanEllis. I was just on the project & build team at Microsoft, so I know the right folks to help you out. I believe the condition to check for during a build is:

    <DoSomethingHuge Condition=" '$(DesignTimeBuild)' != 'true' " />

    I'll ask the current P&B team to add any other guidance necessary to this thread as well. But feel free to try this out now.

Sign In or Register to comment.