[Mono-bugs] [Bug 76973][Wis] New - Casting an uint8[8] to uint8[] sets it size back to 0

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Dec 13 03:54:46 EST 2005


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 ck at carlo-kok.com.

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

--- shadow/76973	2005-12-13 03:54:46.000000000 -0500
+++ shadow/76973.tmp.11967	2005-12-13 03:54:46.000000000 -0500
@@ -0,0 +1,81 @@
+Bug#: 76973
+Product: Mono: Runtime
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: ck at carlo-kok.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Casting an uint8[8] to uint8[] sets it size back to 0
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+When having a local variable of uint8[8] (uint8[0...8]) and trying to cast
+it to uint8[] it loses it's length, while on .NET it's possible cast an
+array of these types back and forth. 
+
+Steps to reproduce the problem:
+1. Get the attached .exe file 
+2. run it
+
+Actual Results:
+8
+0
+
+Expected Results:
+8
+8
+
+How often does this happen? 
+Always.
+
+Additional Information:
+
+When trying to decompile it with monodis, it replaces:
+newobj     instance void uint8[0...]::.ctor(int32)
+with:
+newobj     instance void uint8[]::.ctor(int32)
+
+Which has a different result (then it works, however the 0... variant
+should work too). The original source is:
+
+namespace MonoTest;
+
+interface
+
+type
+  ConsoleApp = class
+  public
+    class method Main;
+  end;
+
+  ByteArray = array of Byte;
+
+implementation
+
+method Test;
+var
+  Buf: array [0..7] of Byte;
+begin
+  Console.WriteLine(Length(Buf).ToString);
+  // ouput: 8(Windows) 8(Mono)
+  Console.WriteLine(Length(ByteArray(Buf)).ToString);
+  // ouput: 8(Windows) 0(Mono)
+end;
+
+class method ConsoleApp.Main;
+begin
+  Test;
+  Console.ReadLine;
+end;
+
+end.


More information about the mono-bugs mailing list