title: "only part of a readprocessmemory or writeprocessmemory request was completed" during process.start
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10986486/c-sharp-only-part-of-a-readprocessmemory-or-writeprocessmemory-request-was-compl">C# Only part of a ReadProcessMemory or WriteProcessMemory request was completed during Process.Kill()</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to kick off a new process from my current process.  I'm using processInfo and process.start to do this.  The new process is supposed to run an exe I've built previously, call it newProc.exe, which runs fine from the cmd line.</p>
  
  <p>Code for the calling exe</p>
  
  <pre><code>class Program
      {
          static void Main(string[] args)
          {
              StartNewProc();
          }
  
          public static void StartNewProc()
          {
              string pathToNewProc = @"c:\path\to\newproc.exe";
  
              ProcessStartInfo processInfo = new ProcessStartInfo();
              processInfo.FileName = pathToNewProc;
              processInfo.Arguments = "Some cmd line argument";
              processInfo.CreateNoWindow = false;
              processInfo.WindowStyle = ProcessWindowStyle.Hidden;
  
              Process proc = Process.Start(processInfo);
              proc.WaitForExit();
          }
      }
  </code></pre>
  
  <p>When I run this, either in the visual studio debugger or from the cmd line, the newProc.exe doesn't get launched.  Looking at it in the debugger, if I look at 'proc' after Process.Start, I can see an exception thrown in the MainModule member.  The exception message is "Only part of a ReadProcessMemory or WriteProcessMemory request was completed".</p>
  
  <p>Looking deeper into that exception's stackTrace</p>
  
  <blockquote>
    <p>System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId,
    Boolean firstModuleOnly)   at
    System.Diagnostics.Process.get_MainModule()</p>
  </blockquote>
  
  <p>Some research into that exception points at 32bit vs 64 bit issues.  Both exes, the newProc exe and the calling exe whose code I've posed, are 64 bit apps.  I checked via the application properties and via Task Manager (looking for the "*32" tag).  I've tried setting the platform to both x64 and Any CPU in visual studio but no luck.</p>
  
  <p>Any ideas on why Process.Start would fail to read in these conditions?</p>
  
  <p>Notes: This is on Win7 64bit.  Both exes are C# applications.  Both are using the 2.0 framework (old i know but necessary).</p>