title: Stackoverflow/CLR Error in C# OpenFileDialog
body: <p>The code below is one (of three) examples of my grief.  It is a simple OpenFileDialog() call which causes the program to crash.  On XP, the crash occurs if the dialog stays open for several seconds.  On Vista, the crash occurs if the user selects "My Computer".  In VS2008, the debugger sometimes catches a stackoverflowexception.  If I put a break point in the first line (new ...), vshost.exe crashes.  If I put a break point at the ShowDialog() line, I get a FatalExecutionEngineError. If I compile without vshost, the application will run until a random crash (as on XP - there is some amount of time).</p>
  
  <p>There are two other open dialogs that open different types of files, all three of which have the same behavior.  Similar code does not show the same behavior in my other projects.</p>
  
  <p>The thread apartment is single.  I have tried setting ValidateNames = false.  The debugger is falling off the deep-end in most cases.  </p>
  
  <pre><code>OpenFileDialog imageDlg = new OpenFileDialog();
  imageDlg.Filter = "All Images|*.jpg;*.jpeg;*.png;*.tif;*.tiff;*.bmp|All Files|*.*|JPEGs (*.jpg)|*.jpg|PNGs (*.png)|*.png|TIFFs (*.tiff)|*.tiff|TIFFs (*.tif)|*.tif|BMPS (*.bmp)|*.bmp";
  imageDlg.Title = "Select Scan Image";
  
  if (DialogResult.OK == imageDlg.ShowDialog())
  {
      updateImageDisplay();
  }
  </code></pre>
  
  <p>Event handler code:</p>
  
  <pre><code>// 
  // setScratchImageButton
  // 
  this.setScratchImageButton.Location = new System.Drawing.Point(191, 15);
  this.setScratchImageButton.Name = "setScratchImageButton";
  this.setScratchImageButton.Size = new System.Drawing.Size(26, 23);
  this.setScratchImageButton.TabIndex = 8;
  this.setScratchImageButton.Text = "...";
  this.setScratchImageButton.UseVisualStyleBackColor = true;
  this.setScratchImageButton.Click += new System.EventHandler(this.setScratchImageButton_Click);
  </code></pre>
  
  <p>Code called</p>
  
  <pre><code>    private void updateImageDisplay()
      {
          if (null != project.srcImage)
          {
              imageDisplay.SizeMode = PictureBoxSizeMode.Normal;
              if (project.srcImage != null)
              {
                  imageDisplay.ClientSize = new Size(project.srcImage.Width, project.srcImage.Height);
                  imageDisplay.Image = (Image)project.srcImage;
              }
              this.ScratchImage.Text = project.srcImageLocation;
          }
          else
          {
              imageDisplay.Image = null;
              this.ScratchImage.Text = "";
          }
          ImageDisplayPanel.Refresh();
      }
  </code></pre>