title: Process.Start() given an Object reference not set to an instance of an object after
body: <p>I'm in to a loop defined dynamically the function that will run onClick of control.</p>
  
  <p>the function is the following:</p>
  
  <pre><code>   public static void TryOpenFile(string filename, EventHandler callback)
          {
  
                  Process proc;
                  proc = Process.Start(filename);
  
               if (callback != null)
                  {
                      proc.EnableRaisingEvents = true;
                      proc.Exited += (a, b) =&gt;
                          {
                              callback(a, b);
                          };
                  }
  }
  </code></pre>
  
  <p>And then:</p>
  
  <pre><code>for(int i = 0; i &lt; numberOfControls; i++)
  {
  
              controlImg.SetFileToOpen(file, 
                  delegate
                  {
                      //exited!
                  });
  
  }
  </code></pre>