.NET – Modal Dialog Issue
Today I finally got to the bottom of a niggling issue that has been bugging me for about a week. I had some downtime and debugged my way through it. The error message was as follows:
Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application
Like many developers I’ve gotten into the bad habit of googling before investigating and the only hits for this error message were related to ASP.NET applications where users were attempting to open a Winforms dialog from an ASP.NET page…
My setup was a little different – a WPF application connected to a server-side remoting service. After running out of ways to phrase my search term I went back to basics and ran the debugger a few times only to discover the root cause…similarly to the ASP.NET issue, someone had stuck a messagebox call in a catch block in our server-side remoting object…The lesson learned: investigate first, google later! :-)
Comments