C# Application not run
<p>C# VS 2005.</p>

<p>I have developed an application that run perfectly on my development machine when I install it. However, it doesn't run on any of the clients machines.</p>

<p>I have tested with VMWare with a fresh install of windows, and still the application doesn't run.</p>

<p>I have added logging to try and determine where the application is failing. My previous versions worked, and after a week of development I gave to the client and then experienced this problem.</p>

<p>I have entered logging at the start and end of the constructor and form_load event. The constructor runs ok. However, at the end of the constructor it doesn't run in the form_load event as I have a log statement that should print out.</p>

<p>When the application runs it displays for a few seconds in task manager then fails to load.</p>

<p>I think this could be a very difficult problem to solve. So if anyone has experienced this before or could point me in the right direction to solve this problem.</p>

<p>The code in the form load event.</p>

<pre><code>private void CATDialer_Load(object sender, EventArgs e)
{
    my_logger.Info("Start of form load event"); // Doesn't display this.
    .
    .
}
</code></pre>

<p>===== Edit static main ====</p>

<pre><code>[STAThread]
    static void Main()
    {
        Application.SetCompatibleTextRenderingDefault(false);

        // Get the language and set this cultureUI in the statusdisplay that will
        // change the language for the whole program.
        string language = CATWinSIP.Properties.Settings.Default.Language;
        if (language == "th-TH")
        {
            StatusDisplay.StatusDisplay status_display = new StatusDisplay.StatusDisplay(true);
        }
        else if(language == "en-GB")
        {
            StatusDisplay.StatusDisplay status_display = new StatusDisplay.StatusDisplay(false);
        }
        try
        {
            Application.Run(new CATDialer());
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
</code></pre>

<p>=== Constructor ===</p>

<pre><code>public CATDialer()
{
    //Set the language for all the controls on the form. 
    //Has to be done before all components are initialized.
    //If not Thai language then must be using English.
    if (Settings.Default.Language == "th-TH")
    {
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("th-TH");
    }
    else
    {
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");
    }

    InitializeComponent();

    this.statusDisplay1.BalanceStatus = CATWinSIP_MsgStrings.BalanceStatus;
    this.statusDisplay1.RedialHistory = CATWinSIP_MsgStrings.RedialHistory;
    this.statusDisplay1.LoginStatus = CATWinSIP_MsgStrings.LoginSuccessful;

    // Enable logging
    XmlConfigurator.Configure();
    logger.Info("CATDialer Constructor(): XmlConfigurator.Configure() Loaded [ OK ]");
    //    MessageBox.Show("Balance Status: " + this.statusDisplay1.BalanceStatus);

    //Short cut menu.
    this.SetupShortCutMenu();

    this.fill_properties();

    logger.Debug("CATDialer Constructor(): Fill properties loaded [ OK ]");
}
</code></pre>

<p>--</p>

<p>Hello,</p>

<p>Thanks for all the advice.</p>

<p>I have problem with one of my class libraries I created that used a crypto stream.</p>

<p>I found the answer when I added this to my program.cs</p>

<p>The message box displayed the information for the failed assembly.</p>

<p>Thanks,</p>

<pre><code>try
{
    Application.Run(new CATDialer());
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
} 
</code></pre>
