I am seeing something unexpected when accessing the Process.ProcessName
property. Immediately after accessing it, my process starts continuous I/O
activity at a rate of 10 reads/sec and 5 writes/sec. My process is not doing
anything else at the time - it is a long running process that sits idle most
of the
time except for this constant I/O activity.
This is happening on WinXP Pro + SP2 and Win2003 + SP1, both running
..NET 1.1 + SP1. Any ideas how to quiet things down after accessing the
ProcessName? It continues even after the var that uses it goes out of scope.
Here is a simple program to demonstrate this:
using System;
using System.Diagnostics;
namespace ProcessNameTest
{
class ProcessNameTest
{
[STAThread]
static void Main(string[] args)
{
string dummy;
Process currentProcess = Process.GetCurrentProcess();
System.Console.WriteLine("Check this processes I/O activity now - should
be no new I/O");
System.Console.WriteLine("Hit Enter to continue");
dummy = System.Console.ReadLine();
string process = currentProcess.ProcessName;
System.Console.WriteLine("Check this processes I/O activity now - should
be about 10 reads/second and 5 writes/second");
System.Console.WriteLine("Hit Enter to continue");
dummy = System.Console.ReadLine();
string processUpper = process.ToUpper();
string pid = currentProcess.Id.ToString();
}
}
}
|