Bug in Finding Metadata Assemblies

As it turns out, we have a bug in finding metadata assemblies that will be in Visual Studio 2008 RTM.  I described how we find and load metadata assemblies in a previous post and the bug pertains to the situation where:

  • The main assembly is being loaded from the GAC
  • The project where the main assembly is being loaded is not referenced by the project
  • You have your main and metadata assemblies in a folder defined in the AssemblyFolders in the registry

The main line scenarios where this will be true is:

  • Loading metadata while populating the items in the Choose Toolbox Items (i.e. for ToolboxBrowsableAttribute)
  • Instantiating a control from the toolbox the first time in a project (the reference isn't made yet)

Workaround

In order to handle all of the situations (note that your customers may GAC your assemblies on you provided your assemblies are strong named) you need to provide 2 sets of design time assemblies (in your AssemblyFolder): 

  • MyAssembly.Design.dll and/or MyAssembly.VisualStudio.Design.dll
  • MyAssembly.dll.Design.dll and/or MyAssembly.dll.VisualStudio.Design.dll

Sorry for the inconvenience, at least there is a reasonable workaround.