Commit Graph
40 Commits
Author SHA1 Message Date
Miguel de Icaza ae0feab435 Removal of NET_1_1 defines and some NET_2_0; Both defines are true these days in Mono, no versions prior to 2.0 are supported 2012-06-01 18:04:24 -04:00
Kyle Ambroff 0dfe460dc6 version tolerant serialization fails with missing primitive members
Modifies ObjectReader so that when it encounters a primitive typed member in
an object stream which has no corresponding member in the app domain, it will
read the value anyway and throw it away. That way it can read the next block
from the stream.

Added a unit test which passes with the changes to ObjectReader.

Fixes bug #641821.
2011-01-26 18:07:31 -05:00
Gonzalo Paniagua Javier a171f3314b Able to read MS serialized nullable<primitive>
Handle boxed primitive types for nullable fields.
	Fixes bug #646556.
2010-10-20 01:36:46 -04:00
Andrés G. Aragoneses bbd182a095 [corlib] Prevent BinaryFormatter to throw on missing fields
This commit includes unit tests that were run in MS.NET > 2.0.
The old behaviour of MS.NET 1.1 is still included in the patch
as an ONLY_1_1 define, to be backport-friendly to other branches
(but can be removed from now on in next commits, as mono master
doesn't include this profile anymore). Fixes BNC#324144.
2010-09-22 03:09:17 +08:00
Robert Jordan 6ffb4366fc 2010-02-26 Robert Jordan <[email protected]>
* ObjectReader.cs (ReadType, GetDeserializationType):
	Add throwOnError parameter that specifies whether to throw an
 	exception if the type/assembly is not found.

	* ObjectReader.cs (ReadTypeMetadata): Ignore unresolvable
 	types while reading the type info. Fixes #430583.

	* ObjectReader.cs (GetDeserializationType): Rethrow caught
 	exceptions as SerializationExceptions.


svn path=/trunk/mcs/; revision=152579
2010-02-26 20:24:43 +00:00
Miguel de Icaza 3c39ac4586 Jumbo patch for NET_2_0, mscorlib is now clean
svn path=/trunk/mcs/; revision=145621
2009-11-06 22:23:59 +00:00
Gonzalo Paniagua Javier 34a842f6b3 2009-09-30 Gonzalo Paniagua Javier <[email protected]>
* BinaryFormatter.cs: NoCheckDeserialize() was using PeekChar() on a
	reader when it should only read 1 byte. Also BinaryReader.PeekChar()
	tries to set the position of hte stream back to where it was before
	the read, which does not work well with broken Stream
	implementations like BZip2InputStream (reports CanSeek is true when
	it really can't seek). Now we do a Read() and then pass the value we
	read on to the next methods.

	* MessageFormatter.cs: 
	* ObjectReader.cs: added overloads that take a BinaryElement instead
	of reading it from the reader. Only for the methods used in
	NoCheckDeserialize.

	Fixes bug #503435.


svn path=/trunk/mcs/; revision=142963
2009-09-30 06:06:06 +00:00
Robert Jordan 3b1eaca759 2008-09-04 Robert Jordan <[email protected]>
* corlib_test.dll: Add S.R.S/SerializationTest2.cs

In System.Runtime.Serialization.Formatters.Binary:
2008-09-17  Robert Jordan  <[email protected]>>

	* ObjectReader.cs (ReadTypeMetadata): Replace the check for
	ISerializable with something less `reflective'.
	Fixes #421664.

In Test/System.Runtime.Serialization:
2008-09-17  Robert Jordan  <[email protected]>

	* SerializationTest2.cs: Add test case for bug #421664.


svn path=/trunk/mcs/; revision=113278
2008-09-17 11:28:51 +00:00
Marek Safar cc9c53a109 Warnings cleanup
svn path=/trunk/mcs/; revision=111713
2008-08-27 15:40:13 +00:00
Robert Jordan 3a9042c6e5 Resurrect r84839
svn path=/trunk/mcs/; revision=84841
2007-08-25 06:25:01 +00:00
Alan McGovern 4ab5568a5a reverted changes for datetime serialization
svn path=/trunk/mcs/; revision=84840
2007-08-25 02:32:55 +00:00
Robert Jordan 5ef01bea4b In System:
2007-08-25  Robert Jordan  <[email protected]>

	* DateTime.cs: Implement internal To/FromBinary for the 1.1 profile.

In System.Runtime.Serialization.Formatters.Binary:
2007-08-25  Robert Jordan  <[email protected]>

	* ObjectReader.cs, ObjectWriter.cs, CodeGenerator.cs:
	Use DateTime.From/ToBinary. Fixes #82400.


svn path=/trunk/mcs/; revision=84839
2007-08-25 00:46:18 +00:00
Robert Jordan c76ea13748 In .:
2007-08-23  Robert Jordan  <[email protected]>

	* corlib.dll.sources: Added MemberInfoSerializationHolder.cs.

In System.Runtime.Serialization.Formatters.Binary:
2007-08-23  Robert Jordan  <[email protected]>

	* ObjectReader.cs, ObjectReader.cs: Map between System.MonoType[] and
	MS.NET's System.RuntimeType[].
	
	* ObjectReader.cs (ReadType): When a type couldn't be found, emit
	a more useful exception.

In System.Reflection:
2007-08-23  Robert Jordan  <[email protected]>

	* MemberInfoSerializationHolder.cs: created from
	ReflectionSerializationHolder to match MS (fixes bug #80761).
	Add support for	fields, events, properties and generic methods.

	* MonoMethod.cs (GetObjectData): handle generic arguments.

	* MonoGenericMethod.cs: mark as [Serializable].

	* MonoProperty.cs (GetObjectData): implemented.

	* MonoField.cs: ditto.

	* MonoEvent.cs: ditto.


svn path=/trunk/mcs/; revision=84732
2007-08-23 18:40:17 +00:00
Robert Jordan bb653a80a8 In System.Runtime.Remoting.Messaging:
2006-12-25  Robert Jordan  <[email protected]>

	* MethodCall.cs: Add support for generic methods.
	* MethodCall.cs (GetTypeNameFromAssemblyQualifiedName):
	Add support for generic types.
	* ReturnMessage.cs: Fix bug #80371.

In System.Runtime.Serialization.Formatters.Binary:
2006-12-25  Robert Jordan  <[email protected]>

	* binary_serialization_format.htm: Update the NET_2_0 format.
	* BinaryCommon.cs: MethodFlags is actually an int32. Add NET_2_0 flags.
	* MessageFormatter.cs: Add support for generic method arguments.
	* ObjectWriter.cs, ObjectReader.cs: Map between System.MonoType and
	MS.NET's System.RuntimeType.


svn path=/trunk/mcs/; revision=70683
2007-01-08 23:55:18 +00:00
Robert Jordan 7e0fe07971 Change eol-style to native.
svn path=/trunk/mcs/; revision=70681
2007-01-08 23:30:26 +00:00
Robert Jordan 39fbea3fba Normalize the line endings to CRLF.
svn path=/trunk/mcs/; revision=70679
2007-01-08 23:28:04 +00:00
Robert Jordan 83c1b15790 2006-10-29 Robert Jordan <[email protected]>
* ObjectWriter.cs, ObjectReader [NET_2_0]:
	Use the SerializationObjectManager.


svn path=/trunk/mcs/; revision=67110
2006-10-29 20:37:35 +00:00
Raja R Harinath f0af503273 In System.Runtime.Serialization.Formatters.Binary:
Fix #79159
	* ObjectWriter.cs (WritePrimitiveTypeArray) [NET_2_0]: Encode the
	'Kind' of each DateTime.
	* ObjectReader.cs (ReadArrayOfPrimitiveType) [NET_2_0]: Decode the
	'Kind' of each DateTime.

In Test/System.Runtime.Serialization.Formatters.Binary:
	* BinaryFormatterTest.cs (DateTimeArray): New test for
	round-tripping DateTime arrays.

svn path=/trunk/mcs/; revision=64929
2006-09-05 12:10:14 +00:00
Raja R Harinath 045919d65c Make line-endings uniform. Pick the one which changes the least number of lines. Set eol-style=native on files with LF-endings.
svn path=/trunk/mcs/; revision=64923
2006-09-05 11:24:50 +00:00
Lluis Sanchez 11ebc5207d 2005-12-07 Lluis Sanchez Gual <[email protected]>
* ObjectReader.cs: Added null check in GetDeserializationType.
	Patch by Ben Maurer. Fixes bug #69666.


svn path=/trunk/mcs/; revision=54030
2005-12-07 12:47:08 +00:00
Lluis Sanchez 159038b6fa 2005-03-23 Lluis Sanchez Gual <[email protected]>
* BinaryCommon.cs: Added helper method for swapping bytes.
	* ObjectReader.cs:
	* ObjectWriter.cs: Implemented serialization of arrays of primitive
	types using Buffer.BlockCopy to create byffers of data that is written/
	read in a single call. It's much faster now.


svn path=/trunk/mcs/; revision=42162
2005-03-23 19:11:05 +00:00
Lluis Sanchez 7838d80521 2005-03-01 Lluis Sanchez Gual <[email protected]>
* BinaryCommon.cs: Found the meaning of two unknown binary elements.
	* CodeGenerator.cs: Derive generated classes from ClrTypeMetadata
	instead of TypeMetadata. Added writeTypes parameter to WriteTypeData().
	* ObjectWriter.cs: Use type and assembly names as keys for the type and
	assembly caches. This is needed since ISerializable types can provide
	fake type names (which are mapped to real types by a binder on
	deserialization).
	Implemented support for BinaryFormatter.TypeFormat.
	* BinaryFormatter.cs, MessageFormatter.cs: Implemented support for
	TypeFormat property.
	* ObjectReader.cs: Added support for objects serialized without
	member type information. This fixes bug #73114.
	If a binder return null, use the default way of loading the type.


svn path=/trunk/mcs/; revision=41404
2005-03-03 17:05:26 +00:00
Lluis Sanchez 9d7e94c4dc 2005-02-25 Lluis Sanchez Gual <[email protected]>
* ObjectReader.cs: In ReadArrayOfPrimitiveType, added a specific
	read loop for each type. It's much faster and avoids value boxings.


svn path=/trunk/mcs/; revision=41196
2005-02-25 13:09:46 +00:00
Ben Maurer 2b4b651057 some warning silence
svn path=/trunk/mcs/; revision=37938
2004-12-19 18:21:41 +00:00
Lluis Sanchez 5fffb9a4fb 2004-12-15 Lluis Sanchez Gual <[email protected]>
* ObjectReader.cs: Use GetField instead of GetMembers. Properties can't
	be serialized, so it makes no sense to use GetMembers.


svn path=/trunk/mcs/; revision=37783
2004-12-15 14:04:20 +00:00
Duncan Mak 13d1764537 Add license and copyright to all source files in corlib
svn path=/trunk/mcs/; revision=29249
2004-06-11 02:09:36 +00:00
Lluis Sanchez 3ea9677f51 * ObjectReader.cs, ObjectWriter.cs: FIXME cleaning.
svn path=/trunk/mcs/; revision=26011
2004-04-26 18:50:16 +00:00
Lluis Sanchez d1948fa79a * CodeGenerator.cs, ObjectReader.cs, ObjectWriter.cs: Serialize decimals
as strings, like in MS.NET. This fixes bug #57186.

svn path=/trunk/mcs/; revision=25740
2004-04-20 18:29:15 +00:00
Lluis Sanchez d9513ee597 * ObjectReader.cs: Field names can include the type name if the field belongs to a base type. Take this into account.
svn path=/trunk/mcs/; revision=21453
2003-12-23 15:47:27 +00:00
Lluis Sanchez f22dc5eae7 * BinaryFormatter.cs, MessageFormatter.cs, ObjectReader.cs: Added support
for TypeFilter property.

svn path=/trunk/mcs/; revision=20312
2003-11-21 16:57:11 +00:00
Lluis Sanchez 4680ad0fa4 ObjectReader.cs, ObjectWriter.cs: Changed some GetType calls to "is" checks.
svn path=/trunk/mcs/; revision=19892
2003-11-12 15:54:08 +00:00
Lluis Sanchez e271cc193c * ObjectReader.cs, ObjectWriter.cs, BinaryCommon.cs: Fixed bug #45970.
svn path=/trunk/mcs/; revision=16602
2003-07-24 12:27:53 +00:00
Lluis Sanchez 82fbf05daa * ObjectReader.cs: Keep MemberInfo members in type's metadata object, so it is
not necessary to query them for every object.
    * ObjectWriter.cs: If the value being serialized is a value type (not boxed)
      then there is no need to register it in the ObjectIDGenerator, because it is
      not possible to have two references to the same value type object.

svn path=/trunk/mcs/; revision=16342
2003-07-17 12:12:26 +00:00
Lluis Sanchez 3989b96cc8 * ObjectReader.cs: Changed signature of ReadObjectGraph, so now it returns the
deserialized object and the headers.
    * MessageFormatter.cs: The result of the call to the HeaderHandler delegate is
      now interpreted as the uri of the target object. This seems to be MS.NET
      behavior.
	* BinaryFormatter.cs: Deserialize now calls the HeaderHandler delegate,
	  if provided.

svn path=/trunk/mcs/; revision=14559
2003-05-13 20:55:05 +00:00
Lluis Sanchez 3accd72948 * BinaryFormatter.cs: Implemented support for binders.
* MessageFormatter.cs: Implemented support for binders.
    * ObjectReader.cs: Implemented support for binders.

svn path=/trunk/mcs/; revision=11968
2003-02-25 20:31:53 +00:00
Lluis Sanchez 032fcf581e * MessageFormatter.cs: Fixed bug in serialization of arguments.
* ObjectReader.cs: Fixed bug causing array of structs to fail.

svn path=/trunk/mcs/; revision=11661
2003-02-18 00:51:52 +00:00
Patrik Torstensson caf229d10d 2003-02-11 Patrik Torstensson
* ObjectReader.cs: Fixed root object bug causing object reader to return root object
	  before fixup. Closes bug #37842.

svn path=/trunk/mcs/; revision=11481
2003-02-11 12:43:46 +00:00
Martin Baulig b2cc52a35e 2003-01-24 Martin Baulig <[email protected]>
* ObjectReader.cs (ReadNextObject): Call
	RaiseDeserializationEvent() on the ObjectManager when we're done
	reading the whole graph.

svn path=/trunk/mcs/; revision=10873
2003-01-24 16:36:29 +00:00
Lluis Sanchez 5195d4cfc0 * ObjectWriter.cs, ObjectReader.cs: Added suport for headers.
Corrected encoding of primitive types. Corrected a bug about zero-length arrays.
* MessageFormatter.cs: Added. Implements serialization of messages.
* BinaryFormatter.cs: Added serialization of messages.
* BinaryCommon.cs: Added enum of codes of primitive types.

svn path=/trunk/mcs/; revision=10864
2003-01-24 11:21:30 +00:00
Lluis Sanchez 23cb51f860 * BinaryFormatter.cs: implemented Serialize and Deserialize methods.
* ObjectReader.cs: added.
* ObjectWriter.cs: added.
* BinaryCommon.cs. added.

svn path=/trunk/mcs/; revision=10617
2003-01-17 14:19:51 +00:00