0

C# VS 2005.

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.

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

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.

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.

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

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.

The code in the form load event.

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

===== Edit static main ====

[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);
        }

=== Constructor ===

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 ]");
}

--

Hello,

Thanks for all the advice.

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

I found the answer when I added this to my program.cs

The message box displayed the information for the failed assembly.

Thanks,

try
{
    Application.Run(new CATDialer());
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
} 
2
  • Can you post the static main and ctor of whatever is application object? Commented Jun 22, 2009 at 5:30
  • 1
    Are any exceptions being thrown? What do they say? Commented Jun 22, 2009 at 5:36

3 Answers 3

3

Have you checked on a different development machine? Are your systems running same version of the .net framework? Is the .net framework installed correctly on the remote system? Have you tested your application in a different environment?

edit: have you tried spamming your log? Wrap the entire thing in a try catch and see what you can capture. Sometimes I found using the messagebox useful for this kind of logging (MessageBox.Show())

Sign up to request clarification or add additional context in comments.

Comments

2

You probably need to post a bit more detail about the type of exception that is being thrown to get the most help.

If all the obvious checks such as having the correct framework version pass, the next thing to fail can often be a missing assembly.

If this is the case you may want to troubleshoot assembly loading in your app.

The MS Assembly Binding Log Viewer (fuslogvw) is a valuable piece of kit for this task.

Comments

1

In this sort of scenario I frequently find .NET assembly binding log viewer (Fusion) very useful in finding out what is going on. With fusion you can see which assemblies are being loaded and where they are being loaded from. More importantly for you, it is possible to enable it so that fusion also displays the assemblies that fail to load and where .NET tried to load them from.

Check out the MSDN article on fusion if you think this might help.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.