3

I have created a project where I take a word in and use the Hunspell.dll class to do a check spell. Please note I downloaded this dll from a package through the xamarin studio IDE (FOR MAC). I also downloaded the .aff and .dic files needed for the class to check the word and added them to my debug folder but when I compile the application i get the following error: System.EntryPointNotFoundException. If you have any ideas please let me know.

This is my code:

using NHunspell;

public static void Main(string[] args)
{
    string line = Console.ReadLine();
    using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic"))
    {
        bool correct = hunspell.Spell(line);
        Console.WriteLine(line + " is spelled " + (correct ? "correct" : "not correct"));
    }    
}
Chris Hamons
  • 1,510
  • 11
  • 22
paul590
  • 1,385
  • 1
  • 22
  • 43
  • 1
    Are you using the [NHunspell](http://www.crawler-lib.net/nhunspell) .NET port of _Hunspell_? If yes please mention it in the question. Also consider posting the entire stack trace of your `System.EntryPointNotFoundException`. Helps figuring out the issue. Thanks. – Farhan Nasim Sep 28 '16 at 23:36
  • @f.nasim I apologize, yes I am using NHunspell – paul590 Sep 29 '16 at 01:37

1 Answers1

4

Assuming you are using the NHunspell port of Hunspell. Very likely your native Hunspell library is not the desired one (a CPU architecture mismatch kind of thing.) This issues are very hard to diagnose without knowing your exact environment and the libraries you are using.

I have, however, tried your example by installing NHunspell with NuGet in Visual Studio and downloading the aff and dic files manually. It is working just fine. I suggest you better try installing NHunspell from NuGet. Xamarin Studio also supports NuGet package management. NuGet takes care of finding the proper native library for your environment, deploying them properly, etc.

Update: For Xamarin in platforms other than Windows.

NHunspell is a .NET wrapper around the Hunspell library that is written in C/C++. For NHunspell to work properly, there must be a build of the Hunspell library for that particular environment that NHunspell is able to invoke. Xamarin has nothing to do with that.

According to the NHunspell author, up to February 2015 there is no such build for non-Windows platforms. The last release of NHunspell appeared in March 2015. So it can be safely assumed that NHunspell is available only for Windows up to now. So even installing NHunspell with NuGet doesn't do any good.

I myself tried using NHunspell from MonoDevelop in Ubuntu 16.04. Installation was successful with NuGet, however, on run, I got exactly the same error: System.EntryPointNotFoundException. As MonoDevelop and Xamarin Studio uses the same .NET runtime (called Mono) so the same should be true for Xamarin.

Community
  • 1
  • 1
Farhan Nasim
  • 773
  • 4
  • 13
  • Thank you for your response, I have actually tested my code as well on visual studio 2012 and it works with no issues. However, I am still getting an error on Xamarin studio even tho i downloaded the NHunspell package through the Nuget package – paul590 Sep 29 '16 at 01:38
  • What is the error now? The old one: `System.EntryPointNotFoundException`? – Farhan Nasim Sep 29 '16 at 10:38
  • Hello @f.masim unfortunately the error is still the same – paul590 Sep 30 '16 at 01:49
  • 1
    @paul590 Are you using Xamarin on Mac? Though your question is tagged xamarin.mac, still make it explicit. It is important for answering your question. Mention that in your post as well please. – Farhan Nasim Sep 30 '16 at 16:28
  • Hello @f.nasim Yes, I am using this application on a mac computer. I have updated my post as well. Thank you for letting me know. – paul590 Oct 01 '16 at 21:33