Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6112603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:45:49+00:00 2026-05-23T14:45:49+00:00

I wrote a small WinForms application in C# with Visual Studio 2010. It worked

  • 0

I wrote a small WinForms application in C# with Visual Studio 2010.

It worked quite well in my environment, but I noticed that I need to run the application at the customer site on a Windows Server 2003 SP2 server with the .NET Framework 2.0 installed.

I then built the application with .NET Framework 2.0 as the target framework. Again the application ran perfectly fine on my computer.

At the customer server I noticed a strange behaviour. After starting the application, a black window opens for half a second and closes afterwards. I don’t get an error message.

I discovered that the application doesn’t even enter the main function.

How can this be debugged further, and/or solved?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:45:50+00:00Added an answer on May 23, 2026 at 2:45 pm

    What you need to do is subscribe to two events: UnhandledException and AssemblyResolve. The first is triggered on … an unhandled exception (of course). The second fires when .NET encounters an assembly reference that it cannot resolve. One or both of these will help you trap your error on the target machine.

     [STAThread]
        static void Main()
        {
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
    
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string message = string.Format("Program encountered an unhandled Exception: {0}", e.ExceptionObject);
            MessageBox.Show(message);
        }
    
        static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            string message = string.Format("Assembly cannot be located!: {0}", args.Name);
            MessageBox.Show(message);
            return null;
        }
    

    You should registered these two event handlers at the very beginning on your code, as shown.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a small PHP application several months ago that uses the WordPress XMLRPC
I wrote a small PHP application that I'd like to distribute. I'm looking for
I wrote a small application using iPhone 3.x sdk. The app works well on
We wrote a small Windows class library that implements extension methods for some standard
Right now I'm developing mostly in C/C++, but I wrote some small utilities in
I have several small open-source projects that I wrote. All my attempts to find
I'm trying to write an application (winforms) that can demonstrate how two oscillating colors
I just wrote a small module in my Rail 3.0.0 application lib folder: module
I wrote a small application and tried running it on my device. I had
I am trying to write a small interactive game-like application, where I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.