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 8312369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:08:23+00:00 2026-06-08T20:08:23+00:00

C# 3.5 Winforms app. I have a timer that fires every 30 seconds on

  • 0

C# 3.5 Winforms app.

I have a timer that fires every 30 seconds on separate thread (all it does is write a string of text to the VS output window).

I also have another thread that waits for a certain process to end if it starts up. For example winword.exe.

In that thread I have this code:

p.WaitForExit();

And it will sit there and wait for winword.exe to exit. That works fine.

However, while it is sitting there waiting for winword.exe to exit, the 30 second timer on a completely separate thread (that sends text to the output window) never runs.

If I wait 3 minutes (so the other timer should of run 6 times at this point, but it does not while WaitForExit() is waiting), and then I exit winword.exe; all of sudden my other timer starts running 6 times at once. It is like there is a backlog of the timer event and all of a sudden .Net wants to run it all at the same time.

Why does p.WaitForExit() seem to block my whole application even though I have it executing from a separate thread in my app (not the main UI thread)?

Edit: Yes it is in a separate thread. Here is the code that I use to launch it:

        try
        {
            Thread t = new Thread(ProcessCheck); // Kick off a new thread
            t.Start();

            ConfigLogger.Instance.LogInfo("++ ProcessCheck thread started @ " + DateTime.Now);
        }
        catch (Exception ipwse)
        {
            ConfigLogger.Instance.LogInfo(ipwse.Message + " " + ipwse.StackTrace);
        }

Here is the ProcessCheck() method that I have:

foreach (Process p in System.Diagnostics.Process.GetProcessesByName("winword"))
{
    this.Invoke(new MethodInvoker(delegate()
    {                                                                                 
        try
        {
            p.WaitForExit();
        }
        catch (Exception)
        {

        }
    }));
}
  • 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-06-08T20:08:26+00:00Added an answer on June 8, 2026 at 8:08 pm

    this.Invoke, if done from a WinForms form, will block the UI thread until the process has exited. If the Timer is System.Windows.Forms.Timer, the Tick event is raised on the UI thread. If the UI thread is blocked, that would explain why the Tick event is never raised.

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

Sidebar

Related Questions

I have a winforms app that initially displays a window with two file dialog
I have a small WinForms app that utilizes a BackgroundWorker object to perform a
I have a test winforms app with ThreadExceptionHandler that displays a message box when
I have a Winforms app that has a DataGridView that is databound at runtime.
I have a winforms app, that's locking up during a web service request I've
I have a .NET Winforms app (created in VS2005) that I deploy using ClickOnce.
If you have a Winforms app that is installed on a large number of
we have a .NET 3.5 WinForms app that uses Linq2Sql to insert records into
I have a C# .NET 2.0 WinForms app. My app has a control that
I have a .net WinForms app with buttons that are displaying as XP style

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.