2

I created a task in Task Scheduler to run the following C# Hello World program. When I trigger it wait for it to complete, I can confirm under in its history that the console application have finished executing. However, under the Status column of my scheduled task, it shows that it's still running. What's up with the contradiction?

using System;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
        }
    }
}

Screenshot Scheduled Task

4
  • 3
    I notice the same thing on my machines. Try refreshing. Apr 7, 2014 at 19:55
  • 2
    Even after a "refresh" of the Task Scheduler console ? if yes, check if the process is still running using task manager.
    – krisFR
    Apr 7, 2014 at 20:03
  • 1
    Agreed with both notes - The task scheduler view in Win7/Server 2008 does not appear to auto-refresh. Apr 7, 2014 at 21:38
  • 1
    You guys are right. The Task Scheduler doesn't auto-refresh the status of the tasks.
    – burnt1ce85
    Apr 8, 2014 at 16:47

1 Answer 1

0

Have a root around with Process Explorer. You might find that an instance of CONHOST.EXE is still lurking around (i.e.: an instance spawned for your console app). Now, I haven't done any C coding since ~1997, and that was with Borland C++ (i.e.: pre .NET framework). However, your code doesn't have an explicit return code - not sure if this would cause the Task Scheduler to not detect an exit. Unlikely, but worth a punt.

1
  • 2
    I tried explicitly stating a return code of 0 but that doesn't solve the issue. The issue is that the Task Scheduler doesn't auto-refresh as @Psychoholic has pointed out in the comments.
    – burnt1ce85
    Apr 8, 2014 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .