none
Unexplained Crash on .NET Windows Form, Potentially a Common Crash? RRS feed

  • Question

  • Hi,

    I have a continuous problem with a .NET Framework 3.5 Windows Form application crashing with the "...this application has performed an illegal error..." error message.  No errors are being caught through a Try-Catch (using a generic Exception, so to my knowledge it should catch any exception?) block throughout the application, so it appears to be something external.  At first we thought it may have been the users computer, but even after a replacement computer the same error continues.

     

    I was just wondering if there are any common crashes which have any hotfixes etc. for .NET Framework 3.5? Or if anyone else has experienced anything similar?

     

    Thanks

    • Moved by Jing0 Wednesday, August 18, 2010 9:11 AM (From:Windows Forms General)
    Tuesday, August 17, 2010 7:59 AM

Answers

  • try to do everything you can to catch the exception :

    	static class Program
    	{
    		/// <summary>
    		/// The main entry point for the application.
    		/// </summary>
    		[STAThread]
    		static void Main(params string[] args)
    		{
    			try
    			{
    				Application.EnableVisualStyles();
    				Application.SetCompatibleTextRenderingDefault(false);
    				Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
    				Application.Run(new Form1());
    			}
    			catch (Exception ex)
    			{
    				// log and/or display error
    			}
    		}
    
    		static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
    		{
    			// log and/or display error
    		}
    	}
    
    

    And of course, as Daniel said, check Event Log for errors.

    Best regards,
    Vladimir

     

    • Marked as answer by eryang Wednesday, August 25, 2010 7:02 AM
    Wednesday, August 18, 2010 11:55 AM

All replies

  • Do you have any entries in the Application Event Log (Control Panel > Administative Tools > Event Viewer > Applications)?

    I've seen crashes that aren't caught by generic exceptions (or even the application level unhandled exceptions) which are caused by third party dlls / libraries (especially ones that access hardware) e.g. recently I've had Microsoft POS.NET receipt printer exceptions cause this, although I think it's caused by badly written Epson drivers.

    -Dan

    Tuesday, August 17, 2010 11:19 AM
  • Hi,

     

    The crashing error is happened once program start? May I know what references/dlls you are using? Thanks

     

    Best regards

    cchitsiang

    Tuesday, August 17, 2010 5:01 PM
  • Hi,

     

    I am moving this thread to CLR forum. There are more debugging experts could help you about this.

     

    Best regards,

    Ling Wang


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Wednesday, August 18, 2010 9:09 AM
  • try to do everything you can to catch the exception :

    	static class Program
    	{
    		/// <summary>
    		/// The main entry point for the application.
    		/// </summary>
    		[STAThread]
    		static void Main(params string[] args)
    		{
    			try
    			{
    				Application.EnableVisualStyles();
    				Application.SetCompatibleTextRenderingDefault(false);
    				Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
    				Application.Run(new Form1());
    			}
    			catch (Exception ex)
    			{
    				// log and/or display error
    			}
    		}
    
    		static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
    		{
    			// log and/or display error
    		}
    	}
    
    

    And of course, as Daniel said, check Event Log for errors.

    Best regards,
    Vladimir

     

    • Marked as answer by eryang Wednesday, August 25, 2010 7:02 AM
    Wednesday, August 18, 2010 11:55 AM
  • Thanks for the advice all, as soon as the next crash occurs I'll be checking the event log and I've implemented the try-catch on the Program.cs too aswell, fingers crossed.

    Wednesday, August 18, 2010 1:47 PM
  •  

    We temporarily mark a reply, please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, August 25, 2010 7:01 AM