2

We have been encountering more and more frequently the Visual Studio error of being unable to generate the designer file in a web project. This problem has been occurring for a few months now, in several of our ASP.NET projects.

The errors occur when saving a file or when building the project, and are variations of errors like this:

  • Generation of the designer file for [filename] failed: Error HRESULT E_FAIL has been returned from a call to a COM component.
  • Generation of the designer file for [filename] failed: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
  • Generation of the designer file for [filename] failed: An entry with the same key already exists.
  • Generation of the designer file for [filename] failed: Value cannot be null.

Sometimes, additional error messages are displayed for valid, previously-working code/markup; errors such as:

  • The name 'Eval' does not exist in the current context

This is with Visual Studio 2013 (Premium), with "Web Application Projects" type projects using the .NET 4.5 framework. Some of the projects were originally created in Visual Studio 2010 or Visual Studio 2012, but one of the projects was a new project created in Visual Studio 2013.

We have a few Visual Studio extensions installed, such as "Web Essentials 2013", but I have tried disabling all the installed Visual Studio extensions and the same designer file errors still occur. We do not have Resharper or CodeRush installed. We are also using a third-party components package (DevExpress) for ASP.NET. We are using IIS Express for the local development web server.

All available updates (including Update 1 for Visual Studio 2013) have been installed for Visual Studio, the operating system (Windows 8.1), .NET, Visual Studio extensions, and DevExpress.

I have searched StackOverflow and the web for this issue, and have found some suggestions but no solutions, and I have also seen that the issue has been reported to Microsoft several times, dating back some years.

Many indications are that the problem with generating designer files is caused by some invalid syntax (in an ASPX file), or multiple elements with the same ID in the same scope, or collisions in namespace or class names, etc. I have searched through our projects as best as I can for issues like this, but haven't found any.

I found the Redesigner project on Sourceforge (thanks very much to the author), and I tried using that to verify the designer files, but unfortunately it can't handle the DevExpress components (it reports that DevExpress elements are using invalid child tags when the tags are valid and correct for DevExpress).

I have also tried clearing the Visual Studio development cache on my workstation (that is, deleting everything from the folders "\Temp\IISExpress", "\Temp\Temporary ASP.NET Files", and "\Microsoft\WebsiteCache" folders in the %localappdata% folder, rebooting and restarting Visual Studio.

I also found a website that explained how to turn on additional logging for Visual Studio to help with tracking down designer file generation issues. For Visual Studio 2013, this requires adding a key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebApplicationProjects\Debug and then adding values under that key for "Enabled" (set to 1), "LogFieldGeneratorFailures" (set to 1), and "LogFile" (set to a path and filename that you have permission to write to).

When I added this key, Visual Studio 2013 did write to the debug log file, but it only included error messages similar to the error messages above plus a small stack trace plus the entire content of the ASPX file for which the designer file could not be generated (with no apparent indication of where in the ASPX page there might be an error or invalid syntax).

I think I have tried essentially all suggested approaches in this topic: How do you force Visual Studio to regenerate the .designer files for aspx/ascx files?

None of these have worked for me. The "Convert to Web Application" option for the ASPX file is not available for me in Visual Studio 2013 in these projects.

Does anyone have any suggestions for potential causes or fixes for this desinger file issue or for any other troubleshooting approaches?

Community
  • 1
  • 1
PhilipD
  • 419
  • 6
  • 13

4 Answers4

5

The latest that we have discovered with this issue is that it's related to the Source Control option in Visual Studio to "Get everything when a solution or project is opened".

Having this option UNCHECKED seems to have resolved the problems for our team so far (for the past few days).

There is also this issue posted at Microsoft Connect: http://connect.microsoft.com/VisualStudio/feedback/details/760443/visual-studio-2012-ide-loses-intellisense-and-reference-resolution

The comments at the link above suggest that the bug is caused by asynchronous retrieval of files from source control or the asynchronous solution load when Visual Studio is opened. The choices suggested for fixing the problem are to either turn off the asynchronous solution load or to disable the "get everything on open" option.

There are also suggestions that deleting the .suo (Solution User Options) file in the project directory resolves the problem, but this seems to be only temporary.

PhilipD
  • 419
  • 6
  • 13
  • I want to confirm - yes, removing this setting for two workstations has been solved this issue. Thank you very much! – VikciaR Jun 16 '14 at 10:57
2

The only solution that I've found to work is to delete the Visual Studio cache @ C:\Users\<>\AppData\Local\Microsoft\VisualStudio and then running Visual Studio with the /resetuserdata switch. It's a horrible solution that deletes all of your local settings, and resets Visual Studio.

(You can try exporting and importing your settings before and after the surgery.) Links (Delete the 2013 cache) http://blogs.msdn.com/b/willy-peter_schaub/archive/2010/09/15/if-you-have-problems-with-tfs-or-visual-studio-flush-the-user-cache-or-not.aspx

(Fixing the error in 2010, which is slightly different)http://rathodkrunal.blogspot.com/2011/11/visual-studio-2010-error-hresult-efail.html

It's also an open item on connect, if you want to bug MS into fixing it.

https://connect.microsoft.com/VisualStudio/feedback/details/799832/constant-call-to-com-component-fails#tabs

Mike Swaim
  • 21
  • 2
  • This did the trick for me in VS2013. My problem was that no matter what changed I made in the .aspx file the .designer.cs didn't update. Though it seems like /resetuserdata cleans the cache itself. – f2lollpll Mar 26 '14 at 10:19
  • Mike, thanks. This is a somewhat disruptive solution, but I tried it and it did work for me. This is essentially a Visual Studio "reset", and requires re-installing any extensions afterwards, and either setting up your preferences and environment again (or saving and restoring settings). Also, items like Visual Studio's recent list of projects are empty after this reset. – PhilipD Mar 26 '14 at 13:47
  • Unfortunately, 2 other developers in our group have tried this same workaround and it did NOT work for them. After the reset and a reboot, they immediately had designer file failures after opening the same VS2013 project again and editing an ASPX page. – PhilipD Apr 04 '14 at 12:43
0

Ran into a very similar issue assisting a colleague. The project had been converted from 2010 to 2013 and was working for most developers. To "resolve" this, we had him close the solution, then delete all of the source control files at the solution level, (vsssc). Once reopening the solution, all was fine.

Ron
  • 787
  • 9
  • 23
0

I've had this issue constantly in different dev environments for the last while. I managed to solve it in one case without using the cache clearing technique by launching component services->DCOM Config. When I did this I was prompted to register a missing key. (didn't quite catch it but something related to EventManagement). Clicked OK and lauched visual studio...hey presto...back in business. Hopefully this advice might catch a few cases out there.

Colm Ryan
  • 11
  • 3