Pierpaolo
Pierpaolo

Reputation: 141

Visual Studio 2005 - can not open form on designer

My team developed a GUI application on Visual Studio 2005, managed C++. Since some deliveries it is not possible to open the form in the designer, even if the source code and the project settings have not been changed. The designer reports this error:

Exception of type 'System.OutOfMemoryException' was thrown.

at Microsoft.VisualStudio.Design.VSDynamicTypeService.ShadowCopyAssembly(String fileName) at Microsoft.VisualStudio.Design.VSDynamicTypeService.CreateDynamicAssembly(String codeBase) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly() at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description) ...

We successfully recompiled the project but we still encounter this problem. Any idea?

Upvotes: 0

Views: 8192

Answers (4)

msulis
msulis

Reputation: 555

I've run into the same issue intermittently when working with a large multi-project solution, or a project with an exceedingly large and complicated windows form.

I was able to solve the problem by enabling Visual Studio to use more than 2GB of memory. Here's the process...

(note: this assumes XP and Visual Studio 2005 - Vista and/or VS2008 will require slight changes)

Edit Boot.ini

Right-click My Computer, properties, Advanced tab. Under Startup and Recovery click Settings. Click the Edit button, and add the /3GB switch to the end of the [operating systems] line:

multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect /3GB

Make Visual Studio "Large Address Aware"

Run a Visual Studio Command Prompt, and change to the IDE directory:

cd %ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE

Use the microsoft tool editbin to modify devenv.exe:

editbin /LARGEADDRESSAWARE devenv.exe

Now reboot, and you're done!

Upvotes: 0

Jon Limjap
Jon Limjap

Reputation: 95432

I suspect that you have a Design Mode error where an infinite loop (or recursive control creation) occurs on the concerned Form.

One thing that helped me in these kinds of error on Windows Forms would be the following:

  • Open your Visual Studio 2005 solution for your GUI application. Don't open your form yet
  • Open another instance of Visual Studio 2005
  • In the second instance, Attach (Debug -> Attach to Process) the first instance of devenv.exe to the debugger. Make sure exceptions (Debug -> Exceptions) have all exceptions checkboxes under "Thrown" checked.
  • Now go to your first VS2005 instance and open the form. The second VS2005 instance will stop at the line where the error occurs.

Upvotes: 1

Sijin
Sijin

Reputation: 4550

This is how I used to debug these issues, Start a second instance of visual studio, load your project and attach to the first instance which also has the project loaded. Now set a breakpoint in the constructor and Page Load events and also any custom paint events that you may have in the form in the second instance and try to open the designer in the first instance, the breakpoints should get hit and you should be able to see what's going on.

Upvotes: 1

Mac
Mac

Reputation: 8339

This is a long shot, but try closing and opening the designer several times in a row. I have had the same kinds of problems with the C# Windows Forms designer (VS2005) : the form usually ended up opening correctly (after 5 tries, quite consistently).

Upvotes: 0

Related Questions