title: AutoCAD crashes trying to open a Modal Dialog from .Net command
body: <p>I'm developing an AutoCAD .Net plugin which contains a command that opens a modal window. The window should display a web page. </p>
  
  <p>But it has a strange bug, here is a simple code to reproduce it:</p>
  
  <pre><code>[CommandMethod("TEST_BROWSER")]
  public void TestBrowserCommand()
  {
      var window = new Window();
      var browser = new WebBrowser();
      window.Content = browser;
  
      browser.Source = new Uri("http://google.com");
  
      window.ShowDialog();
  }
  </code></pre>
  
  <p>Or even simpler:</p>
  
  <pre><code>[CommandMethod("TEST_BROWSER")]
  public void TestBrowserCommand()
  {
      Application.ShowModalWindow(new Uri("http://google.com"));
  }
  </code></pre>
  
  <p>Here is the sequence of steps after which AutoCAD crashes:</p>
  
  <ol>
  <li>Call the command from the command line (TEST_BROWSER).</li>
  <li>Close the appeared window.</li>
  <li>Call the same command once again</li>
  <li>The error message appears: <a href="http://i.stack.imgur.com/sFWMX.png" rel="nofollow">http://i.stack.imgur.com/sFWMX.png</a></li>
  </ol>
  
  <p>It works fine if to open non-modal (modeless) windows, or not to use web browser, or to call the code without using the command.</p>
  
  <p>But I need a modal window with a browser called from the command line.</p>
  
  <p>Did anyone else encounter the same issue?</p>