Преглед изворни кода

2010-01-08 Atsushi Enomoto <[email protected]>

	* TypeMap.cs : forward port r145077 (see change line for 2009-10-29).


svn path=/trunk/mcs/; revision=149212
Atsushi Eno пре 16 година
родитељ
комит
f30add0fba

+ 13 - 0
mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog

@@ -1,3 +1,7 @@
+2010-01-08  Atsushi Enomoto  <[email protected]>
+
+	* TypeMap.cs : forward port r145077 (see change line for 2009-10-29).
+
 2009-12-14  Atsushi Enomoto  <[email protected]>
 
 	* TypeMap.cs : handle [Serializable] objects such as KeyValuePair<,>
@@ -76,6 +80,15 @@
 	* DataContractJsonSerializer.cs: SL accepts keys without "", so tweak
 	the data to fix the quotes before passing it to the deserializer
 
+2009-10-29  Chris Toshok  <[email protected]>
+
+	* TypeMap.cs (Deserialize): use
+	FormatterServices.GetUninitializedObject instead of
+	Activator.CreateInstance, since we shouldn't be invoking the
+	default ctor.
+
+	(forward ported to trunk on 2010-01-08 by atsushi)
+
 2009-10-23  Atsushi Enomoto  <[email protected]>
 
 	* DataContractJsonSerializer.cs

+ 2 - 6
mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs

@@ -33,6 +33,7 @@ using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Reflection;
+using System.Runtime.Serialization;
 using System.Text;
 using System.Xml;
 
@@ -168,12 +169,7 @@ namespace System.Runtime.Serialization.Json
 		public object Deserialize (JsonSerializationReader jsr)
 		{
 			XmlReader reader = jsr.Reader;
-#if NET_2_1
-			// should it reject non-public constructor?
-			object ret = Activator.CreateInstance (type);
-#else
-			object ret = Activator.CreateInstance (type, true);
-#endif
+			object ret = FormatterServices.GetUninitializedObject (type);
 			Dictionary<TypeMapMember,bool> filled = new Dictionary<TypeMapMember,bool> ();
 
 			reader.ReadStartElement ();