|Summary:||After upgrading to latest Xamarin- Visual Studio stuck/hangs at initialization of xamarin.andorid project while loading projects|
|Product:||Android||Reporter:||Sanket Hamdapure <getsanket.hamdapure>|
|Severity:||normal||CC:||Anthony.Coqui, brendan.zagaeski, dean.ellis, dpeterson, jas, jimmy.garrido, joe, jon.douglas, kzu, mono-bugs+bugzilla, mono-bugs+monodroid, onevitalboy, tonyvca, vkalyanapu|
|Target Milestone:||15.4 SR2|
|Tags:||Is this bug a regression?:||---|
|Last known good build:|
MoreData for issue like version+XamarinLog+VS screenshot
Successful project load
Failed project load
Failed to load project
mini dump file
design time build logs
Modified .targets files for workaround
Description Sanket Hamdapure 2017-10-10 08:53:08 UTC
Created attachment 25236 [details] MoreData for issue like version+XamarinLog+VS screenshot After upgrading to latest Xamarin with the latest stable version which is release on 09-Oct-2017 my Visual studio 2015 getting hang when I am trying to open/load my project solution, It loads all the projects but stuck while initializing the Android project. After that only option remains to kill the Visual studio. Problem starts after taking Xamarin update. If I remove Android projects from solution then it loads properly. Attaching screen shot for more details- Version info - version.jpg Xamarin Log for ide- 2017-10-10_13-35-10.15492.Ide.log Visual studio screenshot where it stuck -
Comment 1 Sanket Hamdapure 2017-10-10 15:28:12 UTC
Just to add on - When i downgrade my Xamarin.Android to 126.96.36.199 from 188.8.131.52, it start working as previously.
Comment 2 Drew Peterson 2017-10-12 15:34:03 UTC
I'm running into the same issue, but it isn't reproducible quite 100% of the time. I did get lucky yesterday and got the solution to load once or twice. I'm attaching two log files, one from when it successfully loads the solution/project, and one when it doesn't.
Comment 3 Drew Peterson 2017-10-12 15:38:36 UTC
Created attachment 25286 [details] Successful project load This is a log file from a successful attempt at loading a Xamarin.Android project with v4.7 of the VS extension
Comment 4 Drew Peterson 2017-10-12 15:39:07 UTC
Created attachment 25287 [details] Failed project load This is a log file from a failed attempt at loading a Xamarin.Android project with v4.7 of the VS extension
Comment 5 Victor 2017-10-12 19:57:37 UTC
Created attachment 25292 [details] Failed to load project Project was loading correctly until i started working on iOS project. It is hanging every time i open the Solution.
Comment 6 Victor 2017-10-12 20:22:04 UTC
I figured a work around - remove the android projects from solution and add it after solution is loaded.
Comment 7 dean.ellis 2017-10-13 10:22:13 UTC
Victor you might also want to try deleting the .vs folder as a work around too. In the mean time we are investigating this issue.
Comment 8 Victor 2017-10-13 17:13:30 UTC
Thanks Dean! Deleting .vs folder also worked.
Comment 9 Jimmy [MSFT] 2017-10-17 03:14:38 UTC
Created attachment 25327 [details] mini dump file I am including some additional information that may help the investigation. I am attaching the mini dump gathered from a hanging VS instance (the full dump is also available if necessary) as well as the design time logs gathered both from when VS successfully loads the solution and when it hangs. The dump file shows this call stack from the main thread which seems to indicate the hang is a result of the GetAdditionalResourcesFromAssemblies task: > [Managed to Native Transition] > WindowsBase.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(System.IntPtr waitHandles, bool waitAll, int millisecondsTimeout) Unknown > mscorlib.dll!System.Threading.SynchronizationContext.InvokeWaitMethodHelper(System.Threading.SynchronizationContext syncContext, System.IntPtr waitHandles, bool waitAll, int millisecondsTimeout) Unknown > [Native to Managed Transition] > [Managed to Native Transition] > mscorlib.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle waitHandles, int millisecondsTimeout, bool exitContext) Unknown > mscorlib.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle waitHandles, System.TimeSpan timeout, bool exitContext) Unknown > Xamarin.Android.Build.Tasks.dll!Xamarin.Android.Tasks.AsyncTask.WaitForCompletion() Unknown > Xamarin.Android.Build.Tasks.dll!Xamarin.Android.Tasks.AsyncTask.Execute() Unknown > Xamarin.Android.Build.Tasks.dll!Xamarin.Android.Tasks.GetAdditionalResourcesFromAssemblies.Execute() Unknown > Microsoft.Build.dll!Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() Unknown > Microsoft.Build.dll!Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) Unknown > mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.__Canon>.Start<Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26>(ref Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26 stateMachine) Unknown Full stack trace: https://gist.github.com/jimmgarrido/b947d9744dfc06290b3a19720e774b51 I have not been able to find definite steps to reproduce the issue with a new project, but I got the above information from an existing project on my machine that began exhibiting the issue. However I zipped up the entire project, including the .vs directory, but after it was unzipped it did not reproduce the issue so sharing the solution does not seem helpful in this case unfortunately.
Comment 10 Jimmy [MSFT] 2017-10-17 03:15:14 UTC
Created attachment 25328 [details] design time build logs
Comment 11 Jimmy [MSFT] 2017-10-17 03:18:30 UTC
*** Bug 60158 has been marked as a duplicate of this bug. ***
Comment 12 Jon Douglas [MSFT] 2017-10-17 15:03:57 UTC
Based off logs in MyTestingApp_Compile_f91ef4fd.designtime.log: https://bugzilla.xamarin.com/show_bug.cgi?id=60080#c10 We can see that the Task "GetAdditionalResourcesFromAssemblies" is hanging indefinitely and most likely causing the Visual Studio hangs. From the minidump, it seemms that the "AsyncTask" inherited by "GetAdditionalResourcesFromAssemblies" Task is hanging on a WaitHandle. More specifically it seems to be the following line of code: https://github.com/xamarin/xamarin-android/blob/d15-4/src/Xamarin.Android.Build.Tasks/Tasks/AsyncTask.cs#L277 Thus I would like to invite anyone reading this message to provide a dump file(https://developer.xamarin.com/guides/cross-platform/windows/visual-studio/troubleshooting/vs-callstack/) and/or design time build logs(https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md#getting-visual-studio-to-output-the-results-of-a-design-time-build) when they encounter this issue so we can ensure that this is the same case across the board. In the meantime, we will be further investigating this issue and trying to come up with a more reliable reproduction.
Comment 13 Brendan Zagaeski (Xamarin Team, assistant) 2017-10-17 23:53:36 UTC
## Bookkeeping note I am marking the issue as confirmed based on Comment 9, and I am setting the target milestone to 15.4 SR2 for initial investigation based on the number of user reports that indicate a regression in behavior compared to the Xamarin 15.3 Release.
Comment 15 Brendan Zagaeski (Xamarin Team, assistant) 2017-10-19 04:16:41 UTC
Created attachment 25368 [details] Modified .targets files for workaround ## Workaround (that might re-break Bug 57281) Add back the following attribute on the `GetAdditionalResourcesFromAssemblies` Task element in Xamarin.Android.Common.targets and Xamarin.Android.Bindings.targets: Condition=" '$(DesignTimeBuild)' == 'false' Or '$(DesignTimeBuild)' == '' " In case it might be helpful, I have attached modified files with this 1-line change onto this comment. (You can use `fc` (https://technet.microsoft.com/library/bb490904.aspx) in a cmd.exe command prompt to compare these files to the original versions for verification before overwriting the originals.) 1. Download the attached .zip file. 2. Right-click the file in Explorer and select the "Properties > General [tab]". If an "Unblock" checkbox is present, enable it and select "OK". (This checkbox will appear depending on how the file was downloaded.) 3. Unzip the 2 .targets files from the .zip file. 4. For Visual Studio 2017, copy the .targets files into the following location, overwriting the existing files: %VSINSTALLDIR%\MSBuild\Xamarin\Android By default the full expanded path for this (for example in a Developer Command Prompt) will be one of the following, depending on Visual Studio edition: > C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android > C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android > C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android For Visual Studio 2015, copy the files into the following location, overwriting the existing files: > C:\Program Files (x86)\MSBuild\Xamarin\Android\ ## Results Before this change I was able to hit the issue on 5/5 consecutive solution load attempts in Visual Studio 2017 and 2015. After this change, I did _not_ hit this issue on _any_ of 5 consecutive solution load attempts in either version of Visual Studio. ## Background information This issue is caused by the attempted fix for Bug 57281 where the `GetAdditionalResourcesFromAssemblies` task was re-enabled for "design time" builds to make XAML IntelliSense behave as expected when the active configuration is set to an Android project. Unfortunately, this bug report demonstrates that the logic added to avoid downloads in the `GetAdditionalResourcesFromAssemblies` task was not by itself sufficient to avoid hangs in that task during the design time build.
Comment 16 Tony 2017-10-19 14:17:19 UTC
Even after removing the Android Project from this solution, it still freezes my Visual Studio 2017 version 15.5 Preview 1.0
Comment 17 Brendan Zagaeski (Xamarin Team, assistant) 2017-10-19 17:29:48 UTC
> Even after removing the Android Project from this solution, it still freezes > my Visual Studio 2017 version 15.5 Preview 1.0 There is a different issue under investigation in the Visual Studio 2017 version 15.5 Preview version that is unrelated to this `GetAdditionalResourcesFromAssemblies` issue: https://developercommunity.visualstudio.com/content/problem/130490/vs-freezes-when-loading-a-solution.html (The call stack in that case is in "IdbClient" rather than "GetAdditionalResourcesFromAssemblies".)
Comment 18 Jon Douglas [MSFT] 2017-10-23 20:33:58 UTC
Recategorizing this bug to Android - MSBuild as this is a fault with design-time builds in VS 2017. This has been reverted in 15.4 SR2 based on the following PR: https://github.com/xamarin/xamarin-android/pull/952 Thus I am marking this as RESOLVED - FIXED for the time being. It still will need to be tested on d15-5 and master. In this case, new bugs should be opened up after verification testing.