Bug 35952 - Forms 2.0.0.6482 - Cannot Load Solution in Visual Studio
Summary: Forms 2.0.0.6482 - Cannot Load Solution in Visual Studio
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-11-17 15:57 UTC by Kyle Masters
Modified: 2016-12-24 04:50 UTC (History)
11 users (show)

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

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:
Status:
RESOLVED FIXED

Description Kyle Masters 2015-11-17 15:57:27 UTC
An existing Xamarin Forms project cannot be loaded after upgrading to Xamarin Forms 2.0.0.6482.  Reference forum post: https://forums.xamarin.com/discussion/55944/can-no-longer-load-xamarin-forms-solution-in-vs-2015

-- Symptoms
After performing an upgrade, opening a solution in Visual Studio causes the IDE to hang, with a solution status of "Initializing".

-- Workaround
Remove the Android project manually from the solution file.

-- Exception:
The Xamarin IDE log is filled with the following exception, where <PCL Name> is the name of your PCL:
Xamarin.VisualStudio.UnhandledExceptionsManager Error: 0 : [2015-11-17 14:01:43.9885] Unhandled exception.
System.IO.FileNotFoundException: Could not load assembly '<PCL Name>, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: '<PCL Name>.dll'
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(String fullName)
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.GetAssembly(String fileName)
   at Xamarin.Android.Tasks.GetAdditionalResourcesFromAssemblies.<Execute>c__AnonStorey2.<>m__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

-- Versioning
Microsoft Visual Studio Enterprise 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA357
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2015   00322-80000-00000-AA357
Microsoft LightSwitch for Visual Studio 2015

Visual Basic 2015   00322-80000-00000-AA357
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA357
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA357
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-80000-00000-AA357
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.20626.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

JetBrains ReSharper Ultimate 2015.2   Build 103.0.20150818.200216
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2015 JetBrains, Inc.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Code Digger   0.9
Microsoft Code Digger

Microsoft.Pex.VisualStudio   1.0
Pex

NuGet Package Manager   3.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2015 ENU   14.0.23025
Microsoft Office Developer Tools for Visual Studio 2015 ENU

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.50616.0
Microsoft SQL Server Data Tools

Visual Studio Tools for Universal Windows Apps   14.0.23309.00 d14oob
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Web Essentials 2015   0.5.197
Adds many useful features to Visual Studio for web developers.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   4.0.0.1689 (f860fe4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.0.0.34 (3efa14c)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   9.2.1.51 (3c0ec35)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Rui Marinho 2015-11-18 09:17:17 UTC
Can you try clean the .vs hidden folder on your sln to see if it helps?
Comment 2 Kyle Masters 2015-11-18 10:22:12 UTC
With cleaning the .vs folder, here are my results.  I was able to get it installed 

Old XF:  1.5.1.6471

1.  Close SLN and delete .vs folder.
2.  Open SLN, launch Package Manager
3.  Update PCL, Android, iOS, and WinPhone to XF 2.0.0.6482.  NuGet logs indicate success.
4.  Close/Reopen SLN.
5.  SLN loads successfully. (In original case, SLN would not load)
6.  Rebuild PCL - Recieve file locked.
Unable to copy file "D:\Repositories\Mobile\packages\Xamarin.Forms.2.0.0.6482\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll" to "bin\Debug\Xamarin.Forms.Core.dll". The process cannot access the file 'bin\Debug\Xamarin.Forms.Core.dll' because it is being used by another process.		

7.  Close SLN.
8.  Clear hidden .vs folder.
9.  Rebuild PCL - Success.
10. Rebuild Natives - Success

New XF - 2.0.0.6482

-- Exceptions Monitored during process


System.IO.FileNotFoundException: Could not load assembly 'Carbase.ControlPanel.App, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Carbase.ControlPanel.App.dll'
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(String fullName)
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.GetAssembly(String fileName)
   at Xamarin.Android.Tasks.GetAdditionalResourcesFromAssemblies.<Execute>c__AnonStorey2.<>m__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
Xamarin.VisualStudio.Forms.Intellisense.ProjectTypeResolver Error: 0 : [2015-11-18 09:15:28.4722] An error occurred searching types for the given assembly
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.MetadataReader.IMetadataTables'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{D8F579AB-402D-4B8E-82D9-5D63B1065C68}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at Microsoft.MetadataReader.MetadataOnlyModule.RowCount(MetadataTable metadataTableIndex)
   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkModule.get_SimpleTypes()
   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkFactory.CreateSimpleType(MetadataOnlyModule scope, Token tokenTypeDef)
   at Microsoft.MetadataReader.MetadataOnlyModule.ResolveTypeTokenInternal(Token token, GenericContext context)
   at Microsoft.MetadataReader.MetadataOnlyModule.<GetTypeList>d__108.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at Microsoft.MetadataReader.MetadataOnlyModule.GetTypes()
   at Microsoft.MetadataReader.MetadataOnlyAssembly.GetTypes()
   at Xamarin.VisualStudio.Forms.Intellisense.ProjectTypeResolver.<SearchTypesAsync>b__33() in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\Features\VisualStudio.Forms.Intellisense\ProjectTypeResolver.cs:line 167
Xamarin.VisualStudio.Forms.Intellisense.ProjectTypeResolver Error: 0 : [2015-11-18 09:15:29.0742] An error occurred searching types for the given assembly
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.MetadataReader.IMetadataTables'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{D8F579AB-402D-4B8E-82D9-5D63B1065C68}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at Microsoft.MetadataReader.MetadataOnlyModule.RowCount(MetadataTable metadataTableIndex)
   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkModule.get_SimpleTypes()
   at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkFactory.CreateSimpleType(MetadataOnlyModule scope, Token tokenTypeDef)
   at Microsoft.MetadataReader.MetadataOnlyModule.ResolveTypeTokenInternal(Token token, GenericContext context)
   at Microsoft.MetadataReader.MetadataOnlyModule.<GetTypeList>d__108.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at Microsoft.MetadataReader.MetadataOnlyModule.GetTypes()
   at Microsoft.MetadataReader.MetadataOnlyAssembly.GetTypes()
   at Xamarin.VisualStudio.Forms.Intellisense.ProjectTypeResolver.<SearchTypesAsync>b__33() in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\Features\VisualStudio.Forms.Intellisense\ProjectTypeResolver.cs:line 167
Comment 3 Rui Marinho 2015-11-18 11:09:27 UTC
You can ignore that info. 

The fix for the problem you were having is removing the .vs folder
Comment 4 Kyle Masters 2015-11-18 12:29:52 UTC
Alas, now every time Visual Studio is closed, the solution locks up/won't open until I manually delete the .vs folder.

Not to sound rude, but that's not a resolution, that's a bug.
Comment 5 Rui Marinho 2015-11-18 13:37:12 UTC
That shouldn't be necessary, if that's happening everytime something is not right. 

Does this happen with all projects , even a new one?
Comment 6 Paul DiPietro [MSFT] 2015-11-18 16:53:20 UTC
To those of you who are having trouble, it would be much appreciated if you can upload any kind of reproduction project in order to help investigate the issue. Logs, system information, and so on are all equally helpful. We're keeping eye on this and any reports that come in as there is clearly something going on somewhere.
Comment 8 Kyle Masters 2015-11-23 09:34:21 UTC
It may not be helpful, but it seems I'm sporadically able to repro after changing the build target on Android (i.e. Debug to Release), as well as after updating NuGet, as Chris van Wyk said.
Comment 9 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-23 20:29:39 UTC
The precise symptoms where "GetAdditionalResourcesFromAssemblies" shows up in the _IDE logs_ is potentially unique to this bug.

That said, my guess is that the underlying issue is the same as for Bug 36185. The XamarinVS team has been able to reproduce Bug 36185 locally and they are accordingly investigating the issue for a fix as soon as possible (Bug 36185, Comment 3).

I will hold off on marking this bug (Bug 35952) as a duplicate until a candidate fix for Bug 36185 is available. We can then have Kyle test that the candidate build does resolve the problem for him in his particular environment.
Comment 10 vga 2016-12-24 04:50:25 UTC
The XVS and Android teams have been fixing several bugs related to "GetAdditionalResourcesFromAssemblies" and other tasks the caused VS to hang or be unstable.

By reading through the comments it looks to me like this should be fixed now.

Kyle, can you please let us know if you can still repro this? And re-open if you still see this? Thanks.

I'm resolving as fixed, so we get QA verification too.