Click here to Skip to main content
Licence CPOL
First Posted 26 May 2003
Views 69,022
Bookmarked 24 times

How to solve "The format of the file 'devenv.exe' is invalid" blank white page exception at design time

By | 26 May 2003 | Article
Shows how to find the exception that kills the designer

Introduction

Often if you work with inheritance with System.Windows.Forms or use third party stuff (preferred where you do not have the source) and hit Shift+F7 (View Designer), a blank white page is the only thing the designer is able to show. Normally you're confused, don't know where to start searching for this unexpected feature of VS.NET Designer. Maybe it could be the last lines of code you added today, or it could be code that nobody remembers, 'cause it was written last month from a external worker. What to do know? You should check in your code running in a few hours ?

Background

It's my job to write the UI front end library for the company i work today. There are 5 team members, which have to use my code. Every time the designer shows a white blank page, my name is called and i have to (try) fix it as fast as possible, not nice if you don't where to search the bug.

Solution Configuration

Visual Studio supports different Solution Configurations (sc), debug and release are the default ones. 'Cause we're able to add/delete this sc, we're able to add a new sc which supports design time debugging. If you're able to debug the design time, you're able to find the exception that killed the designer, you remember, blank white page.

  • Right click your solution and choose the Configuration Manager... context menu item.
  • In the "Configuration Manager" choose <New>.
  • Specify a name for your new solution configuration.
  • Hit Ok twice, the created sc is now selected.
  • Right click your project and choose "Properties" context menu item
  • The well known project property pages are now open, select Configuration Properties\Debugging
  • Switch Debug Mode to Program.
  • Let Start Application point to your devenv.exe file. See also

screenshots are available here (animated gif which opens in new window).

Exceptions

Now hit Ctrl + Alt + E, or choose Exceptions under main menu Debug\Exceptions. Because we don't know exactly which exception type we're trying to find, we best choose Break into debugger for the Common Language Runtime Exceptions. After playing around with the white blank page problem I know that System.BadImageFormatException is thrown.

Bust it

The good news is that you're now ready to bust those tricky exceptions which kicks our designer. The bad news is that the designer does not work proper cause there are exceptions in our code. We did something, that is not valid in design time, but will executed there. Or there is another exception of certain kind, also not valid for design time.

  • Hit F5 to start debugging, as you expected Visual Studio starts another Visual Studio instance where you will
  • Open the same solution you just prepared for design time debugging.
  • View the form in design mode that normally cause the designer to fall.
  • Behind your current Visual Studio should appear the well known exception dialog, hit Break and you see the code thrown it.
  • Repeat this steps until you're code is exception free (illusion), but sure till the designer work proper.

   

The demo application gives you a good sample, if you try to load form2 in designer, he crashes. Please make sure that the path to the devenv.exe reflects your current installation, otherwise the debug mode will not work proper.

Conclusions

  • I hope with this knowledge you could solve your design time problems, for my own it does.

History

  • 27.05.2003 final release

Have fun with it...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Chris Richner

Architect

Switzerland Switzerland

Member

Follow on Twitter Follow on Twitter
Web
 
Biography
  • 1996 - 1998 PC Board PPL, HTML, DHTML, Javascript and ASP
  • 1999 - 2001 coding Centura against Sql Database (Centura,MSSQL,Oracle)
  • 2002 - 2004 C# Windows Forms
  • 2005 - 2006 C# ASP.NET, Windows Forms
  • 2006 - 2009 C#, WCF, WF, WPF
  • 2010 - now C#, Dynamics CRM, Sharepoint, Silverlight
Interests
  • basically coding
  • music
  • chilaxing ,)


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralNice tip, slight typo PinmemberRichard Deeming7:02 30 May '03  
GeneralRe: Nice tip, slight typo PinmemberJerry Maguire7:52 30 May '03  
GeneralThanks!! Pinmemberrahtrow2:44 29 May '03  
GeneralRe: Thanks!! PinmemberJerry Maguire8:24 29 May '03  
GeneralAnother way route to debugging devenv PinmemberLee Alexander23:03 28 May '03  
GeneralRe: Another way route to debugging devenv PinmemberJerry Maguire8:26 29 May '03  
GeneralRe: Another way route to debugging devenv PinmemberLee Alexander22:18 29 May '03  
GeneralRe: Another way route to debugging devenv PinmemberPhallGuy10:52 3 Jun '03  
GeneralVS.NET dumps stack traces in outputdebugstring Pinmembernidhogg22:01 27 May '03  
GeneralRe: VS.NET dumps stack traces in outputdebugstring PinmemberJerry Maguire0:01 28 May '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 27 May 2003
Article Copyright 2003 by Chris Richner
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid