I'm developing an AutoCAD .Net plugin which contains a command that opens a modal window. The window should display a web page.
But it has a strange bug, here is a simple code to reproduce it:
[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();
}
Or even simpler:
[CommandMethod("TEST_BROWSER")]
public void TestBrowserCommand()
{
Application.ShowModalWindow(new Uri("http://google.com"));
}
Here is the sequence of steps after which AutoCAD crashes:
- Call the command from the command line (TEST_BROWSER).
- Close the appeared window.
- Call the same command once again
- The error message appears: https://i.stack.imgur.com/sFWMX.png
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.
But I need a modal window with a browser called from the command line.
Did anyone else encounter the same issue?