locked
Program crash with standard windows message. RRS feed

  • Question

  • I have a program written in VB for .Net 3.5 and deployed with ClickOnce.

    With about 80 users, one of them is getting an error I am unable to diagnose. On launch (after ClickOnce install completes) the program crashes with the standard windows "This program has closed, do you want to sent a report to Microsoft" error message.

    The user is using XP with the latest updates, has .Net 3.5 installed, and claims the program worked a few days ago (I havn't made an updates).

    Jacob

    Wednesday, April 11, 2012 3:06 PM

Answers

  • I added handlers for Application.ThreadException, Appdomain.UnhandledException, and WindowsFormsApplicationBase.UnhandledException.

    None of these caught the error.

    However, while I was never able to trap the error (something I find unsettling) I did find a solution to the main problem. My application includes a reference to MS Access for the purpose of doing automation. The user had never run Access directly so it had never completed its "preparation for first time use" and that was somehow making the reference to the PIA (which is present) invalid. After running Access once manually the program worked properly.

    Jacob

    p.s. Kalpesh and Dave, thanks for the help. I have marked both of your messages as helpful even though they didn't lead to a answer in this case.
    • Marked as answer by Jacob Wagner Tuesday, April 17, 2012 5:43 PM
    • Edited by Jacob Wagner Tuesday, April 17, 2012 5:46 PM minor edits
    Tuesday, April 17, 2012 5:40 PM

All replies

  • Hi Jacob,

    If few days ago Program working fine. then may be Virus Issue.

    try to scan that PC with Good Antivirus Software.

    did you created any Error Log File  or any type of error handling ?

    Regards

    Gautam

    Wednesday, April 11, 2012 3:58 PM
  • You can send a debug build, where the exception is globally caught and logged / emailed.

    + Check for any firewall, new antivirus installations, user folder rights change etc.


    Resolving n Evolving in C# (http://jeanpaulva.com)

    Wednesday, April 11, 2012 4:07 PM
  • did you created any Error Log File  or any type of error handling ?

    I do have error handling code in the program but it didn't catch this or else the windows message would not have come up.

    Jacob

    Wednesday, April 11, 2012 4:30 PM
  • Hi Jacob,

    Try Below Error Handling Sample and Catch Exact Error Message.

    http://stackoverflow.com/questions/337702/c-sharp-how-to-implement-one-catchem-all-exception-handler-with-resume

    Hope this help you

    Best Regards,

    Kalpesh

    
    
    
    

    Please "Mark as Answer" if this post answered your question. :)

    Kalpesh Chhatrala | Software Developer | Rajkot | India

    Kalpesh 's Blog

    VFP Form to C#, Vb.Net Conversion Utility

    • Proposed as answer by Mike Feng Thursday, April 12, 2012 6:23 AM
    • Unproposed as answer by Jacob Wagner Tuesday, April 17, 2012 3:15 PM
    Wednesday, April 11, 2012 5:41 PM
  • Hi Jacob Wagner,
    When dealing with out of the ordinary issues like this, it would be best for you to release a special build to the client that is encountering the problem. As suggested, it is recommended to implement an Unhandled Exception Handler. Please read through this MSDN article, and here is an example.

    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;

    namespace MsdnSandbox
    {
        static class Program
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main() {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);

    #if !DEBUG
                AppDomain appDomain = AppDomain.CurrentDomain;

                appDomain.UnhandledException += (sender, e) => {
                    Exception ex = (Exception)e.ExceptionObject;
                    
                    // Gather exception info here and
                    // display a dialog.

                    // Do not let the customer use the app in an unknown state
                    Environment.FailFast("An error occurred and the application must close.");
                };
    #endif

                Application.Run(new Form1());
            }
        }
    }


    Currently developing FaultTrack. I occassionally blog about C# and .NET.
    Hoping to become a MVP by 2013. Email: danderson [at] dcomproductions [dot] com

    Thursday, April 12, 2012 7:39 AM
  • Kalpesh

    Sorry that didn't work. I added a handler for Application.ThreadException and it did not catch the error.

    Jacob

    Tuesday, April 17, 2012 3:19 PM
  • I added handlers for Application.ThreadException, Appdomain.UnhandledException, and WindowsFormsApplicationBase.UnhandledException.

    None of these caught the error.

    However, while I was never able to trap the error (something I find unsettling) I did find a solution to the main problem. My application includes a reference to MS Access for the purpose of doing automation. The user had never run Access directly so it had never completed its "preparation for first time use" and that was somehow making the reference to the PIA (which is present) invalid. After running Access once manually the program worked properly.

    Jacob

    p.s. Kalpesh and Dave, thanks for the help. I have marked both of your messages as helpful even though they didn't lead to a answer in this case.
    • Marked as answer by Jacob Wagner Tuesday, April 17, 2012 5:43 PM
    • Edited by Jacob Wagner Tuesday, April 17, 2012 5:46 PM minor edits
    Tuesday, April 17, 2012 5:40 PM