sillsdev/icu-dotnet

System.EntryPointNotFoundException when using icu.net.56.0.2

conniey opened this issue · 1 comments

All of the ubrk_* exported functions are missing from icuuc56.dll.

Repro Steps

  1. Create a console application
  2. Add NuGet package icu.net 56.0.2
  3. Add code below.
  4. Run program
public class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine($"ICU Version: {Wrapper.IcuVersion}");
        var locale = new Locale("en-US");
        var text = "Hello world";
        var terms = BreakIterator.Split(BreakIterator.UBreakIteratorType.WORD, locale, text).ToArray();
        foreach (var term in terms) {
            Console.WriteLine(term); 
        }
        Console.WriteLine("Press Enter to EXIT...");
        Console.ReadLine();
    }
}

Expected

Console output below

ICU Version: 56.1
Hello
world

Actual

An unhandled exception of type 'System.EntryPointNotFoundException' occurred in icu.net.dll

Additional information: Unable to find an entry point named 'ubrk_open_56' in DLL 'icuuc56.dll'.

The reason this fails is because the BreakIterator and thus ubrk_* methods are not included in the minimal ICU build that ships with icu.net 56.0.2. The Readme incorrectly stated that the BreakIterator would be included.

I fixed the Readme and enhanced the exception message.

For the next version of icu.net there will be separate nuget packages for the unmanaged libraries (ICU4C.Win*) so that it's possible to decide if one wants the full or minimal version of ICU.