NHyphenator icon indicating copy to clipboard operation
NHyphenator copied to clipboard

Sorting German hyphenation patterns stalls part-way through the sorting when targeting Framework 4.7.2

Open gerolds opened this issue 3 years ago • 0 comments

Sorting German hyphenation patterns stalls part-way through the sorting when targeting Framework 4.7.2 but works fine when targeting .net 5.0, both builds use the netstandard 2.0 DLL from the nuget.

Debugger snapshot 2022-02-21 15_00_07-Window

Patterns file hyph-de-DE_2006_patterns.txt

Minimal code to produce the bug

using System;
using System.Threading;
using System.Threading.Tasks;
using NHyphenator;
using NHyphenator.Loaders;

namespace DummyApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Task main = Task.Run(Hyphenate);
            while (!main.IsCompleted)
            {
                Thread.Sleep(100);
            }

            Console.WriteLine($"Done");
        }

        private static async Task Hyphenate()
        {
            var loader = new FilePatternsLoader("hyph-de-DE_2006_patterns.txt");
            var hyphenator = new Hyphenator(loader, "-", 5, 3, false, true);
        }    
    }
}

Project file

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net472</TargetFramework>
        <LangVersion>8</LangVersion>
    </PropertyGroup>

    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
      <PlatformTarget>x64</PlatformTarget>
    </PropertyGroup>

    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
      <PlatformTarget>x64</PlatformTarget>
    </PropertyGroup>

    <ItemGroup>
      <None Update="hyph-de-DE_2006_patterns.txt">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      </None>
    </ItemGroup>

</Project>

gerolds avatar Feb 21 '22 14:02 gerolds