[Mono-bugs] [Bug 79976][Nor] Changed - [PATCH] ResourceReader can't handle byte[].
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Dec 29 16:25:16 EST 2006
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 anders at kaseorg.com.
http://bugzilla.ximian.com/show_bug.cgi?id=79976
--- shadow/79976 2006-11-24 09:43:02.000000000 -0500
+++ shadow/79976.tmp.32429 2006-12-29 16:25:16.000000000 -0500
@@ -43,6 +43,50 @@
Created an attachment (id=18113)
patch
------- Additional Comments From gert.driesen at pandora.be 2006-11-24 09:43 -------
Can you attach a repro (or even better, unit tests) for this issue ?
+
+------- Additional Comments From anders at kaseorg.com 2006-12-29 16:25 -------
+Run the following on Microsoft .NET:
+
+using System.Resources;
+public class RWTest {
+ public static void Main(string[] args) {
+ IResourceWriter rw = new ResourceWriter("test.resources");
+ rw.AddResource("byteArrayTest", new byte[] {1, 2, 3, 4, 5, 6});
+ rw.Generate();
+ rw.Close();
+ }
+}
+
+and try to read the resulting test.resources file with Mono:
+
+using System;
+using System.Resources;
+using System.Collections;
+
+public class RRTest {
+ public static void Main(string[] args) {
+ IResourceReader rr = new ResourceReader("test.resources");
+ foreach (DictionaryEntry de in rr)
+ Console.WriteLine("{0} = ({1}) {2}", de.Key,
+de.Value.GetType(),
+ de.Value.GetType().IsArray
+ ? "{" + String.Join(", ", Array.ConvertAll(
+ new ArrayList((Array)de.Value).ToArray(),
+ new Converter<Object, String>(Convert.ToString)))
++ "}"
+ : de.Value);
+ rr.Close();
+ }
+}
+
+Unhandled Exception: System.NotImplementedException: ByteArray
+ at System.Resources.ResourceReader.ReadValueVer2 (Int32 type_index)
+[0x00000]
+
+After applying redforks patch, the file appears to be read correctly:
+
+byteArrayTest = (System.Byte[]) {1, 2, 3, 4, 5, 6}
+
More information about the mono-bugs
mailing list