.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Exception at program startup

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :.NET Framework


I was working on a C# application nice and easy and then I suddenly ran into the following problem:

Compile -> Run -> Exception thrown even before the app. gets into the Main() function.

It throws a TypeInitializationException.

In the InnerException field I find the following error:

Requested value Drawing not found (I translated this from a Dutch error message).

So what happened and how can I fix this?

P.S. I can give more details if necessary.


View Complete Post

More Related Resource Links

Program Exception On Exit

I have written a C# WinForms program that is to run as a scheduled task,  does some file processing and then ends with an FTP session using the scripting version of WS FTP 12.  The program runs fine and completes all tasks including the FTP.  However, when the program terminates, I receive the following .NET Runtime 2.0 Error:   EventType clr20r3, P1 fireeventxfer.exe, P2, P3 4c7fb5ce, P4 system.windows.forms, P5, P6 4889dee7, P7 14d2, P8 23, P9 system.objectdisposedexception, P10 NIL.   I launch the FTP program using Process.Start(); I have a Process.WaitForExit(); I capture the Process.ExitCode which is always 0; and I Process.Close() call.  I have all of this within a try...catch block, and have never had it throw an error.  I put in a delay for the program to wait 60 seconds after the FTP process exited to make sure it was truly finished, and all that did was delay the error.   I don't believe I have an unhandled exception in the code.  I have gone through the entire program step-by-step, and I have a trace file that captures virtually the entire program execution for almost every line of code.  If I comment out the FTP code, the error does not occur.  The error never occurs until the program exits.  I have an interactive mode that I run the program in that has buttons to start/stop t

Security exception in custom program


I have a custom ASP.NET application which is hosted in the SharePoint _layouts directory.  The code uses the object model to do certain actions on a SharePoint list.  I'm receiving the following error when trying to perform those actions in the code:

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Access denied.

Source Error:

[No relevant source lines]

Source File: c:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\_layouts_ams\17ffcf63\ab8d1e9e\App_Web_createrequest.aspx.cdcab7d2.tyy2bvfv.0.cs    Line: 0

Stack Trace:

[SecurityException: Access denied.]

BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception

BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)]

I have this error when I try to run a .net 2.0 web application. please help

problems when sending mail from mail program - receive exception Message MSCORLIB


When sending out email through Live mailer pro I get now the following message for each email that I want to send:


Error Message

String was not recognized as a valid DateTime.


Stack Trace

   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.DateTime.Parse(String s, IFormatProvider provider)
   at System.Convert.ToDateTime(String value)
   at Mailer.TrackProxy.get_IsTrackOK()


Can someone tell me what I have to do to solve this problem?

I use windows server 2k




Every self-respected programmer should include exception handling techniques. Sometimes your application will generate an error. Regardless of who was responsible for this error, the programmer or the user, it is up to the first to include the necessary exception handling techniques to keep his/her program from crashing. The .Net environment provides useful techniques for avoiding disastrous errors such as try-catch statements and user-defined exceptions.

Global Exception Handling with ASP.NET

After your global exception handler has done its work, you'll want to redirect the users of your website to a friendly page that tells them that something has gone wrong, and then provide them with customer support information as well as a link back to your web application's home page.

SQL Server 2005 Try and Catch Exception Handling

I'm pretty excited to see that there is some real error handling for T-SQL code in SQL Server 2005. It's pretty painful to have your wonderfully architected .NET solution tainted by less-than-VBScript error handling for stored procedures in the database. The big difference being the addition of TRY..CATCH blocks. Let's take a look:

Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

.NET 4 Web Application Startup Time

I was chatting with Jonathan Hawkins and some of the folks on the ASP.NET team about performance and Jonathan mentioned the startup time for large ASP.NET applications is improved on .NET 4. There are some improvements in the CLR and in ASP.NET itself that helped. If you have a giant app, you should do some tests.

Can't get an Icon to show for Desktop shortcut and Program Menu



I've created a SetupWizard, but can't get it to show the Icon for the shortcut on desktop and program menu. The installation goes fine without any errors, the only problem is the icon.

I've made a shortcut of my exe file in the Application Folder and dragged the shortcut to the Desktop folder, then on the shortcut properties, I assigned it an icon picture located in Application Folder.

Any suggestions will be very much appreciated.


reader.getordinal("column_may_not_exist") how to catch the exception?



would any body please help me to catch the exception if the column doesnot exist as my table columns are not static.

sometimes its throwing me indexoutofrange exception as the column doesnot exist

thanks for the help guys

Error while using exception handling block el 4.1


Hi Folks,


i am trying to use tyhe exception handling block of Enterprise library 4.1.


I just createda polisy and used IndexOutOfRangeException and added a replace handler and a logging handler to it.

I am using the NotifyRethrow PostHandlingAction to the exception.


During runtime I am getting an exception on the HandleException event, The exception is added below:



Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 42:             catch (Exception ex)
Line 43:             {
Line 44:                 bool reThrow = ExceptionPolicy.HandleException(ex, "ReplacePolicy");
Line 45:         

userprincipal.changepassword throws exception


Hi all,

      userprincipal.changepassword(oldpassword, newpassword);

gives error: that is Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied. (Exception from HRESULT: 0x80070547)

but userDirectoryEntry.invoke("ChangePassword", new object[] { oldpassword, newpassword });

      userDirectoryEntry.CommitChanges works fine.

Any one please tell me the reason behind this.

active directory exception unusual behaviour


i have a small problem
i want user names from active directory for an auto completer type of service
the method is always throwing an exception 
"searcher.FindAll()' threw an exception of type 'System.DirectoryServices.DirectoryServicesCOMException' System.DirectoryServices.SearchResultCollection 

"Exception from HRESULT: 0x800AC472"


Am Exporting Data in to Excel File,meanwhile if i open any other Excel file than the excel File on which am exporting data gets opened up Automatically having name Book1.How should i stop these excel file not to get open.In the Error log i get an error message showing " Exception from HRESULT: 0x800AC472" . Need help on these.Thanks in Advance.

Detecting PPC device on startup page to redirect?

I was wondering (since a search didn't find any posts) if there is a way for my startup page to detect what kind of device (PocketPC or web browser specifically) is loading the page and if it is a PocketPC, then redirect to the mobile pages? I will only be using PocketPC's exclusively as a mobile device.

Thanks for any suggestions!

Access to report file denied. Another program may be using it.


Migrated from Windows 2000 ASP.NET 1.1 to Windows 2003, ASP.NET 2.0 and had this error. All the forums/MSDN/Blogs says to give Read/Write Access to C:\Windows\Temp folder. Why should we give Full Access to some folder in Production server?? In windows 2000, ASP.NET 2.0 development machine, no files are created when we run crystal reports from aspx pages. Then why in Windows 2003 servers, we need to give rights to temp folder?? It is a simple code


And the code is not storing anything on the disk. Then why should it store the GUID.rpt file in Temp file in Windows 2003 server?? Any alternative is there not to store anything on the disk when Crystal Reports are opened in aspx page??


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend