Bug 32977 - [Suspected upstream] Visual Studio 2015 GUI thread sometimes hangs during Microsoft.VisualStudio.DesignTools.Utility.AssemblyTypesPool.GetTypes(), possibly related to Xamarin.Forms XAML IntelliSense
Summary: [Suspected upstream] Visual Studio 2015 GUI thread sometimes hangs during Mic...
Status: RESOLVED DUPLICATE of bug 32909
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Xamarin.Forms ()
Version: 3.11 (C5)
Hardware: PC Windows
: --- major
Target Milestone: 3.11.4 (C5SR4)
Assignee: Bugzilla
Depends on: 32909 32912
  Show dependency tree
Reported: 2015-08-11 17:02 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-08-27 15:52 UTC (History)
4 users (show)

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

Test case (288.46 KB, image/png)
2015-08-11 17:02 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-11 17:02:21 UTC
Created attachment 12455 [details]
Test case

[Suspected upstream] Visual Studio 2015 GUI thread sometimes hangs during Microsoft.VisualStudio.DesignTools.Utility.AssemblyTypesPool.GetTypes(), possibly related to Xamarin.Forms XAML IntelliSense

I am copying the available information so far into a bug report for tracking. Based on this information (namely the attached screenshot of the call stack), it appears this might be an upstream bug in Visual Studio 2015's XAML IntelliSense that is exposed when using the Xamarin.Forms metadata.

## Reports indicating that the problem might be related to the XAML IntelliSense metadata

### opiants
"The problem with VS randomly freezing seems to be related with the workaround [1] you mentioned"

> [1] http://xvs.xamarin.com/Xamarin.Forms.Intellisense.zip

### Vincent.7207

"there is an issue with this workaround: VS2015 Hangs/crashes most of the time"

"@LucaPinasco you're right. When I removed the workaround of the Intellisense, VS2015 RTM doesn't hangs/crashes anymore."

### LucaPinasco
"I removed now that workaround and it seems to work now"

## Partial transcription of the call stack

(Transcribed from the attached image, provided by a customer here: http://forums.xamarin.com/discussion/comment/145600/#Comment_145600.)

(I transcribed this by hand, so there might be some typos.)

> mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne()
> mscorlib.dll!System.Threading.WaitHandle.WaitOne()
> WindowsBase.dll!System.Windows.Threading.DispatcherOperation.DispatcherOperationEvent.WaitOne()
> WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Wait()
> WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl()
> WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl()
> Microsoft.VisualStudio.DesignTools.Utility.dll!Microsoft.VisualStudio.DesignTools.Utility.AssemblyTypesPool.GetTypes()
> Microsoft.VisualStudio.DesignTools.Utility.dll!Microsoft.VisualStudio.DesignTools.Utility.AssemblyResolverHelper.LoadAssemblyAndDesignTimeMetadataAssemblies()
> Microsoft.VisualStudio.DesignTools.XamlLanguageService.dll!Microsoft.VisualStudio.DesignTools.Xaml.LanguageService.Metadata.Extensibility.Isolation.RemoteDesignAssemlyMetadataLoader.LoadDesignAssembly()


> Microsoft.VisualStudio.DesignTools.XamlLanguageService.dll!Microsoft.VisualStudio.DesignTools.XamlLanguageService.Metadata.ManagedXmlnsDefinitionMap.RegisterAssemblies()
> Microsoft.VisualStudio.DesignTools.XamlLanguageService.dll!Microsoft.VisualStudio.DesignTools.XamlLanguageService.Platform.Default.DefaultXmlnsDefinitionMap.DefaultXmlnsDefinitionMap()
> Microsoft.VisualStudio.DesignTools.XamlLanguageService.dll!Microsoft.VisualStudio.DesignTools.XamlLanguageService.Platform.Default.DefaultPlatformMetadata.CreateXmlnsDefinitionMap()
> Microsoft.VisualStudio.DesignTools.XamlLanguageService.dll!Microsoft.VisualStudio.DesignTools.XamlLanguageService.Metadata.ManagedTypeResolver.Reset()
> Microsoft.VisualStudio.DesignTools.XamlLanguageService.dll!Microsoft.VisualStudio.DesignTools.XamlLanguageService.Metadata.ManagedTypeResolver.ResetManagedMetadata()
> Microsoft.VisualStudio.DesignTools.XamlLanguageService.dll!Microsoft.VisualStudio.DesignTools.XamlLanguageService.Metadata.ManagedTypeResolver.RaiseTypesChanged()
> Microsoft.VisualStudio.DesignTools.XamlLanguageService.dll!Microsoft.VisualStudio.DesignTools.XamlLanguageService.Metadata.ManagedTypeResolverService.OnProjectServiceBuildCompleted()
> Microsoft.VisualStudio.DesignTools.DesignerHost.dll!Microsoft.VisualStudio.DesignTools.DesignerHost.HostServices.HostProjectService.UpdateSolution_Done()

## Discussion

Note: no Xamarin assemblies appear in the call stack. Based on that observation, this hang might be fully contained within Microsoft code.

That said, I'm not 100% certain that this necessarily rules out _any_ involvement of the XamarinVS extensions. It also seems possible (though admittedly unlikely) that there might be some way to modify the Xamarin.Forms metadata to avoid this problem.

## Steps followed to capture the call stack

(If any customers would like to attach back a complete textual version of the call stack, that would be perfect. Having the screenshot is OK, but having the full text in a `.txt` file attachment would be even better.)

1. Start a second instance (a "new window") of Visual Studio.

2. Close any open solutions in the new instance of VS.

3. Select "Debug -> Attach to Process".

4. Select the original hung instance of `devenv.exe` from the list of
"Available Processes".

5. Select "Debug -> Break All".

6. Make sure you have the "Debug Location" toolbar is enabled.

7. From the "Thread" drop-down menu in the "Debug Location" toolbar, select the
"Main Thread".

8. Open "Debug -> Windows -> Call Stack", select all the lines, copy them, and
paste them back into a text file attached on this bug report, or directly in a
comment on this bug report. If the Call Stack shows just "[External Code]",
then right-click "[External Code]" and select "Show External Code" from the
context menu before copying the information.

## Suspected "regression" status: breakage in VS 2015 that does not exist in VS 2013

VS 2013 uses Xamarin's custom Xamarin.Forms XAML IntelliSense extension, rather than Visual Studio's built-in IntelliSense.

## Steps to reproduce?

If any customer can provide a set of steps to reproduce this problem consistently (possibly depending on a specific small test case that you can attach), please do add a comment with that information. Thanks!
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-12 16:00:50 UTC
Here is a closely related upstream bug that was filed against Visual Studio 2015 RTM (including a test case that reproduces a problem 100% of the time):

Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-27 15:52:11 UTC
I am now resolving this as a duplicate of one of the non-public bugs that was tracking one particular way to reproduce the problem.

Cycle 5 Service Release 4 and higher (XamarinVS 3.11.893 and higher) have now reverted the XAML IntelliSense in VS 2015 to use the old Xamarin-written XAML IntelliSense plugin rather than VS 2015's built-in XAML IntelliSense.

This switch (to avoid VS 2015's built-in IntelliSense) has so far eliminated the hang for all the customers who have reported back on the problem.

If any customer sees a similar problem again on XamarinVS 3.118.893 or higher, please contact the support team via email [1] to let us know. Thanks.

[1] https://kb.xamarin.com/customer/portal/articles/1632104-how-do-i-contact-xamarin-for-support-

*** This bug has been marked as a duplicate of bug 32909 ***