Bug 40781 - Xamarin.iOS visual studio plugin fail to load after reinstallation of beta channel (coming from alpha channel)
Summary: Xamarin.iOS visual studio plugin fail to load after reinstallation of beta c...
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS (show other bugs)
Version: 4.1.0 (C7)
Hardware: PC Windows
: High normal
Target Milestone: 4.1.3 (C7SR2)
Assignee: Bugzilla
URL:
: 45894 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-04-29 18:22 UTC by softlion
Modified: 2016-10-28 13:20 UTC (History)
19 users (show)

See Also:
Tags: releasenote
Is this bug a regression?: Yes
Last known good build: C6SR4


Attachments

Description softlion 2016-04-29 18:22:13 UTC
Reproduce:
- Install Xamarin alpha channel
- Open VS 2015 (professional edition). Close VS.
- Install Xamarin beta channel
- Open Visual Studio 2015
- Open Tools / Options / Xamarin / iOS => pane failed
Can't find any workaround. Installing stable channel does work. Beta channel never worked again.

Content of ActivityLog.xml:

    <description>SetSite failed for package [XamarinIOSPackage][Object reference not set to an instance of an object.]:{   at Xamarin.VisualStudio.IOS.XamarinIOSPackage.Initialize() in C:\Users\builder\data\lanes\2925\fb9e9f3c\source\XamarinVS\src\Core\VisualStudio.IOS\XamarinIOSPackage.cs:line 300&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)}</description>
    <guid>{77875FA9-01E7-4FEA-8E77-DFE942355CA1}</guid>
    <hr>80004003 - E_POINTER</hr>
    <errorinfo>Object reference not set to an instance of an object.</errorinfo>
Comment 1 Daniel R. Regner 2016-05-01 02:32:20 UTC
I hit this same error and also couldn't get the VS Xamarin.iOS integration add-in to initialize successfully again in the beta channel (4.1.0.462), even after attempting a complete uninstallation/reinstallation.

When loading the add-in, I see two MEF composition issues show up immediately beforehand if relevant:

	The ComposablePartDefinition 'Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger' has been rejected. The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced multiple composition errors, with 2 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information.

1) No exports were found that match the constraint: 
	ContractName	Merq.IAsyncManager
	RequiredTypeIdentity	Merq.IAsyncManager

Resulting in: Cannot set import 'Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger..ctor (Parameter="asyncManager", ContractName="Merq.IAsyncManager")' on part 'Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger'.
Element: Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger..ctor (Parameter="asyncManager", ContractName="Merq.IAsyncManager") -->  Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger -->  ComponentCatalog (Types='Clide.ClideSettings, Clide.ErrorsManager, ...').

2) No exports were found that match the constraint: 
	ContractName	Xamarin.VisualStudio.IOS.IMacServer
	RequiredTypeIdentity	Xamarin.VisualStudio.IOS.IMacServer

Resulting in: Cannot set import 'Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger..ctor (Parameter="macServer", ContractName="Xamarin.VisualStudio.IOS.IMacServer")' on part 'Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger'.
Element: Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger..ctor (Parameter="macServer", ContractName="Xamarin.VisualStudio.IOS.IMacServer") -->  Xamarin.VisualStudio.IOS.Messaging.ConnectIconChanger -->  ComponentCatalog (Types='Clide.ClideSettings, Clide.ErrorsManager, ...').
Comment 2 Danish Akhtar 2016-05-05 08:46:26 UTC
I have tried to reproduce this issue but not able to reproduce it. I have followed steps mentioned below to reproduce this issue:

1. Install Alpha XVS 4.2.0.21 on system.
2. Open VS 2015 Professional.
3. Open Tools / Options / Xamarin / iOS/Select Beta Channel and Update it to Beta.
4. Beta install successfully.
5. Close VS then Reopen it.
6. Open Tools / Options / Xamarin / iOS/Select Alpha Channel and Update it to Alpha.
7. Repeat step 3.

Observed that it installs Beta successfully.

Please let me If I missed anything here to reproduce this issue?

Thanks!
Comment 3 Daniel R. Regner 2016-05-08 02:25:03 UTC
After using the stable channel for almost a week, I tried again to switch to the beta channel and this time it installed successfully on the first attempt, so I can no longer reproduce this issue.  I don't know what changed to get it working now, but it's working nonetheless.
Comment 4 softlion 2016-05-08 09:48:32 UTC
+1 Daniel. Closing the issue.
Comment 5 steve goodman 2016-05-08 21:20:35 UTC
I've reproduced the issue.

Steps:
- Install xamarin from visual studio installer
- Switch to the beta release (4.1.0.462 C7), and upgrade
- Go to create a new project, note there are now 2 almost identical project types "Blank App (Xamarin.Forms.Portable)" and "Blank Xaml Apps (Xamarin.Forms.Portable)" - it doesn't matter which one you choose.
- This then generates the following error message 

---------------------------
Microsoft Visual Studio
---------------------------
The 'XamarinIOSPackage' package did not load correctly.

The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\Demo\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'.

Restarting Visual Studio could help resolve this issue.

Continue to show this error message?
---------------------------
Yes   No   
---------------------------

- Press yes, I get the following error message:
---------------------------
Microsoft Visual Studio
---------------------------
A problem was encountered creating the sub project 'ClockDemo.iOS'.  The project file 'C:\Users\Demo\AppData\Local\Temp\imcgbq3i.of1\Temp\ClockDemo.iOS.csproj' cannot be opened.

There is a missing project subtype.
Subtype: '{FEACFBD2-3405-455C-9665-78FE426C6842}' is unsupported by this installation.
---------------------------
OK   
---------------------------

I'm not sure why it would be opening the project file 'C:\Users\Demo\AppData\Local\Temp\imcgbq3i.of1\Temp\ClockDemo.iOS.csproj' as the project is not meant to be in this folder.

Looking in 'C:\Users\Demo\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml' I have the following:

<entry>
    <record>786</record>
    <time>2016/05/08 20:38:51.908</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [XamarinIOSPackage][Object reference not set to an instance of an object.]:{   at Xamarin.VisualStudio.IOS.XamarinIOSPackage.Initialize() in C:\Users\builder\data\lanes\2925\fb9e9f3c\source\XamarinVS\src\Core\VisualStudio.IOS\XamarinIOSPackage.cs:line 300&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)}</description>
    <guid>{77875FA9-01E7-4FEA-8E77-DFE942355CA1}</guid>
    <hr>80004003 - E_POINTER</hr>
    <errorinfo>Object reference not set to an instance of an object.</errorinfo>
  </entry>
  <entry>
    <record>787</record>
    <time>2016/05/08 20:38:51.924</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>End package load [XamarinIOSPackage]</description>
    <guid>{77875FA9-01E7-4FEA-8E77-DFE942355CA1}</guid>
    <hr>80004003 - E_POINTER</hr>
    <errorinfo>Object reference not set to an instance of an object.</errorinfo>
  </entry>


Also if I attempt to access the IOS settings in Tools->Options->Xamarin->ios settings - I get the same error message.

If I revert back to the stable build, this all works as expected.

Happy to provide more information if required.
Comment 6 softlion 2016-05-09 17:09:04 UTC
I reopen it, in fact it is stull happening.
Comment 7 Kenneth 2016-05-12 09:03:25 UTC
Think I have the same problem switching from stable to alpha. Same error message, log entries:

  <entry>
    <record>738</record>
    <time>2016/05/12 08:53:27.684</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [XamarinAndroidPackage][Object reference not set to an instance of an object.]:{   at Xamarin.VisualStudio.Android.XamarinAndroidPackage.Initialize() in C:\Users\builder\data\lanes\3212\a532c82b\source\XamarinVS\src\Core\VisualStudio.Android\XamarinAndroidPackage.cs:line 126&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)}</description>
    <guid>{296E6A4E-2BD5-44B7-A96D-8EE3D9CDA2F6}</guid>
    <hr>80004003 - E_POINTER</hr>
    <errorinfo>Object reference not set to an instance of an object.</errorinfo>
  </entry>
  <entry>
    <record>739</record>
    <time>2016/05/12 08:53:28.703</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>End package load [XamarinAndroidPackage]</description>
    <guid>{296E6A4E-2BD5-44B7-A96D-8EE3D9CDA2F6}</guid>
    <hr>80004003 - E_POINTER</hr>
    <errorinfo>Object reference not set to an instance of an object.</errorinfo>
  </entry>

  <entry>
    <record>672</record>
    <time>2016/05/12 08:49:59.129</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [XamarinIOSPackage][Object reference not set to an instance of an object.]:{   at Xamarin.VisualStudio.IOS.XamarinIOSPackage.Initialize() in C:\Users\builder\data\lanes\3212\a532c82b\source\XamarinVS\src\Core\VisualStudio.IOS\XamarinIOSPackage.cs:line 300&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)}</description>
    <guid>{77875FA9-01E7-4FEA-8E77-DFE942355CA1}</guid>
    <hr>80004003 - E_POINTER</hr>
    <errorinfo>Object reference not set to an instance of an object.</errorinfo>
  </entry>
  <entry>
    <record>673</record>
    <time>2016/05/12 08:49:59.136</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>End package load [XamarinIOSPackage]</description>
    <guid>{77875FA9-01E7-4FEA-8E77-DFE942355CA1}</guid>
    <hr>80004003 - E_POINTER</hr>
    <errorinfo>Object reference not set to an instance of an object.</errorinfo>
  </entry>
Comment 8 steve goodman 2016-05-20 08:00:21 UTC
This appears to be fixed in Cycle 7 - RC2.

I can now create ios projects from within Visual Studio again - Thank you.
Comment 9 Jon Goldberger [MSFT] 2016-06-02 21:41:20 UTC
I have a customer hitting this and I was able to hit this issue too with their test project. I found that doing what is in this SO post resolved the issue on my end:
http://stackoverflow.com/a/31918711/2913599

In a nutshell:
>1. Close all instances of Visual Studio
>2. Delete everything in this folder:
>C:\Users\<yourusersname>\AppData\Local\Microsoft\VisualStudio\[12.0 | 14.0]\ComponentModelCache
>3. Restart Visual Studio

in the path, use 12.0 for VS 2013 and 14.0 for VS 2015.
Comment 11 Jon Goldberger [MSFT] 2016-06-03 17:38:09 UTC
Customer mentioned in comment 9 confirmed that the workaround worked on their end as well.
Comment 12 Daniel Cazzulino 2016-06-21 17:15:38 UTC
This issue may happen sometimes when VS fails to refresh the MEF component cache. If that's the case (i.e. as in comment 9), this VS extension may help: https://visualstudiogallery.msdn.microsoft.com/22b94661-70c7-4a93-9ca3-8b6dd45f47cd

Do we know if this only happens on VS2015, or also on 2012/13?
Comment 13 Jon Goldberger [MSFT] 2016-06-21 20:34:45 UTC
Using the steps in comment 1, I was not able to reproduce this issue in VS 2013. I no longer have access to the project noted in comment 9 to test with that project. 

However the versions have changed in the Stable and Beta channels since then, so testing today I installed the current Alpha and then opened and closed VS 2013, then installed the current Stable (was Beta when this bug was filed), opened VS 2013 and I was able to open the Xamarin iOS settings page in Options, IOW issue did _not_ occur in this test with VS 2013.
Comment 15 William Lahti 2016-07-08 15:29:07 UTC
As part of troubleshooting an issue with Visual Studio Tools for Unity I uninstalled Xamarin (I was on the latest available stable build).  This fixed the original issue. I contacted the VSTU team and Jb Evain was able to provide a preview build to fix the incompatibility between the two, so I installed VSTU using the MSI he provided and then used the VS 2015 installer to modify my installation to reinstall Xamarin. This gave me the following Xamarin versions:

Xamarin 4.1.0.530
Xamarin.Android 6.1.0.71
Xamarin.iOS 9.8.0.323

When relaunched, VS gave me the message described above that the Xamarin.iOS component failed to load. ActivityLog.xml showed the same error as described above, and the clearing of the MEF cache fixed the issue. So it seems you can still hit this issue on stable if the conditions are right.
Comment 16 Daniel Cazzulino 2016-08-03 20:24:07 UTC
I'm going to resolve this as external, we should probably documented as a known issue, and point users to this extension provided by a MS employee that fixes this issue with a simple command: https://visualstudiogallery.msdn.microsoft.com/22b94661-70c7-4a93-9ca3-8b6dd45f47cd

We might evaluate incorporating that functionality in our extension itself, but I think it pollutes the IDE with something that is hardly XVS related or exclusive.
Comment 18 Guilherme Morais 2016-08-13 22:18:24 UTC
I´m using the version (4.1.2.18) and happend too. I tried comment 9 and everthing workout nice. Now I just installed the plugin on comment 16.

Thanks.
Comment 19 Daniel Cazzulino 2016-08-25 17:19:32 UTC
Some additional information on why this happens and why there's only so much we can do about it: https://gitter.im/Microsoft/extendvs?at=57be2331c976227a1c4c975b

Hopefully it will get better in dev15 timeframe.
Comment 20 Arthur 2016-09-08 11:32:10 UTC
Had similar issue. Solved it by clearing the component cache and then restarting VS.

To clear component cache: Delete everything from 
%localappdata%\Microsoft\VisualStudio\14.0\ComponentModelCache

The component cache will be regenerated upon starting VS.
Comment 21 Daniel Cazzulino 2016-10-01 19:22:22 UTC
Hi there!
 
I've put together a build on top of current stable (4.2.0.695) that contains a proper fix for this issue: http://xvs.xamarin.com/patcheddrops/Xamarin.VisualStudio_4.2.0.698.msi

It will also be included in all future releases.

Please do reopen if you see this happen again in the future.

Thanks for reporting the issue!
Comment 22 Daniel Cazzulino 2016-10-25 16:41:40 UTC
*** Bug 45894 has been marked as a duplicate of this bug. ***
Comment 26 James Montemagno [MSFT] 2016-10-28 13:20:51 UTC
Current config: https://gist.github.com/jamesmontemagno/f3d27e28514307e7c2a26120865ed4e6

Note You need to log in before you can comment on or make changes to this bug.