0

Only headaches from this Mono library... I created simple C# console app from this internationalization tutorial It works when building it with mono, but I want to build/run it using Visual Studio. I added Mono.Posix nuget to project.

Program looks like this:

using System;
using Mono.Unix;
using System.Globalization;
using System.Threading;

    public class i18n
    {
        public static void Main(string[] argv)
        {
            Catalog.Init("lv", "./locale");
            Console.WriteLine(Catalog.GetString("My name is {0}"), "Enzo");
            int i = 20;
            Console.WriteLine(Catalog.GetPluralString("I'm {0} year old.", "I'm {0} years old.", i), i);
            i = 21;
            Console.WriteLine(Catalog.GetPluralString("I'm {0} year old.", "I'm {0} years old.", i), i);
            i = 22;
            Console.WriteLine(Catalog.GetPluralString("I'm {0} year old.", "I'm {0} years old.", i), i);
            Console.ReadKey();
        }
    }

First I got error that MonoPosixHelper.dll could not be found. Added it. Then intl.dll was missing. Added. Now I get PInvokeStackImbalance occured message:

Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'D:\TESTS\i18n\i18n\bin\x86\Debug\i18n.vshost.exe'.

Additional information: A call to PInvoke function 'Mono.Posix!Mono.Unix.Catalog::bindtextdomain' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

It all happens in Catalog.Init("lv", "./locale"); I have no clue what is wrong/missing etc.

Community
  • 1
  • 1
Jānis
  • 1,773
  • 1
  • 21
  • 30
  • "supported by Microsoft"?? No. The last checkin for Catalog.cs was 3 years ago and annotates "Fix INTL.DLL CallingConvention". Quite a coincidence, getting the calling convention wrong produces this error. Crystal ball says that you copied the wrong intl.dll – Hans Passant Apr 14 '16 at 15:31
  • My bad, misread "sponsored". Could you link to this checkin? I can't find it. I copied intl.dll from Mono directory in program files which I had freshly installed. – Jānis Apr 14 '16 at 15:51
  • https://github.com/mono/mono/tree/master/mcs/class/Mono.Posix/Mono.Unix – Hans Passant Apr 14 '16 at 15:55

0 Answers0