How do I resolve a Hunspell Intel 32bit DLL not found exception?
Asked Answered
S

5

6

I have used the following code for spelling checking.

While I am running it, I get an DLLFileNotFound exception:

"Hunspell Intel 32Bit DLL not found: C:\project\splee\Hunspellx86.dll".

Code Snippet:

using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic")) 
    { 
        bool correct = hunspell.Spell("Recommendation"); 
        var suggestions = hunspell.Suggest("Recommendation"); 
        foreach (string suggestion in suggestions) 
        { 
            Console.WriteLine("Suggestion is: " + suggestion); 
        } 
    } 

    // Hyphen 
    using (Hyphen hyphen = new Hyphen("hyph_en_us.dic")) 
    { 
        var hyphenated = hyphen.Hyphenate("Recommendation"); 
    } 


    using (MyThes thes = new MyThes("th_en_us_new.idx", "th_en_us_new.dat")) 
    { 
        using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic")) 
        { 
            ThesResult tr = thes.Lookup("cars", hunspell); 
            foreach (ThesMeaning meaning in tr.Meanings) 
            { 
                Console.WriteLine("  Meaning: " + meaning.Description); 
                foreach (string synonym in meaning.Synonyms) 
                { 
                    Console.WriteLine("    Synonym: " + synonym); 

                } 
            } 
        } 

I have made a reference to Hunspell.dll in the project. What's going wrong?

Senna answered 27/4, 2010 at 4:18 Comment(0)
C
5

You need to include the native Hunspellx86.dll next to the the managed NHunspell.dll.

I did the following way:

  1. Referenced NHunspell.
  2. set the Copy Local property
  3. Include the NHunspellx86.dll to my project
  4. Set "Copy to output directory" property "copy if newer".

This ensures that the native Hunspell.dll will be in place.

Chandelier answered 26/12, 2010 at 19:19 Comment(1)
This is only a useful solution in the situation where it is verified that the NHunspellx** DLL is not in the correct place (in the bin folder). In my case, the DLL is definitely in place correctly.Leatrice
L
3

I have replicated this error in two different scenarios using NHunspell v 0.9.4. It appears that NHunspell shows this error message for a range of issues which could occur during the process of loading the relevant unmanaged Hunspellx**.dll.

The first cause I found was if the particular IIS app pool running my webapp did not have 32-bit applications enabled. This, of course, is only relevant if you're running your 32-bit webapp on a 64-bit machine.

The second cause I found was if the IIS process user did not have appropriate permissions to read the folder containing Hunspellx**.dll. The IIS users (group called something like MACHINENAME\IIS_IUSRS) must have permission to read and execute every file in the webapp execution directory (and bin subfolder).

Leatrice answered 21/10, 2011 at 6:37 Comment(1)
Thanks for tips - Had the same issue, but the IIS process needs read access to the directory. However, changing 32bit webapps enabled did not resolve the problem for us.Puffball
S
1

Ensure the Copy local setting is set to "Copy always" when you right click the NHunspell.DLL in Solution Explorer.

Surgy answered 15/7, 2010 at 18:49 Comment(0)
F
1

I was able to resolve this in VB.net 2010 as follows, I assume something similar can be done in C# and later versions of VB.net:

  1. Double-click "My Project" in Solution Explorer.
  2. Click the "View Application Events" button.
  3. Add an Application Startup event like this:
 Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
     Hunspell.NativeDllPath = "D:\VB.net\_system\hunspell\dll\" '(replace path with folder containing Hunspellx86.dll)
 End Sub

I believe you can also just put Hunspellx86.dll in the folder containing your application's .exe file.

Floro answered 25/12, 2018 at 13:21 Comment(0)
M
0

I had this issue in a production environment when the version of the unmanaged DLLs was slightly older than the version the ASP.Net project was built against.

Specifically FusLogVw showed:

LOG: Assembly download was successful. Attempting setup of file: C:\ThePath\Hunspellx64.dll
LOG: Entering download cache setup phase.
ERR: Error extracting manifest import from file (hr = 0x80131018).
ERR: Setup failed with hr = 0x80131018.
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.

Updating to the correct version of the unmanaged DLLs resolved the issue.

Moretta answered 13/6, 2013 at 4:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.