[Mono-bugs] [Bug 473758] New: Calling methods on Graphic after passing unicode text to MeasureString fires errors

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Feb 8 23:05:39 EST 2009


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


           Summary: Calling methods on Graphic after passing unicode text
                    to MeasureString fires errors
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: i686
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Drawing.
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: calberto.cortez at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


It seems passing some specific unicode chars to Graphics.MeasureString causes
the next operations to fail. As expected, .net does not fire any error.

Try using this test case:

using System;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

public class Test
{
        static Control c;

        static void Main ()
        {
                c = new Control ();

                Graphics g = c.CreateGraphics ();
                DoPaint (g);
                g.Dispose ();
        }

        static void DoPaint (Graphics g)
        {
                byte[] data = new byte[] {0xD8, 0xD9};
                string text = Encoding.Unicode.GetString (data);

                g.MeasureString (text, c.Font);
                g.FillRectangle (SystemBrushes.ControlDark, new Rectangle (1,
1, 2, 2));
        }
}

An error appears calling FillRectangle - but if you pass a text such "hello" to
MeasureString instead, FillRectangle doesn't fire any error.

-- 
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