[Mono-bugs] [Bug 81941][Nor] New - Array.Sort(double, uint[]) throws an exception

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jun 24 00:14:58 EDT 2007

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 aronjunk at hotmail.com.


--- shadow/81941	2007-06-24 00:14:58.000000000 -0400
+++ shadow/81941.tmp.2776	2007-06-24 00:14:58.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 81941
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Fedora Core 6
+Status: NEW   
+Severity: Unknown
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: aronjunk at hotmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Array.Sort(double, uint[]) throws an exception
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+System.Array.Sort(double[], uint[]) fails by throwing a
+System.NullReferenceException. System.Array.Sort(double[], int[]) works as
+expected (or at least does not throw an exception).
+Steps to reproduce the problem: (see code under "additional information")
+1. Create an array of doubles with varying values
+2. Create a uint array of the same size
+3. Run array.sort(double[], uint[])
+Actual Results:
+System.NullReferenceException thrown
+Expected Results:
+Arrays both get sorted in sync, according to the elements in the first
+How often does this happen?
+Every time
+Additional Information: Exception thrown:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+  at System.Array.obj_swapper (Int32 i, Int32 j) [0x00000]
+  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_int_int
+  at System.Array.combsort (System.Double[] array, Int32 start, Int32 size,
+System.Swapper swap_items) [0x00000]
+  at System.Array.Sort[Double,UInt32] (System.Double[] keys,
+System.UInt32[] items, Int32 index, Int32 length, IComparer`1 comparer)
+  at System.Array.Sort[Double,UInt32] (System.Double[] keys,
+System.UInt32[] items) [0x00000]
+  at Test.Test.Main (System.String[] args) [0x00000]
+The following code reproduces the bug:
+using System;
+namespace Test
+    public class Test
+    {
+        public static void Main(string[] args)
+        {
+            double[] a = new double[2] { 0.9, 0.3 };
+            uint[] b = new uint[2] { 4, 7 };
+            Array.Sort(a, b);
+            // changing uint[] to int[] above makes the code work as expected
+        }
+    }

More information about the mono-bugs mailing list