[Mono-bugs] [Bug 654054] New: Marshal.SizeOf(typeof(char)) returns 2, should return 1.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 16 14:17:56 EST 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=654054#c0


           Summary: Marshal.SizeOf(typeof(char)) returns 2, should return
                    1.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jpryor at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Consider the following program:

  using System;
  using System.Runtime.InteropServices;

  class Test {
    public static void Main ()
    {
      Console.WriteLine ("sizeof(char)={0}", sizeof(char));
      Console.WriteLine ("Marshal.SizeOf(typeof(char))={0}",
          Marshal.SizeOf(typeof(char)));
    }
  }

When run under Mono, output is:

  sizeof(char)=2
  Marshal.SizeOf(typeof(char))=2

When run under .NET, output is:

  sizeof(char)=2
  Marshal.SizeOf(typeof(char))=1

Apparently Marshal.SizeOf() is returning a different value (2 instead of 1). 
Is this intended?

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