Click here to Skip to main content
Click here to Skip to main content

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

, 26 May 2003 CPOL
Rate this:
Please Sign up or sign in to vote.
Shows how to find the exception that kills the designer
<!-- Article image -->

<!-- <!-- Article image -->

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)

Share

About the Author

Chris Richner
Software Developer (Senior) Zeit AG
Switzerland Switzerland
Biography
  • 1996 - 1998 PC Board PPL, HTML, DHTML, Javascript and ASP
  • 1999 - 2001 coding Centura against Sql Database (SqlBase,MSSQL,Oracle)
  • 2002 - 2004 C# Windows Forms
  • 2005 - 2006 C# ASP.NET, Windows Forms
  • 2006 - 2009 C#, WCF, WF, WPF
  • 2010 - 2012 C#, Dynamics CRM, Sharepoint, Silverlight
  • 2013 - 2013 C#, WCF DS (OData), WF, WPF
  • 2014 - now C#, Azure PaaS, Identity, OWIN, OData, Web Api
Interests
  • family & friends
  • chilaxing ,)
  • coding
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
GeneralNice tip, slight typo PinmemberRichard Deeming30-May-03 8:02 
GeneralRe: Nice tip, slight typo PinmemberJerry Maguire30-May-03 8:52 
GeneralThanks!! Pinmemberrahtrow29-May-03 3:44 
GeneralRe: Thanks!! PinmemberJerry Maguire29-May-03 9:24 
GeneralAnother way route to debugging devenv PinmemberLee Alexander29-May-03 0:03 
GeneralRe: Another way route to debugging devenv PinmemberJerry Maguire29-May-03 9:26 
GeneralRe: Another way route to debugging devenv PinmemberLee Alexander29-May-03 23:18 
GeneralRe: Another way route to debugging devenv PinmemberPhallGuy3-Jun-03 11:52 
GeneralVS.NET dumps stack traces in outputdebugstring Pinmembernidhogg27-May-03 23:01 
GeneralRe: VS.NET dumps stack traces in outputdebugstring PinmemberJerry Maguire28-May-03 1:01 

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.

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