【问题标题】:System.EntryPointNotFoundException when using aff file使用 aff 文件时出现 System.EntryPointNotFoundException
【发布时间】:2017-02-07 02:09:09
【问题描述】:

我创建了一个项目,在其中输入一个单词并使用 Hunspell.dll 类进行拼写检查。请注意,我通过 xamarin studio IDE(FOR MAC)从一个包中下载了这个 dll。我还下载了该类检查单词所需的 .aff 和 .dic 文件并将它们添加到我的调试文件夹中,但是当我编译应用程序时出现以下错误:System.EntryPointNotFoundException。如果您有任何想法,请告诉我。

这是我的代码:

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"));
    }    
}

【问题讨论】:

  • 您使用的是 HunspellNHunspell .NET 端口吗?如果是,请在问题中提及。还可以考虑发布您的System.EntryPointNotFoundException 的整个堆栈跟踪。帮助找出问题。谢谢。
  • @f.nasim 抱歉,是的,我正在使用 NHunspell

标签: c# xamarin-studio nhunspell


【解决方案1】:

假设您使用的是 Hunspell 的 NHunspell 端口。很可能您的本机 Hunspell 库不是您想要的(一种 CPU 架构不匹配的事情。)如果不知道您的确切环境和您正在使用的库,这个问题很难诊断。

不过,我已经通过在 Visual Studio 中使用 NuGet 安装 NHunspell 并手动下载 affdic 文件来尝试您的示例。它工作得很好。我建议您最好尝试从 NuGet 安装 NHunspell。 Xamarin Studio 还 supports NuGet 包管理。 NuGet 负责为您的环境找到合适的本机库、正确部署它们等。

更新适用于 Windows 以外平台中的 Xamarin。

NHunspell 是用 C/C++ 编写的 Hunspell 库的 .NET 包装器。为了使 NHunspell 正常工作,必须为 NHunspell 能够调用的特定环境构建 Hunspell 库。 Xamarin 与此无关。

According to the NHunspell author,截至 2015 年 2 月,没有针对非 Windows 平台的此类构建。 NHunspell 的最后一个release 出现在 2015 年 3 月。因此可以安全地假设 NHunspell 到目前为止仅适用于 Windows。因此,即使使用 NuGet 安装 NHunspell 也无济于事。

我自己尝试在 Ubuntu 16.04 中使用来自 MonoDevelop 的 NHunspell。使用 NuGet 安装成功,但是在运行时,我得到了完全相同的错误:System.EntryPointNotFoundException。由于 MonoDevelop 和 Xamarin Studio 使用相同的 .NET 运行时(称为 Mono),因此 Xamarin 应该也是如此。

【讨论】:

  • 感谢您的回复,我实际上已经在 Visual Studio 2012 上测试了我的代码,并且没有任何问题。但是,即使我通过 Nuget 包下载了 NHunspell 包,我仍然在 Xamarin Studio 上遇到错误
  • 现在的错误是什么?旧的:System.EntryPointNotFoundException?
  • 你好@f.masim 不幸的是错误仍然是一样的
  • @paul590 你在 Mac 上使用 Xamarin 吗?尽管您的问题被标记为 xamarin.mac,但仍要明确说明。这对于回答您的问题很重要。请在您的帖子中提及这一点。
  • 你好@f.nasim 是的,我在 Mac 电脑上使用这个应用程序。我也更新了我的帖子。谢谢你告诉我。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多