Click to See Complete Forum and Search --> : Runtime Error when trying to load a form
irishman
October 21st, 2008, 01:57 PM
When I hit F5 in Visual Basic.NET 2003 to test the program, it loads just fine. From the main form, I have three buttons, each of which takes users to a different form. Two of the buttons work as intended. One of them has been working, but all of a sudden has given me this error message:
"An unhandled exception of type "System.InvalidProgramException' occurred in MyProgram.exe
Additional information: Common Lanaguage Runtime detected an invalid program."
It then highlights in the Windows Form Designer generated code:
InitializeComponent()
Does anyone know how I can fix this? I have no clue what the problem is and I'm a novice with regards to odd runtime errors.
TheCPUWizard
October 21st, 2008, 01:59 PM
Not nearly enough information....
Simply configure VS to break on exception, and look at the line of code that is faulting. Also be sure to pat attention to the exceptions message and inner exception propertied...
HanneSThEGreaT
October 22nd, 2008, 12:43 AM
Not nearly enough information....
Well, actually the Exception supplied, is all the info that is needed ;)
irishman, you may want to look at this MSDN reference :
http://msdn.microsoft.com/en-us/library/system.invalidprogramexception.aspx
And here's a Search on MSDN :
http://social.msdn.microsoft.com/Search/en-US/?query=Q312544&ac=8
I hope it helps!
TheCPUWizard
October 22nd, 2008, 07:32 AM
Well, actually the Exception supplied, is all the info that is needed ;
For VS-2003 (aka .Net 1.x) there are a few interesting situations...lets look at the msdn link you provided:
The exception that is thrown when a program contains invalid Microsoft intermediate language (MSIL) or metadata. Generally this indicates a bug in the compiler that generated the
The most important word here is generally...It does NOT always indicate a bus in the compiler per se....
There are also some user generated code situations that can induce this error. Therefore I stand by my original statement, that until we actually see a program that reproduces the error, there is insufficient information.
HanneSThEGreaT
October 22nd, 2008, 07:58 AM
Yeah well, I don't know everything as you seem to do, as I don't have 35 years experience as you - But I do know what an error means, and how to fix it, or how to find applicable info on an error. ;)
I also provided the MSDN search link, if you didn't notice, so let's see what that brings up, and hopefully the OP ( irishman ) will get closer to his solution.
brjames32
October 22nd, 2008, 08:12 AM
Irishman
I've had the same error in the past and for me (thankfully) all it took was a rebuild and it was sorted!
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.