1
votes

I'm developing a .NET 2.0 WinForms application. It previously included the standard Microsoft ActiveX WebBrowser control, but I'm investigating alternatives.

What I need to do:

  • Use the WebBrowser as a standard web browser control in the application

  • Be able to use it in the background too- e.g., create the control, render the webpage and output the result to an image (using .DrawToBitmap), without the control ever being attached to a form.

  • Hook into various events in the lifecycle- mainly DocumentCompleted.

  • Webpages can be loaded (or reloaded) every 30 seconds or so, either through a new instance of the control or using the existing control. The application can remain running for long and indefinite periods of time.

  • Must work with .NET 2.0. No 3.0+ or WPF stuff.

The only three controls I've been able to find so far all have rather critical issues that prevent me from going forward:

  • Microsoft ActiveX WebBrowser - Has a huge memory leak that makes it unsuitable for running for long periods of time.

  • WebKit.NET - As far as I've been able to establish this has to be attached to a form before any rendering is done, making it useless for the thumbnail generation piece. Also seems to suffer from memory leaks.

  • GeckoFX - Works best for me, but does not properly support threading (which is critical for the thumbnail generation piece).

Any other alternatives out there?

1
what do you mean by "not properly support threading" I think some workaround can be created - Andrey
There is an Xpcom.Initialize call that may only be called once in GeckoFX. From what I've been able to gather once you call that method in a thread the GeckoWebBrowser control becomes bound to that thread- doing anything with a GeckoWebBrowser in any other thread results in COM errors. - MisterZimbu
as a workaround you can spawn processes that will encapsulate GeckoFX - Andrey
Yeah, that's what I've been reading and keeping as an idea in the back of my head. Sort of a last resort- the main project is already ridiculously complicated and I'd hate to add more moving parts as external processes to the mix. - MisterZimbu
Hey! I have an idea! You can try putting it in different AppDomains, it might give same benefits as separate processes and have much smaller overhead. - Andrey

1 Answers

2
votes

Can you embed WebKit.Net in a form that's shown way off the visible area of the screen?

You might also look at Mono.WebKit or Mono.Mozilla, though I've never used any of these.