[Mono-bugs] [Bug 620864] New: NullReferenceException serializing a dictionary
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Jul 8 09:24:43 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=620864
http://bugzilla.novell.com/show_bug.cgi?id=620864#c0
Summary: NullReferenceException serializing a dictionary
Classification: Mono
Product: Mono: Runtime
Version: SVN
Platform: 64bit
OS/Version: RHEL 5
Status: NEW
Severity: Major
Priority: P5 - None
Component: misc
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: srfcanada at hotmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64;
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; MS-RTC LM 8)
In the following sample, serializing some basic dictionaries will generate
NullReferenceExceptions on mono but work ok on windows. Its seems to be just
dictionaries but it could be others.
1. compile the following test:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
public class TestProject
{
static void Main(string[] args)
{
//fails on mono
IDictionary<string, Type> myDataA = new Dictionary<string, Type>();
myDataA.Add("test1", typeof(String));
MemoryStream memoryStream = new MemoryStream();
BinaryFormatter binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(memoryStream, myDataA);
//fails on mono too
IDictionary<string, object> myData = new Dictionary<string, object>();
myData.Add("test1", 1234);
myData.Add("test2", "myString");
memoryStream = new MemoryStream();
binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(memoryStream, myData);
}
}
2. running it on mono will generate this error but works on windows:
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
at System.ValueType.GetHashCode () [0x00000] in <filename unknown>:0
at System.Collections.Hashtable.GetHash (System.Object key) [0x00000] in
<filename unknown>:0
at System.Collections.Hashtable.Find (System.Object key) [0x00000] in
<filename unknown>:0
at System.Collections.Hashtable.Contains (System.Object key) [0x00000] in
<filename unknown>:0
at System.Runtime.Serialization.SerializationObjectManager.RegisterObject
(System.Object obj) [0x00000] in <filename unknown>:0
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.GetObjectData
(System.Object obj,
System.Runtime.Serialization.Formatters.Binary.TypeMetadata& metadata,
System.Object& data) [0x00000] in <filename unknown>:0
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObject
(System.IO.BinaryWriter writer, Int64 id, System.Object obj) [0x00000] in
<filename unknown>:0
at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance
(System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject)
[0x00000] in <filename unknown>:0
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteValue
(System.IO.BinaryWriter writer, System.Type valueType, System.Object val)
[0x00000] in <filename unknown>:0
at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteGenericArray
(System.IO.BinaryWriter writer, Int64 id, System.Array array) [0x00000] in
<filename unknown>:0
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray
(System.IO.BinaryWriter writer, Int64 id, System.Array array) [0x00000] in
<filename unknown>:0
at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectInstance
(System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject)
[0x00000] in <filename unknown>:0
at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteQueuedObjects
(System.IO.BinaryWriter writer) [0x00000] in <filename unknown>:0
at
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteObjectGraph
(System.IO.BinaryWriter writer, System.Object obj,
System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename
unknown>:0
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize
(System.IO.Stream serializationStream, System.Object graph,
System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in <filename
unknown>:0
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize
(System.IO.Stream serializationStream, System.Object graph) [0x00000] in
<filename unknown>:0
at TestProject.Main (System.String[] args) [0x00000] in <filename unknown>:0
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list