Bug #55623 SetSite failed for package
Submitted: 29 Jul 2010 10:22 Modified: 2 Dec 2016 17:25
Reporter: Alessandro Calorì Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.3.6 OS:Windows (Windows 7 Ultimate x64)
Assigned to: Assigned Account CPU Architecture:Any
Tags: install, installation, registration, Visual Studio

[29 Jul 2010 10:22] Alessandro Calorì
Description:
I'm using Visual Studio 2010 Professional but the MySQL Connector/.NET integration seems not to work. The installation went through with no errors.

The IDE' log shows these rows:

Begin package load [MySQL Connector Net 6.3.3]
SetSite failed for package [MySQL Connector Net 6.3.3]
End package load [MySQL Connector Net 6.3.3]

The libraries seem to work just fine: I updated the project references to include the new version and my project compiles and runs just fine.

How to repeat:
- Install MySQL Connector/.NET 6.3.3
- Run Microsoft Visual Studio 2010
- Open menu ? > About Visual Studio

An error message should appear saying: "The package 'MySQL Connecotr Not 6.3.3' has not been loaded correctly".

Suggested fix:
No fix found yet.
[30 Jul 2010 18:27] MySQL Verification Team
Bug: http://bugs.mysql.com/bug.php?id=55654 marked as duplicate of this one.
[8 Sep 2010 13:33] Geraud Puechaldou
I got this exact error after a fresh install of my Windows 7 computer followed by a fresh install of Visual Studio.

I was able to reproduce this error.

1- Install OS
2- Install Office
3- SQL Express 2008
4- Studio 2010 Pro
5- Connector .Net 6.3.4
After al of this it worked.
6- Update Studio with KB982305 & Install Office Live Add-in 1.5
Then I got the error.

I went back in Studio 2010 under component I saw that there is 2 version of the component one the GAC and the other in the Folder, if I checked GAC then everything worked fine, if I checked all then Error, and if I checked only the one in install folder got the error also.

See attached picture, 

Hope it will help 

Kinds regards,

GPSnail
[8 Sep 2010 13:34] Geraud Puechaldou
Studio2010ComponantGAC

Attachment: studionetframeworkcomponent.jpg (image/jpeg, text), 142.15 KiB.

[10 Sep 2010 7:40] Alessandro Calorì
I updated the bug information: it affects also version 6.3.4 (it's not a beta anymore)!

I tried to configure Visual Studio as described by Geraud but it doesn't seem to help to me.
[10 Sep 2010 11:13] Geraud Puechaldou
Hello,

Others informations on my current installation :
- if MySql compact framework components are checked with the normal components I got the error
- if only MySql components are checked without CF then no error
If you need more détails on my installation tell me what you need I will provide

Geraud
[19 Oct 2010 20:23] Sho Ijiri
I got the same error.

My environment is as follows:
- Windows 7 Ultimate x64 (Japanese)
- Visual Studio 2010 Professional  (Japanese) with KB982305 
- Visual Studio 2008 Professional  (Japanese) with SP1 
- MySQL Connector/Net 6.3.5 GA
- AnkhSVN Add-In 2.1.8420.8
- Build Version Increment Add-In

the error appears only in VS2010. 
Unchecking compact framework components didn't help to me.
However I found out how to open about dialog without the error.

1) Start VS2010
2) Open View menu > Server Explorer
3) Right-click the Data Connections node in Server Explorer and click Add Connection.
4) In Add Connection Dialog Box, select "MySQL Database (MySQL Data Provider)" as data source. 
5) Type someting in Server name. As soon as you type 1 letter, suddenly the dialog box will disappear.
6) Click Help menu > About Visual Studio
7) About dialog will be shown without error and "MySQL Connector/Net 6.3.5" is shown in the list.

Despite this, MySQL Connector/Net 6.3.5 VS integration seems not to work correctly.
For example, I can't connect mysql server via Server Explorer.
When I restarted VS2010 and I didn't do this steps, I got error.
[19 Oct 2010 20:35] Geraud Puechaldou
Hello,

If you remove the mobile part of the MySql framework it should work all times.

BR

GPSnail
[19 Oct 2010 20:59] Alessandro Calorì
New version (6.3.5 GA) still has the same issues.

Geraud Puechaldou solution doesn't work for me either.
[20 Oct 2010 0:24] Sho Ijiri
Hello Geraud,
Thank you for your quick reply.

>If you remove the mobile part of the MySql framework it should work all times.
actually this didn't solve the problem.

Trying many ways, finally I got some ways to avoid this problem.

1) Uninstall all Add-ins or Integration Package(includes MySQL Connector/NET)
2) Uninstall and Reinstall Visual Studio 2010
3) Install MySQL Connector/NET 6.3.5
4) Delete files:
      C:\Users\(user name)\AppData\Roaming\Microsoft\VisualStudio\10.0\Design*.winprf
   Or Delete Directory:
      C:\Users\(user name)\AppData\Roaming\Microsoft\VisualStudio\10.0\
5) Start Visual Studio 2010 and open about dialog from help menu.

I don't know actually which step solved the problem, but i don't get
errors now. (I think step 4 solved the problem. )

There is another way to avoid this problem temporarily.
I tried also execute devenv.exe with rootSuffix option as follows:

devenv.exe /rootSuffix Exp

VS2010 with this option uses
 
C:\Users\(user name)\AppData\Roaming\Microsoft\VisualStudio\10.0Exp

and

\HKCU\Software\Microsoft\VisualStudio\10.0Exp

instead of normal dir or registory key.
[20 Oct 2010 8:52] Alessandro Calorì
Finally a solution!

Simply removing the directory C:\Users\(user name)\AppData\Roaming\Microsoft\VisualStudio\10.0 the package works. No uninstall was needed!

It is obvious that previous uninstall procedures left some stale file in that directory preventing MySQL integration tools to load correctly.

I'm lowering the severity since this seems like a good workaround. Thank you Sho Ijiri.
[23 Oct 2010 3:01] mlb prime
Problem still persists after removing the directory C:\Users\(user
name)\AppData\Roaming\Microsoft\VisualStudio\10.0

Here's what I did

1. Remove the direcory
2. Open VS2010
3. Open About dialog (works fine)
4. Close VS2010
5. Reopen VS2010
5. Reopen About dialog (problem reccurs)

In my case, simply deleting the file Design_????????.???.winprf under the same directory fixes the problem.  However, VS2010 recreates the file, which causes the reccurance of the problem.
[4 Nov 2010 16:15] Umit YILDIZ
A temporary solution to delete the relevant directory. When you turn off the IDE re-open the problem arises again. Then looking up again. Still need to patch going down.
[1 Dec 2010 21:16] Reggie Burnett
I believe that you guys are seeing a problem but I don't think the issue is with the product.  I've installed the product hundreds of times in VS2010 and never had this type of issue.  I'm saying that this is an issue with VS2010 when you say that if you delete some files that are not related to C/Net and it starts working.

If you guys get any more info on this, please reopen this bug report and let me know.
Thanks!
[29 Mar 2011 9:29] Bogdan Degtyariov
I was able to repeat the problem and found the place where the null-pointer exception occurs in MySql.VisualStudio.dll:

VsPkg.cs(lines 136-137):

            languageService = new MySqlLanguageService();
            languageService.SetSite(this);

The exception occurs because languageService.preferences == null.

Setting the bug status to Verified. 
Used versions 6.3.6 GA and 6.4.trunk
[29 Mar 2011 9:39] Bogdan Degtyariov
The constructor of MySqlLanguageService class does not initialize the private member populated by get/set:

private LanguagePreferences preferences;
[29 Mar 2011 10:37] Bogdan Degtyariov
public override LanguagePreferences GetLanguagePreferences()
        {
            if (preferences == null)
            {
                preferences = new LanguagePreferences(this.Site, <--- this is null
                    typeof(MySqlLanguageService).GUID, LanguageName);
                preferences.Init();
            }
            return preferences;
        }
[8 Apr 2011 9:30] Sebastien Rault
Thanks to Bogdan Degtyariov, I have successfully resolve (I hope) the bug.

I found this
http://www.visualstudiodev.com/visual-studio-extensibility/packagesetsite-throws-systemnul...

So I think the bug is related to version conflict as suggested by the last post:
"I had a similar problem and it was caused by using mismatched assemblies.The internals of the SetSite uses the service provider passed in to obtainthe 'Microsoft.Visual.Studio.Shell.Package'. If the assemblies mismatch due to version differences then null is returned from the service providers GetService method. This subsequently results in a NullReferenceException.
i.e. if you use Microsoft.VisualStudio.Shell.9.0 then you must use Microsoft.VisualStudio.Package.LanguageService.9.0"

If seems so to be a conflict between Microsoft.VisualStudio.Package.LanguageService.10.0 and Microsoft.VisualStudio.Shell, Version=2.0.0.0, which are 2 dll referenced in the project file (http://bazaar.launchpad.net/~mysql-clr-team/connectornet/trunk/view/head:/MySql.VisualStud...).

I paste my reference part of the csproj, which give me no crash in VStudio.
I have to do other changes only related to my dev platform (win7 x64) to find all specified files.

=== csproj sample ===
<ItemGroup>
    <Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <Reference Include="Microsoft.Data.ConnectionUI, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\Program Files (x86)\Microsoft Visual Studio 2010 SDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.CommandBars, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>True</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\Program Files (x86)\Microsoft Visual Studio 2010 SDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>True</SpecificVersion>
      <HintPath>c:\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Package.LanguageService, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
    <Reference Include="Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
    <Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <EmbedInteropTypes>False</EmbedInteropTypes>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <EmbedInteropTypes>False</EmbedInteropTypes>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\Program Files (x86)\Microsoft Visual Studio 2010 SDK\VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.TextManager.Interop.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\Program Files (x86)\Microsoft Visual Studio 2010 SDK\VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.TextManager.Interop.8.0.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.TextManager.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\Program Files (x86)\Microsoft Visual Studio 2010 SDK\VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.TextManager.Interop.9.0.dll</HintPath>
    </Reference>
    <Reference Include="MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" />
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Configuration.Install" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Web" />
    <Reference Include="System.Web.ApplicationServices" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
=== csproj sample ===

Hope this to definitively resolve this bug.
[15 Apr 2011 8:50] Bogdan Degtyariov
Hi Sebastien,

Thank you for proposing your solution for the problem.
Now I am waiting on the opinion from our lead NET developer.
[19 Apr 2011 3:38] Bugs System
I experience the same problem since I've installed SP1 for VS2010.

Are there any news about an available bug fix?
[19 Apr 2011 4:12] Bugs System
Okay, I was able to fix this by just reinstalling the Connector.
[25 Apr 2011 17:16] Julio Casal
This bug is a duplicate of bug #60723.
[26 Apr 2011 11:41] Richard Deeming
OK, so bug #60723 is closed without a fix - switching everything to VS2008 doesn't count! - and this bug is closed as a duplicate of bug #60723. So what's the fix?
[26 Apr 2011 14:02] Julio Casal
I'm sorry for that Richard. This bug is fixed in version 6.3.7 and will fix the integration with VS 2010. Just updated bug 60723 with this info too.
[26 Apr 2011 14:04] Richard Deeming
Thanks for the update. Any idea when 6.3.7 will be released? :)
[26 Apr 2011 16:15] Julio Casal
It should be available by the end of May although I can't provide an specific date.
[26 May 2011 20:47] Rich Gerrish
"4) Delete files:
      C:\Users\(user name)\AppData\Roaming\Microsoft\VisualStudio\10.0\Design*.winprf"

worked for me Win7 ultimate/VS2010Pro
[2 Dec 2016 17:25] Christine Cole
Posted by developer:
 
Duplicate of Bug #12394470. No separate changelog entry is required.
[2 Dec 2016 17:26] Christine Cole
Posted by developer:
 
Duplicate of Bug #12394470. No separate changelog entry is required.