Throw a geckoWebBrowser exception for C #

My program throws an exception below.

Program.cs is as follows:

    static void Main()
    {
        Gecko.Xpcom.Initialize("D:\\xulrunner\\");
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());

    }

Form1.cs is as follows:

    private void Form1_Load(object sender, EventArgs e)
    {
        //Gecko.Xpcom.Initialize("D:\\xulrunner\\");

        geckoWebBrowser1.Navigate("http://www.google.com");

    }

Translation from Chinese means the following:

"System .__ ComObject" cannot convert interface type "Gecko.nsIWebNavigation"

An exception is thrown in the following code:

public ChromeContext()
{
    using (var appShallSvc = Xpcom.GetService2<nsIAppShellService>(Contracts.AppShellService))
    {
        webNav = appShallSvc.Instance.CreateWindowlessBrowser(true).AsComPtr(); //this is where the exception is thrown

        webNav.Instance.LoadURI("chrome://global/content/alerts/alert.xul", 0, null, null, null);

    }

}

Any help would be appreciated.

+4
source share
1 answer

For older versions, you need to map the version of GeckoFX to the exact version of xulrunner.

Check your version here: https://bitbucket.org/geckofx/geckofx/wiki/Version_lists

Download xulrunner here: https://releases.mozilla.org/pub/xulrunner/releases/

45.0:

Geckofx 45.0 nuget , geckofx, firefox.

0

Source: https://habr.com/ru/post/1662822/


All Articles