[Mono-bugs] [Bug 654058] New: FixedBufferAttribute.Length has wrong value in fixed fields.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 16 14:24:30 EST 2010


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

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


           Summary: FixedBufferAttribute.Length has wrong value in fixed
                    fields.
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: jpryor at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Consider the following program, in which Foo.FieldName is a fixed-width 'char'
buffer holding 32 characters:

  using System;
  using System.Runtime.CompilerServices;

  unsafe struct Foo {
    public fixed char FieldName [32];
  }

  class Test {
    public static void Main ()
    {
      var t = typeof(Foo);
      var f = t.GetField ("FieldName");
      var fbas = (FixedBufferAttribute[]) 
        f.GetCustomAttributes (typeof(FixedBufferAttribute), true);
      Console.WriteLine ("FixedBufferAttribute: {0}", fbas.Length);
      Console.WriteLine ("fieldSize = {0}", fbas [0].Length);
    }
  }

Compile:  gmcs /unsafe /out:ff.exe ff.cs

Run: mono ff.exe

  FixedBufferAttribute: 1
  fieldSize = 64

Compare to .NET: CSC /unsafe /out:ff-n.exe ff.cs

Run on .NET: ff-n.exe

  FixedBufferAttribute: 1
  fieldSize = 32

Note that the fieldSize value differs.

Perhaps this is related to #654054?

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


More information about the mono-bugs mailing list