[Mono-bugs] [Bug 82345][Blo] Changed - InternalArray__set_Item throws inappropriate NotSupportedException

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Aug 6 16:41:35 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 jeff.brown at gmail.com.

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

--- shadow/82345	2007-08-06 16:30:04.000000000 -0400
+++ shadow/82345.tmp.25525	2007-08-06 16:41:35.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 82345
 Product: Mono: Class Libraries
 Version: 1.2
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Blocker
 Component: System
 AssignedTo: mono-bugs at ximian.com                            
 ReportedBy: jeff.brown at gmail.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -45,6 +45,31 @@
 Should work fine.  An array cannot be extended but its elements can be
 modified.
 
 How often does this happen? 
 
 Always.  Currently blocking development for Mono platform.
+
+------- Additional Comments From jeff.brown at gmail.com  2007-08-06 16:41 -------
+Here is the code that triggers this problem.  We call
+ConvertAllToArray with two different reference types as type
+parameters and a delegate for conversion.  The failure occurs in the
+assignment to the output IList<T>.
+
+public static TOutput[] ConvertAllToArray<TInput,
+TOutput>(ICollection<TInput> input,                                  
+                                Converter<TInput, TOutput> converter)
+{
+    TOutput[] output = new TOutput[input.Count];
+    ConvertAndCopyAll(input, output, converter);
+    return output;
+}
+
+public static void ConvertAndCopyAll<TInput,
+TOutput>(ICollection<TInput> input, IList<TOutput> output,           
+                                                  Converter<TInput,
+TOutput> converter)
+{
+    int i = 0;
+    foreach (TInput value in input)
+        output[i++] = converter(value);
+}


More information about the mono-bugs mailing list