InfoPath cannot close, because a modal dialog box is open. RRS feed

  • Question

  • Hi ,

    I have a WCF service that reads xsn files. when i try to quit  the Infopath interop object programmatically i am getting the error as 

    InfoPath cannot close, because a modal dialog box is open.

    Is there a way we can handle it programmatically ?


    Arjun Menon U.K

    Tuesday, March 24, 2015 3:11 PM


  • Hello Arjun,

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. You can read more about that in the Considerations for server-side Automation of Office article.

    Consider using any third-party components designed for the non-interactive (server-side) execution.
    Tuesday, March 24, 2015 3:21 PM