Q:

Memory Counter Thread Not Working

I essentially have a process that calls another executable (which takes about half an hour to run) prior to it performing the main task. So that the customer doesn't start to think the program has hung, and for debug purposes, I have included a separate thread that should update a memory counter for this separate process every 500ms.
For some reason, this doesn't seem to be updating despite the executable's memory usage growing consistently through its run (from 100MiB -> 500MiB).
I have checked and the loops are definitely running, I just can't get the memory counter to update (I can't check in watches either as I don't have the necessary .exe on this machine and can't install VS on the target machine).
Here are the relevant sections of code, any assistance would be appreciated:
public static void Main()
    {

        try
        {
            Console.WindowWidth = 100;
        }
        catch
        {
            // ignored
        }
        ProcessStartInfo generateReport = new ProcessStartInfo
        {
            Arguments =
                "/H /EH ReliabilityMontroseLOS /T D:\\InformerReports\\Archive\\ReliabilityData\\ICSSReport.csv",
            CreateNoWindow = true,
            FileName = @"C:\Invensys\Aim\AimInform\Inform.exe",
            UseShellExecute = true
        };
        Thread thread = new Thread(() => StartReportThread(generateReport));
        thread.Start();
        int x = 35;
        int direction = 1;
        Console.ForegroundColor = ConsoleColor.Green;
        while (thread.IsAlive)
        {
            string line = "";
            for (int j = 0; j < x; j++)
            {
                line += " ";
            }
            line += "Collecting Data";
            string line2 = string.Format("AIM*Inform Memory Usage: {0} MiB", workingSet / Math.Pow(1024,2));
            Console.Clear();
            Console.WriteLine(line);        
            Console.WriteLine(line2);       
            x += direction;
            if ((x == 80) || (x == 0))
            {
                direction = -direction;
            }
            Thread.Sleep(500);
        }
//Everything else

and
        private static void StartReportThread(ProcessStartInfo generateReport)
    {
        Process proc = Process.Start(generateReport);
        while ((proc != null) && !proc.HasExited)
        {
            workingSet = proc.WorkingSet64;
            Thread.Sleep(100);
        }
    }

A:

Turns out the solution was fairly simple. System.Process heavily caches all of its fields, consequently I needed to manually trigger the update. The bottom segment of code now reads:
    private static void StartReportThread(ProcessStartInfo generateReport)
    {
        Process proc = Process.Start(generateReport);
        while ((proc != null) && !proc.HasExited)
        {
            proc.Refresh();
            workingSet = proc.WorkingSet64;
            Thread.Sleep(50);
        }
    }

Which works perfectly!

