1

I'm using Xulrunner and GeckoFX in a vb application (version 33.0-0.1 for both), and when debugging the application, the line

Gecko.Xpcom.Initialize(System.IO.Directory.GetCurrentDirectory() & "\xulrunner")

throws the exception:

Unable to load DLL 'xul': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Note that regardless of how I call the Initialize() function, the exact same exception comes up. I've tried:

  • Gecko.Xpcom.Initialize()
  • Gecko.Xpcom.Initialize(System.IO.Directory.GetCurrentDirectory() & "\xulrunner")
  • Gecko.Xpcom.Initialize(System.IO.Directory.GetCurrentDirectory() & "\bin\xulrunner")
  • Gecko.Xpcom.Initialize("C:\full path here\xulrunner")

This question Unable to load DLL (Module could not be found HRESULT: 0x8007007E) led me to use Dependency walker to check the dll.

Checking the dll showed that I was "missing" a slew of other things, as shown below:

Dependency Walker Results

That in turn led me to Win 7, 64 bit, dll problems, which also didn't help. While DW does show some of the same missing DLLs, it's also showing other ones that aren't listed in that question.

Of the offered solutions in that question, I've tried:

  • reinstalling the VS Redistributable Package
  • running 'sfc /scannow'

I've noticed in the aforementioned question that some people are saying it's an issue with OCX files instead of the DLL, but I'm not sure how to even start on that end. I couldn't find any OCX files in the project directory.

I realize that the problem may also lie in how I implemented GeckoFX and Xulrunner. Previously, this application was working using SkyboundGecko, GeckoFX, and Xulrunner. It seems that the previous developer working on this application followed this tutorial (or something very similar) using version 14 of GeckoFX and Xulrunner. However, this recently started causing problems for some customers using the application, as there was an Xpcom.dll conflict with a different application they were using. This issue only applies to those customers which had application X (I don't remember the name) installed on their computer. Other computers did not have this issue.

A bit of research has led me to believe that more current versions of GeckoFX and Xulrunner no longer require XPCom.dll, which means that an upgrade should in theory resolve this issue.

Thus, I started (loosely) following this tutorial in order to upgrade Gecko and Xulrunner. I removed the previous reference to the Skybound.Gecko.dll, and replaced Xulrunner with a newer version. I also downloaded and extracted the GeckoFX DLLs and files. My Bin now looks like this:

My Current Bin Folder

I added the reference to Gecko back to the project, and changed any references of Skybound.Gecko.xxxx to Gecko.xxxx. (Perhaps this tells you something that I don't know/haven't realized, since the tutorials I've seen never use Gecko.xxx - the function calls, for example, are Xpcom.Initialize() instead of Gecko.Xpcom.Initialize())

I'm running Windows 8 on Windows Server 2012 R2 Standard, 64 bit OS.

Is there another way to avoid the Xpcom.dll conflict, and if not, how do I resolve this issue?

If any other information is required, comment and I'll try my best to provide it.

Community
  • 1
  • 1
Aify
  • 3,543
  • 3
  • 24
  • 43
  • One thought: In your Xpcom.Initialize(), simplify things for now by hard-coding the path to where you know the folder is, rather than depending on the working directory to be something; you can make it flexible later, once you're sure you have a working system. – John Hatton May 28 '15 at 17:33
  • @JohnHatton hard coding the full path gives the same exception, and I do have the right Xulrunner. I made sure that the version numbers matched up exactly. – Aify May 28 '15 at 17:35
  • Did that help? I tried giving it the wrong path, and got the exact error you report. – John Hatton May 28 '15 at 22:14
  • @JohnHatton Hard coding the path does not help, and I have since edited the hard coding the path into the question to show that even then it results in the same exception (as you received as well). – Aify May 28 '15 at 22:16
  • Install Firefox 33, and call Gecko.Xpcom.Initialize() with the location of the firefox 33 directory.Does that help? Also if you run dep walker directly from as the xulrunner directory does it show the same missing files? (eg. open command prompt and cd to the xulrunner directory then run dep walker from command line) – Tom May 29 '15 at 11:18
  • I already have FireFox 33 installed, and calling it from that location changed nothing. Dependency walker was also always run from the xulrunner dir. @Tom – Aify May 29 '15 at 15:34
  • The odd thing is that the XUL.dll in your depends screen shot looks different to the XUL.dll shipped with firefox 33 (32bit). Firstly I would have expected the MSVCR120.dll ref to be MSVCR100.dll which should exist in the firefox install dir next to XUL.dll. Also the symbols displayed have some differences (extra entry points). If you right click in depends and tick "Full Paths" with will show if the dlls at the expected location are being shown... – Tom May 29 '15 at 21:54

1 Answers1

1

In my case this error is caused because of I initialised xulrunner in Form1_Load function. I resolved it by initialising xulrunner in public Form1() function. Try to initialise xulrunner as shown below,

 public Form1()
        {
            InitializeComponent();
            Gecko.Xpcom.Initialize(@"C:\Users\PAVILION\Documents\visual studio 2010\Projects\SiteFilterAutomation\SiteFilterAutomation\bin\Debug\xulrunner\");

        }

        private void Form1_Load(object sender, EventArgs e)
        {

      geckoWebBrowser1.Navigate("www.google.com");
    }
arunjos007
  • 4,105
  • 1
  • 28
  • 43