[Mono-bugs] [Bug 45833][Nor] New - Cannot distinguish Class type and Value type

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Fri, 4 Jul 2003 01:25:29 -0400 (EDT)


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 hfhe@stryon.com.

http://bugzilla.ximian.com/show_bug.cgi?id=45833

--- shadow/45833	Fri Jul  4 01:25:29 2003
+++ shadow/45833.tmp.9171	Fri Jul  4 01:25:29 2003
@@ -0,0 +1,93 @@
+Bug#: 45833
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: Windows 2000
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: hfhe@stryon.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Cannot distinguish Class type and Value type
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+There two type to denote a C struct in CSharp, one is a class, another is 
+a struct:
+[ StructLayout( LayoutKind.Sequential )]   
+public class OSVersionInfo 
+{			
+    public int OSVersionInfoSize;
+    public int majorVersion; 
+    public int minorVersion;
+    public int buildNumber;
+    public int platformId;
+
+	[ MarshalAs( UnmanagedType.ByValTStr, SizeConst=128 )]    
+    public String versionString;
+}
+
+[ StructLayout( LayoutKind.Sequential )]  
+public struct OSVersionInfo2 
+{
+    public int OSVersionInfoSize;
+    public int majorVersion; 
+    public int minorVersion;
+    public int buildNumber;
+    public int platformId;
+
+	[ MarshalAs( UnmanagedType.ByValTStr, SizeConst=128 )]    
+    public String versionString;
+}
+
+when call system library function GetVersionEx, take this type parameter,
+the ref struct can get correct result, but class failed.
+
+Steps to reproduce the problem:
+1. 
+2. 
+3. 
+
+Actual Results:
+Class size:    148
+Major version: 0
+Minor version: 0
+Build number:  0
+Platform ID:   0
+Version:
+
+Passing OSVersionInfo as struc
+Struct size:   148
+Major version: 5
+Minor version: 0
+Build number:  2195
+Platform ID:   2
+Version:       Service Pack 3
+
+Expected Results:
+Class size:    148
+Major version: 5
+Minor version: 0
+Build number:  2195
+Platform ID:   2
+Version:       Service Pack 3
+
+Passing OSVersionInfo as struct
+Struct size:   148
+Major version: 5
+Minor version: 0
+Build number:  2195
+Platform ID:   2
+Version:       Service Pack 3
+
+How often does this happen? 
+Each time
+
+Additional Information: