Bug 39034 - VS2015 hangs an build
Summary: VS2015 hangs an build
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: High normal
Target Milestone: 4.2.0 (C8)
Assignee: Juan Marcelo Tondato
Depends on:
Reported: 2016-02-23 09:49 UTC by Michael Rumpler
Modified: 2016-12-07 20:14 UTC (History)
12 users (show)

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

more info (302.76 KB, application/x-zip-compressed)
2016-02-23 09:49 UTC, Michael Rumpler

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 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:

Description Michael Rumpler 2016-02-23 09:49:34 UTC
Created attachment 15146 [details]
more info

About two weeks ago after I installed XamarinVS my VS2015 started to sometimes hang when I press F5 to build and deploy to my Android device. When this happens, I can only kill devenv via the Task Manager (VS takes about 50% of the CPU at that time).
Unfortunately when I restart VS and try again, it hangs again. It even hang when I tried to deploy the iOS project or clean the solution from within VS.
The first time when that happened, I tried to delete all bin and obj folders, reboot the machine, revert to an older version of XamarinVS, I even restored a version of my virtual machine from mid of January and tried with the same solution and even that hang. After two days of frustration I found out that it works again when I delete the .vs folder.

Unfortunately I have this problem at least once a day now. I think it also correlates with editing some Android layouts in .axml files. But this could also be a coincidence because I do mostly that currently and I started with it at the same time I installed

I found bug #36185 last week. It is a different problem, but I used the comments from there to get more info. It always seems to hang in Xamarin.VisualStudio.MsBuild.MsBuildService. Although I found two methods where it occurred: CreateBuildSubmission and BuildSubmission.

I run Windows 10 in a Parallels VM on the Mac. My solution is written in Xamarin Forms and currently includes only Android and iOS projects. The attached .zip includes more info which I thought useful.

VS_about.txt                    The About Visual Studio dialogue with all the installed versions
VS_hangs.png                    A screenshot of VS when it hangs (statusbar says Deploy succeeded, but according to the Output window the build is not finished)
VS_attach_to_devenv.png         An error message I get when attaching to devenv from a different VS instance.
VS_debug1.png                   A screenshot of the debugging VS with Call Stack hanging in BuildSubmission.
VS_debug2.png                   A screenshot of the debugging VS with Call Stack hanging in CreateBuildSubmission.

If you need more, I'm also available via Skype and Team Viewer.
Comment 1 Sebastian Span 2016-04-06 13:56:11 UTC
I had the same Problem. Seems to work again without any Problems after I changed vs Option "Maximum number of parallel Project builds" from 4 to 1...

VS -> Tools -> Options -> Projects and Solutions -> Build and Run
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2016-05-09 20:05:03 UTC
I will add some of the text from call stacks in the screenshots for extra searchability.

### Transcribed excerpt of the call stack from VS_debug1.png

> Xamarin.VisualStudio.dll!Xamarin.VisualStudio.MsBuild.MsBuildService.BuildSubmission(Microsoft.VisualStudio.Shell.Interop.IVsBuildManagerAccessor accessor, Microsoft.Build.Execution.BuildSubmission submission, bool buildInProgress, ...
> Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.Services.AndroidToolsBuildService.BuildProject(EnvDTE.Project project, string target, Xamarin.VisualStudio.IProgressReport progress, ref System.Exception ex, bool designTimeBuild)
> Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject.AndroidResourcesHasBuildErrors()
> Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject.OnBuildDone(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)

### Transcribed excerpt of the call stack from VS_debug2.png

> Xamarin.VisualStudio.dll!Xamarin.VisualStudio.MsBuild.MsBuildService.CreateBuildSubmission(string[] targetsToBuild, string fullName, Microsoft.Build.Framework.ILogger[] loggers, System.Collections.Generic.IDictionary<string, string> globalProperties, 
> Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.Services.AndroidToolsBuildService.BuildProject(EnvDTE.Project project, string target, Xamarin.VisualStudio.IProgressReport progress, ref System.Exception ex, bool designTimeBuild) Line 51
> Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject.AndroidResourcesHasBuildErrors() Line 509
> Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject.OnBuildDone(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action) Line 518
Comment 3 Michael Rumpler 2016-05-10 07:50:37 UTC
I think this can be closed. The problem does not occur anymore.

I'm on XamarinVS now. I cannot use a newer one because of https://bugzilla.xamarin.com/show_bug.cgi?id=38982

My Maximum number of parallel Project builds is at 2. I cannot remember whether I changed it manually.
Comment 5 Michael Rumpler 2016-07-15 06:31:50 UTC
I still have the problem. And I am now sure that it only happens, when I had some .axml files open. I don't do that very often, so the problem did not happen often enough and I thought it was gone in the meantime. But it is still there.

I even upgraded to VS 2015 Enterprise (from Prof.) and XamarinVS in the meantime, but the problem persists.

When I open some .axml files and try to compile Android afterwards, VS hangs. Even if I reopen VS after the hang, the .axml files are still open and I don't switch to them (a .cs file is in the foreground) or edit them and try to compile, it does not work. I have to close the .axml files, restart VS and then it works.
Comment 6 Michael Rumpler 2016-07-15 06:49:51 UTC
Here is some information from my current environment. I can reproduce the bug. You could contact me and connect via TeamViewer at any time to look for more information yourself.

About VS:

Microsoft Visual Studio Enterprise 2015
Version 14.0.25123.00 Update 2
Microsoft .NET Framework
Version 4.6.01038

Xamarin (a9c7826)
Xamarin.Android (ee215fc)
Xamarin.iOS (be25da5)

Call stack of hung VS from just now:

 	mscorlib.dll!System.IO.Path.HasIllegalCharacters(string path, bool checkAdditional)	Unknown
 	mscorlib.dll!System.IO.Path.CheckInvalidPathChars(string path, bool checkAdditional)	Unknown
 	mscorlib.dll!System.IO.Path.NormalizePath(string path, bool fullCheck, int maxPathLength, bool expandShortPaths)	Unknown
 	mscorlib.dll!System.IO.Path.GetFullPathInternal(string path)	Unknown
 	mscorlib.dll!System.IO.File.InternalExistsHelper(string path, bool checkHost)	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Execution.BuildParameters.CheckMSBuildExeExistsAt(string path)	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Execution.BuildParameters.FindMSBuildExe()	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Execution.BuildParameters.Initialize(Microsoft.Build.Collections.PropertyDictionary<Microsoft.Build.Execution.ProjectPropertyInstance> environmentProperties, Microsoft.Build.Evaluation.ProjectRootElementCache projectRootElementCache, Microsoft.Build.Evaluation.ToolsetProvider toolsetProvider)	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Execution.BuildParameters.BuildParameters(Microsoft.Build.Evaluation.ProjectCollection projectCollection)	Unknown
 	Microsoft.VisualStudio.CommonIDE.dll!Microsoft.VisualStudio.CommonIDE.BuildManager.BuildManagerAccessor.PrepareDesignTimeBuild(string logFileName)	Unknown
 	Microsoft.VisualStudio.CommonIDE.dll!Microsoft.VisualStudio.CommonIDE.BuildManager.BuildManagerAccessor.AcquireBuildResources(Microsoft.VisualStudio.Shell.Interop.VSBUILDMANAGERRESOURCE fResources, string logFileName, out uint phCookie)	Unknown
 	Microsoft.VisualStudio.CommonIDE.dll!Microsoft.VisualStudio.CommonIDE.BuildManager.BuildManagerAccessor.BeginDesignTimeBuild()	Unknown
 	Microsoft.VisualStudio.CommonIDE.dll!Microsoft.VisualStudio.Build.ComInteropWrapper.ProjectShim.BuildTargetsImpl(string[] targetNamesToBuild, Microsoft.VisualStudio.Build.ComInteropWrapper.ITargetOutputs targetOutputs, bool retainCachedProjectInstance, bool isRealBuild, bool isOutOfProcBuild, Microsoft.VisualStudio.Build.ComInteropWrapper.IProjectShimBuildTargetsAsyncCallback callback)	Unknown
 	Microsoft.VisualStudio.CommonIDE.dll!Microsoft.VisualStudio.Build.ComInteropWrapper.ProjectShim.BuildTargetListWithOutputs(string targetList, Microsoft.VisualStudio.Build.ComInteropWrapper.ITargetOutputs targetOutputs, bool isRealBuild, bool isOutOfProcBuild)	Unknown
 	[Native to Managed Transition]	
 	[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.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext)	Unknown
 	mscorlib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout, bool exitContext)	Unknown
 	mscorlib.dll!System.Threading.WaitHandle.WaitOne()	Unknown
 	Microsoft.Build.dll!Microsoft.Build.Execution.BuildSubmission.Execute()	Unknown
>	Xamarin.VisualStudio.dll!Xamarin.VisualStudio.MsBuild.MsBuildService.BuildSubmisson(Microsoft.VisualStudio.Shell.Interop.IVsBuildManagerAccessor accessor, Microsoft.Build.Execution.BuildSubmission submission, bool buildInProgress, Microsoft.Build.Framework.ILogger[] loggers)	Unknown
 	Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.Services.AndroidToolsBuildService.BuildProject(EnvDTE.Project project, string target, Xamarin.VisualStudio.IProgressReport progress, ref System.Exception ex, bool designTimeBuild)	Unknown
 	Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject.AndroidResourcesHasBuildErrors()	Unknown
 	Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.MonoAndroidFlavoredProject.OnBuildDone(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)	Unknown
 	EnvDTE.dll!EnvDTE._dispBuildEvents_SinkHelper.OnBuildDone(EnvDTE.vsBuildScope A_1, EnvDTE.vsBuildAction A_2)	Unknown
 	[Native to Managed Transition]	
 	[Managed to Native Transition]
Comment 7 Michael Rumpler 2016-07-15 07:00:32 UTC
I tried to let VS continue and break at different times. It always stopped in Xamarin.VisualStudio.MsBuild.MsBuildService.BuildSubmisson, but what it called from there was different.

At one time I stopped when it tried to throw an System.InvalidOperationException "The operation cannot be completed because a build is already in progress."

Maybe that helps you to find the exact spot where it happened.
Comment 8 Brendan Zagaeski (Xamarin Team, assistant) 2016-08-21 03:47:10 UTC
## Note to the Xamarin team

It appears I might have found a fairly consistent way to replicate this problem in the Cycle 8 builds in particular: Bug 43565.  Admittedly the test case on that bug is a Xamarin.iOS project and I only see the problem with Cycle 8 (unlike the older versions mentioned on this bug), so there is still a chance the 2 problems are distinct, but the call stack does look quite similar, and deleting the `.suo` file (or the `.vs` folder) helps in that case too.
Comment 9 xamarin-release-manager 2016-08-23 17:06:06 UTC
Fixed in version (cycle8)

Author: jmt
Commit: 9c61c83753831cb024f87f8ed47ca4925aeb2a9f (xamarin/XamarinVS)
Comment 14 Shruti 2016-09-12 04:47:26 UTC
@Michael, Could you please confirm us that the issue has been fixed at your end with our current beta builds.
Comment 15 Luis Aguilera 2016-09-12 14:42:24 UTC
repro steps from @jmt:

1. open designer

2. make changes in resources. Some resource that you use in the main.layout, for example change the ide of a string resource. 
Save it.

3. execute manual build (F6)

At this point VS hangs if there are issues related to build.

We are running an msbuild target after build is done, the idea is collect and detect the build errors related to changes in resources in order to notify it to designer.

This hang should be reproducible on a consistent manner.
Comment 16 Mohit Kheterpal 2016-09-12 15:52:22 UTC
I am able to reproduce this issue with XVS by following the steps mentioned in comment 15 as shown in screencast : http://screencast.com/t/CARUs9iA0r

VS 2015 is hanging on build.

I have also checked it with latest build of Cycle 8 i.e. XVS and observed that this issue has been fixed as shown in screencast : http://screencast.com/t/jSnZV1CYs9

Hence closing this issue by marking it as Verified.

Comment 17 Michael Rumpler 2016-09-13 11:18:25 UTC
I tried switching to the beta channel twice now. That should install Xamarin, but I always get "The cabinet file 'xamarin.cab' required for this installation is corrupt and cannot be used.".
Additionally after the setup failed like that, the old version is not available anymore either and I have to reinstall the whole Xamarin Platform.
At the 2nd try, I got a blue screen and now even after reinstalling Xamarin, VS claims that my iOS projects are incompatible and cannot be loaded.

As I also have my own work to do, I'll go back to my last backup now. I'll try another time and reopen this issue once it pops up in a newer release which actually installs.
Comment 18 Mohit Kheterpal 2016-09-13 11:27:44 UTC
Thanks @Michael for checking this issue at your end. 

Please feel free to reopen it, if this issue is still not fixed for you.

Providing logs and test sample will be helpful to reproduce and fixed this issue.

Comment 19 Jose Gallardo 2016-09-13 20:53:10 UTC
Hi @Michael,

That latest issue you are facing with the installer should be already fixed in current stable.

Please feel free to let us know if you're still getting that wrong behavior.

Comment 20 cheansiong 2016-12-07 09:00:11 UTC
Hi @Jose Gallardo,

I'm still having this issue after upgraded to, may I know what information you need here?

Comment 21 Brendan Zagaeski (Xamarin Team, assistant) 2016-12-07 20:14:06 UTC
In reply to Comment 20,

Please file a new bug report for the issue you are seeing, being sure to include as many details as possible [1].  Thanks in advance!

[1] https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/howto-file-bug/