Web Browser Control causes memory exception on application.close

I have a web browser control on a tab control in a windows forms 2.0 application deployed through click once using C#. The web browser control works fine until I try to close the application. Actually, it never ever fails for me, but fails always for everyone else. I think it is because I do not have MS Office installed on my development machine.

every time I close the application I get a windows memory exception, could not write to xxxxxxxx error. I have tried everything that I can think of to clear the web browser control before exiting, but nothing works. Setting = NULL, Dispose, removing the control from the tab at close time, sleeping for a few seconds, etc. The only thing that does work is to remove the control completely from the form.

Any ideas

Thanks,

Christian



Answer this question

Web Browser Control causes memory exception on application.close

  • LittleG

    I this is a problem with any ActiveX that has IO access. One article I read, traced the problem back to the Message Sink provided by the .NET wrapper class. Somehow it's not detaching properly. So messages are sent to the ActiveX even if the the container form is already disposed.

    I have the same problem with Windows Media Player.


  • Anonymous1673443

    I would have a look at the way that you are closing (Disposing) your objects in your application... make sure that they are all finalized and closed before you exit the application.



  • Dacryphil


    Hi Cmccarrick,

    Because WebBrowser control will use the Internet Explorer routine, so I think you may try to check if you have the installed the recently version IE and its service pack on the destination machine.

    Also did your application using any assembly or dll If so, try to make a setup project and include as many assemlbies as possible to mostly simulate your dev environment.

    BTW: for such crash issue is hard to handle in the forum, because we need to collect dump at the problem environment and do further low level troubleshooting. I suggest you contact MSPSS directly.

    http://support.microsoft.com

    Thanks for your understanding!

    Best regards,
    Peter Huang



  • Web Browser Control causes memory exception on application.close