[Mono-bugs] [Bug 335488] Marshal.StringToHGlobalAnsi doesn't support embedded '\0' in string
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Nov 6 10:33:19 EST 2007
https://bugzilla.novell.com/show_bug.cgi?id=335488#c1
Sebastien Pouliot <spouliot at novell.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #179564|0 |1
is obsolete| |
--- Comment #1 from Sebastien Pouliot <spouliot at novell.com> 2007-11-06 08:33:18 MST ---
Created an attachment (id=182226)
--> (https://bugzilla.novell.com/attachment.cgi?id=182226)
runtime patch
This gets us the same behavior as 1.1 and 2.0 with the sample code (added a few
C.WL):
using System;
using System.Runtime.InteropServices;
namespace TestMarshalStringToHGlobalAnsi {
class Program {
static void Main(string[] args)
{
const int size = 4096;
string s = "".PadLeft(size, '\0');
Console.WriteLine (s.Length);
IntPtr ptr = Marshal.StringToHGlobalAnsi(s);
string s2 = Marshal.PtrToStringAnsi (ptr);
Console.WriteLine (s2.Length);
for (int i = 0; i < size; i += 4) {
Marshal.WriteInt32(ptr, i, 0);
}
Marshal.FreeHGlobal(ptr);
}
}
}
--
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