[Mono-bugs] [Bug 422564] New: Strings Returned Via P/ Invoke Returned Blank When Contain Certain ANSI Characters

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Sep 3 09:56:32 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=422564


           Summary: Strings Returned Via P/Invoke Returned Blank When
                    Contain Certain ANSI Characters
           Product: Mono: Class Libraries
           Version: 1.9
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: martin_costello at talk21.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer


In my code I have a delegate similar to this:

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int Function(int param1,
                               int param2,
                               [MarshalAs(UnmanagedType.LPStr)] StringBuilder
param3,
                               int param4);

Which links to a C Static Library.

This works perfectly on Windows (when compiled as a DLL), and has for a long
time.  However, running this under Mono has thrown up a problem.

If the returned string contains an upper-cased diacritic character e.g. È (as
represented in Windows Codepage 1252), then the string returned by param3 is ""
i.e. a zero length string.  The expected string can be any length, and in any
position.  It's mere presence seems to be causing the string to not be returned
to the StringBuilder.

However, the Windows code correctly returns the character using the above C#
code.  The character is also returned in a native C application running on
Linux.  Lower case diacritics appear to be returned correctly, but upper-case
causes this problem.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list