Monday, August 21, 2006

VS2005 - Forms Designer exception: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for mo

Update : MS has a hotfix for this problem : Check out the following page: Kept having the following problem with the Windows Forms Designer in VS2005. Here is what the problem is: All my Forms that inherited from another base form that I had created would all of sudden stop displaying the designer. The error that I would get was: One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. Hide at System.Reflection.Module.GetTypesInternal(StackCrawlMark& stackMark)at System.Reflection.Assembly.GetTypes()at Microsoft.VisualStudio.Shell.Design.AssemblyObsoleteEventArgs..ctor(Assembly assembly)at Microsoft.VisualStudio.Design.VSDynamicTypeService.ReloadAssemblyIfChanged(String codeBase) . . . It was the most annoying error and I found that it would happen most often when I performed a rebuild on my solution. The one method that I found that always worked was to close down the solution, and go to the project folder and clean out the obj and bin folders. (Performing a clean from within the solution did not always work, but shutting down VS and then cleaning the files worked always.) Some bloggers have pointed to this problem being caused by an indexing service that is run in the background, which causes file locking and hence the error. To work around this do the following: Select the projects folder in Windows File Explorer. On the Properties Tab, click the Advanced button and disable the checkbox to allow the indexing of the folder and subdirectories and files. But this was not the case on my machine. So there may be more than one reason for this error. (But if you want there is a hot fix for this file locking due to indexing issue and its : VS.NET 2005 Hotfix 265517_ENU_i386 - you will have to contact MS tech support for it though). Another reason that this can be caused is if the UserControl or base class form is in another DLL and its version has changed between builds. (To work around this, you can set the AssemblyVersion in the AssemblyInfo.Cs file of the DLL.

No comments: