[Mono-bugs] [Bug 38983][Nor] New - StructLayout size attribute not handled properly

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Mon, 3 Mar 2003 10:22:36 -0500 (EST)

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jkdoug@psu.edu.


--- shadow/38983	Mon Mar  3 10:22:35 2003
+++ shadow/38983.tmp.19967	Mon Mar  3 10:22:35 2003
@@ -0,0 +1,34 @@
+Bug#: 38983
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 7.3
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jkdoug@psu.edu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: StructLayout size attribute not handled properly
+When I declare a structure to be larger than its fields, it appears to add 
+the field sizes to the size attribute instead of taking the size as an 
+absolute. I am declaring my structure to be 64 bytes larger than the 
+fields because I want to read in a 64 byte string from a socket, and I am 
+using the structure size to determine how many bytes to read... and it 
+works fine under VS.Net.
+[StructLayout(LayoutKind.Sequential, Pack=1, Size=71, 
+public struct DeviceResp
+  public ushort subtype;
+  public ushort code;
+  public ushort index;
+  public byte access;