I've mentioned in the past that I like the SessionSaver extension for Firefox and would like to implement similar functionality for RSS Bandit. I finished up this feature last night but I kept getting weird behavior. The expected behavior is that when RSS Bandit is launched it remembers the application state from the last time it was closed such as whether it was minimized to the system tray, open browser tabs, what nodes in the feed subscription tree were expanded and what news item(s) were selected.
The weird behavior was that every once in a while when the application restarted, I'd get an InvalidActiveXStateException which was thrown from the IWebBrowser2.Navigate method when restoring the open browser tabs from the previous time the application ran. Further investigation narrowed the issue down to only showing up when the application had been minimized to the system tray when it was closed and thus being immediately minimized to the system tray when the application was restarted.
I managed to read a comment on some forum that indicated that the problem is that IWebBrowser2.Navigate method doesn't work if the WebBrowser control isn't visible. This means that this feature won't work as smoothly as I'd like when the application is restarted after being closed from the system tray but it does get rid of the ugly exception.
I hope this blog post explains why the feature will seem wonky in this situation for our users and may prove useful to developers who come across this weird error in the future.