Bug 53817 - "GoogleServicesJson" Build Action causes Visual Studio hangs (pauses, freezes) for a long time when loading projects or during other build scenarios, with many background aapt.exe processes spawning and then closing during the delay
Summary: "GoogleServicesJson" Build Action causes Visual Studio hangs (pauses, freezes...
Status: VERIFIED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: Production (addons.xamarin.com)
Hardware: PC Windows
: --- critical
Target Milestone: ---
Assignee: Bill Holmes
URL:
: 52906 53071 53585 54337 54345 ()
Depends on:
Blocks:
 
Reported: 2017-03-23 00:41 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2018-04-17 17:25 UTC (History)
7 users (show)

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


Attachments
Example minidump files from busy Visual Studio instance (2.39 MB, application/zip)
2017-03-23 00:42 UTC, Brendan Zagaeski (Xamarin Team, assistant)
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 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-23 00:41:05 UTC
"GoogleServicesJson" Build Action causes Visual Studio hangs (pauses, freezes) for a long time when loading projects or during other build scenarios, with many background aapt.exe processes spawning and then closing during the delay




## Fixed by Xamarin.Build.Download 0.4.3-beta2 and higher

Updating to NuGet package Xamarin.Build.Download 0.4.3-beta2 [1] or higher resolves the problem, at least for the particular test case and test environment described in this report.

[1] https://github.com/xamarin/XamarinComponents/pull/128




## Notes

Although this issue has several related bug reports (Bug 52906, Bug 52967, 53585), I am filing a new clean bug report for this exact symptom:


(a) Because I was able to replicate the issue locally and collect detailed information about it, including a simple test case attached to the bug report and a set of steps to replicate that worked consistently in my environment.


(b) To clearly surface the fact that updating to Xamarin.Build.Download 0.4.3-beta2 [1] and higher resolves the problem.

[1] https://github.com/xamarin/XamarinComponents/pull/128


(c) Because Bug 52967 went down a path of also discussing a slightly separate symptom with incremental builds, making it a bit tougher to see that the `aapt.exe` issue has in fact been resolved.




## Steps followed to test

1. Open the attached test case.

2. Build the Android project.

3. Quit Visual Studio and reopen the solution.

4. Use "Project > Add Existing Item" on the Android project.

5. Select the "google-services.json" file from the project folder.

6. Set the build action to "GoogleServicesJson".

7. Quit Visual Studio (saving the changes to the project) and then reopen the solution.




## BAD Results


- Visual Studio is busy for a long time when it starts loading the project.


- Task Manager shows several `aapt.exe` processes being spawned and closed one after the other.


- Sampling the Call Stack of the Main Thread [1] during this time shows that Visual Studio is indeed responsible for launching `aapt.exe` (full sample minidumps attached):
> Xamarin.Android.Build.Tasks.dll!Xamarin.Android.Tasks.Aapt.Execute()
...and "converting resources":
> Xamarin.Android.Build.Tasks.dll!Xamarin.Android.Tasks.ConvertResourcesCases.Execute()



## Steps to test the new Xamarin.Build.Download package v0.4.3-beta3 (and higher) from Bug 52967, Comment 25

1. Unzip a fresh copy of the test case.

2. Update the Xamarin.Build.Download NuGet package to pre-release version v0.4.3-beta6 in the Android project.

3. Complete steps 2-7 from the original test.




## GOOD Results

- Visual Studio is busy for a little while, but then soon becomes responsive again.

- Task manager shows at least one `aapt.exe` process being spawned, but soon it exits, and then there are no more new `aapt.exe` processes spawned.




## Testing environment info

XamarinVS 4.3.0.784 (73f58d6)

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Java JDK 8u121 (1.8.0_121) (64-bit)
Android NDK r11c (64-bit)

Android SDK Tools 25.2.5
Android SDK Platform-tools 25.0.3
Android SDK Build-tools 25.0.2

Android 7.0 (API 24) SDK Platform Rev. 2

Windows 10 (64-bit) Version 1607 (OS Build 14393.321)
US English locale, US Eastern time zone
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-23 00:42:58 UTC
Created attachment 20693 [details]
Example minidump files from busy Visual Studio instance

I collected these example files by following the steps on https://developer.xamarin.com/guides/cross-platform/windows/visual-studio/troubleshooting/vs-callstack/
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-23 00:47:38 UTC
## Verification status: verified fixed in Xamarin.Build.Download 0.4.3-beta2 and higher

GOOD: Xamarin.Build.Download 0.4.3-beta6
GOOD: Xamarin.Build.Download 0.4.3-beta2
BAD:  Xamarin.Build.Download 0.4.3-beta1

(Downgrading from 0.4.3-beta2 to 0.4.3-beta1 caused the problem to come _back_, which concurs precisely with the expected location of the fix as described in Bug 52967, Comment 23.)
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-23 00:52:19 UTC
*** Bug 52906 has been marked as a duplicate of this bug. ***
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-23 00:55:55 UTC
*** Bug 53585 has been marked as a duplicate of this bug. ***
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-23 16:32:14 UTC
*** Bug 53071 has been marked as a duplicate of this bug. ***
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2017-04-03 02:15:53 UTC
*** Bug 54345 has been marked as a duplicate of this bug. ***
Comment 7 Jon Douglas [MSFT] 2017-04-03 17:17:52 UTC
*** Bug 54337 has been marked as a duplicate of this bug. ***
Comment 8 Jeremy Kolb 2018-04-17 17:25:52 UTC
This still occurs with Xamarin.Build.Download 0.4.9