[Mono-bugs] [Bug 71242][Wis] New - Guid structure doesn't account for multiple architectures (big-endian)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 13 Jan 2005 11:37:04 -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 cgaisford@novell.com.

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

--- shadow/71242	2005-01-13 11:37:03.000000000 -0500
+++ shadow/71242.tmp.15816	2005-01-13 11:37:03.000000000 -0500
@@ -0,0 +1,52 @@
+Bug#: 71242
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: cgaisford@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Guid structure doesn't account for multiple architectures (big-endian)
+
+The Guid structure does not account for multiple architectures in the
+Guid(byte[] b) constructor or the Guid.ToByteArray() method.  The Guid
+structure contains an int, two shorts, and 6 bytes.  When those are
+converted to a byte array, they should be converted in little endian
+regardless of architecture.  This way, ToByteArray can be called, the byte
+array can be written to a file and when moved to a different architecture,
+the structure can restore itself.
+
+Here is some test code that if you compile and run on Mac OS X like this:
+mono test.exe write you'll get the following output:
+Wrote int16 = 47
+Wrote int32 = 47474747
+Wrote int64 = 4747474747474747
+Wrote guid = 02d4683b-128b-128b-0101-010101010101
+
+mono test.exe read you'll get the following output:
+Read int16 = 47
+Read int32 = 47474747
+Read int64 = 4747474747474747
+Read guid = 02d4683b-128b-128b-0101-010101010101
+
+Copy the test.exe and tmpfile to Linux and run:
+mono test.exe read you'll get the following output:
+Read int16 = 47
+Read int32 = 47474747
+Read int64 = 4747474747474747
+Read guid = 3b68d402-8b12-8b12-0101-010101010101
+
+The guid has changed!
+
+I will attach the source for the test app.  In the test app, there are some
+extra methods that if you comment out the standard Guid methods and use the
+ methods provided, the problem is fixed!
+
+Thanks!