From 8d097349b3289b35c6052d1a8612e33de2a7bbbf Mon Sep 17 00:00:00 2001
From: Marek Safar
Date: Tue, 17 Mar 2015 08:03:08 +0100
Subject: [PATCH] [corlib] Serialization from reference sources
---
external/referencesource | 2 +-
mcs/class/corlib/ReferenceSources/BCLDebug.cs | 5 +
.../ReferenceSources/MessageDictionary.cs | 412 +++++
.../RemotingFieldCachedData.cs | 21 +
.../corlib/ReferenceSources/RuntimeType.cs | 20 +-
.../corlib/System.Reflection/MonoAssembly.cs | 11 +
.../corlib/System.Reflection/MonoField.cs | 35 +
.../corlib/System.Reflection/MonoMethod.cs | 5 +
.../System.Reflection/MonoParameterInfo.cs | 7 +-
.../IInternalMessage.cs | 23 +-
.../LogicalCallContext.cs | 6 +
.../MethodCall.cs | 40 +
.../MethodDictionary.cs | 10 +-
.../MethodResponse.cs | 36 +
.../MonoMethodMessage.cs | 7 +
.../ReturnMessage.cs | 9 +
.../corlib/System.Runtime.Remoting/ObjRef.cs | 4 +
.../RemotingServices.cs | 5 +
.../.gitattributes | 1 -
.../BinaryCommon.cs | 235 ---
.../BinaryFormatter.cs | 273 ---
.../ChangeLog | 371 ----
.../CodeGenerator.cs | 405 -----
.../MessageFormatter.cs | 504 ------
.../ObjectReader.cs | 994 -----------
.../ObjectWriter.cs | 994 -----------
.../binary_serialization_format.htm | 1552 -----------------
.../.gitattributes | 5 -
.../ChangeLog | 51 -
.../FormatterAssemblyStyle.cs | 55 -
.../FormatterTopObjectStyle.cs | 55 -
.../FormatterTypeStyle.cs | 59 -
.../IFieldInfo.cs | 56 -
.../ISoapMessage.cs | 86 -
.../InternalArrayTypeE.cs | 66 -
.../InternalElementTypeE.cs | 57 -
.../InternalMemberTypeE.cs | 60 -
.../InternalMemberValueE.cs | 64 -
.../InternalNameSpaceE.cs | 84 -
.../InternalObjectPositionE.cs | 60 -
.../InternalObjectTypeE.cs | 56 -
.../InternalParseStateE.cs | 60 -
.../InternalParseTypeE.cs | 97 --
.../InternalPrimitiveTypeE.cs | 112 --
.../InternalRM.cs | 57 -
.../InternalST.cs | 83 -
.../InternalSerializerTypeE.cs | 53 -
.../ServerFault.cs | 78 -
.../SoapFault.cs | 101 --
.../SoapMessage.cs | 86 -
.../TypeFilterLevel.cs | 43 -
.../System.Runtime.Serialization/ChangeLog | 347 ----
.../System.Runtime.Serialization/Formatter.cs | 186 --
.../FormatterConverter.cs | 177 --
.../FormatterServices.cs | 218 ---
.../IDeserializationCallback.cs | 39 -
.../IFormatter.cs | 90 -
.../IFormatterConverter.cs | 57 -
.../IObjectReference.cs | 40 -
.../ISafeSerializationData.cs | 36 -
.../ISerializable.cs | 40 -
.../ISerializationSurrogate.cs | 68 -
.../ISurrogateSelector.cs | 65 -
.../ObjectIDGenerator.cs | 117 --
.../ObjectManager.cs | 638 -------
.../OnDeserializedAttribute.cs | 38 -
.../OnDeserializingAttribute.cs | 38 -
.../OnSerializedAttribute.cs | 38 -
.../OnSerializingAttribute.cs | 38 -
.../OptionalFieldAttribute.cs | 49 -
.../SafeSerializationEventArgs.cs | 50 -
.../SerializationBinder.cs | 52 -
.../SerializationCallbacks.cs | 160 --
.../SerializationEntry.cs | 64 -
.../SerializationException.cs | 62 -
.../SerializationInfo.cs | 390 -----
.../SerializationInfoEnumerator.cs | 85 -
.../SerializationObjectManager.cs | 94 -
.../StreamingContext.cs | 85 -
.../StreamingContextStates.cs | 81 -
.../SurrogateSelector.cs | 120 --
mcs/class/corlib/System/Array.cs | 15 +
mcs/class/corlib/System/Delegate.cs | 5 +
.../System/DelegateSerializationHolder.cs | 2 +-
mcs/class/corlib/System/RuntimeFieldHandle.cs | 9 +
.../BinaryFormatterTest.cs | 56 +
mcs/class/corlib/corlib.dll.sources | 104 +-
mono/metadata/icall-def.h | 3 +
88 files changed, 775 insertions(+), 10552 deletions(-)
create mode 100644 mcs/class/corlib/ReferenceSources/MessageDictionary.cs
create mode 100644 mcs/class/corlib/ReferenceSources/RemotingFieldCachedData.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/.gitattributes
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/binary_serialization_format.htm
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/.gitattributes
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalRM.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalST.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization.Formatters/TypeFilterLevel.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/ChangeLog
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/Formatter.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/ISafeSerializationData.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/OnDeserializedAttribute.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/OnDeserializingAttribute.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/OnSerializedAttribute.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/OnSerializingAttribute.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/OptionalFieldAttribute.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SafeSerializationEventArgs.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SerializationObjectManager.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs
delete mode 100644 mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs
diff --git a/external/referencesource b/external/referencesource
index fb151e4afef..8cbddd1eec2 160000
--- a/external/referencesource
+++ b/external/referencesource
@@ -1 +1 @@
-Subproject commit fb151e4afeffea5753b84674c888eaa7b274b51e
+Subproject commit 8cbddd1eec236af973d4d9dcb623a4dccde91d52
diff --git a/mcs/class/corlib/ReferenceSources/BCLDebug.cs b/mcs/class/corlib/ReferenceSources/BCLDebug.cs
index cb7c8e7e4fa..62c8ea6d21b 100644
--- a/mcs/class/corlib/ReferenceSources/BCLDebug.cs
+++ b/mcs/class/corlib/ReferenceSources/BCLDebug.cs
@@ -46,5 +46,10 @@ namespace System
public static void Trace (string switchName, params object[]messages)
{
}
+
+ internal static bool CheckEnabled (string switchName)
+ {
+ return false;
+ }
}
}
diff --git a/mcs/class/corlib/ReferenceSources/MessageDictionary.cs b/mcs/class/corlib/ReferenceSources/MessageDictionary.cs
new file mode 100644
index 00000000000..a4399faa51b
--- /dev/null
+++ b/mcs/class/corlib/ReferenceSources/MessageDictionary.cs
@@ -0,0 +1,412 @@
+using System.Collections;
+using System.Diagnostics.Contracts;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ //+================================================================================
+ //
+ // Synopsis: Abstract class to help present a dictionary view of an object
+ //
+ //-================================================================================
+ internal abstract class MessageDictionary : IDictionary
+ {
+ internal String[] _keys;
+ internal IDictionary _dict;
+
+ internal MessageDictionary(String[] keys, IDictionary idict)
+ {
+ _keys = keys;
+ _dict = idict;
+ }
+
+ internal bool HasUserData()
+ {
+ // used by message smuggler to determine if there is any custom user
+ // data in the dictionary
+ if ((_dict != null) && (_dict.Count > 0))
+ return true;
+ else
+ return false;
+ }
+
+ // used by message smuggler, so that it doesn't have to iterate
+ // through special keys
+ internal IDictionary InternalDictionary
+ {
+ get { return _dict; }
+ }
+
+
+ internal abstract Object GetMessageValue(int i);
+
+ [System.Security.SecurityCritical]
+ internal abstract void SetSpecialKey(int keyNum, Object value);
+
+ public virtual bool IsReadOnly { get { return false; } }
+ public virtual bool IsSynchronized { get { return false; } }
+ public virtual bool IsFixedSize { get { return false; } }
+
+ public virtual Object SyncRoot { get { return this; } }
+
+
+ public virtual bool Contains(Object key)
+ {
+ if (ContainsSpecialKey(key))
+ {
+ return true;
+ }
+ else if (_dict != null)
+ {
+ return _dict.Contains(key);
+ }
+ return false;
+ }
+
+ protected virtual bool ContainsSpecialKey(Object key)
+ {
+ if (!(key is System.String))
+ {
+ return false;
+ }
+ String skey = (String) key;
+ for (int i = 0 ; i < _keys.Length; i++)
+ {
+ if (skey.Equals(_keys[i]))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public virtual void CopyTo(Array array, int index)
+ {
+ for (int i=0; i<_keys.Length; i++)
+ {
+ array.SetValue(GetMessageValue(i), index+i);
+ }
+
+ if (_dict != null)
+ {
+ _dict.CopyTo(array, index+_keys.Length);
+ }
+ }
+
+ public virtual Object this[Object key]
+ {
+ get
+ {
+ System.String skey = key as System.String;
+ if (null != skey)
+ {
+ for (int i=0; i<_keys.Length; i++)
+ {
+ if (skey.Equals(_keys[i]))
+ {
+ return GetMessageValue(i);
+ }
+ }
+ if (_dict != null)
+ {
+ return _dict[key];
+ }
+ }
+ return null;
+ }
+ [System.Security.SecuritySafeCritical] // TODO: review - implements transparent public method
+ set
+ {
+ if (ContainsSpecialKey(key))
+ {
+ if (key.Equals(MonoMethodMessage.UriKey))
+ {
+ SetSpecialKey(0,value);
+ }
+ else if (key.Equals(MonoMethodMessage.CallContextKey))
+ {
+ SetSpecialKey(1,value);
+ }
+ else
+ {
+ throw new ArgumentException(
+ Environment.GetResourceString(
+ "Argument_InvalidKey"));
+ }
+ }
+ else
+ {
+ if (_dict == null)
+ {
+ _dict = new Hashtable();
+ }
+ _dict[key] = value;
+ }
+
+ }
+ }
+
+ IDictionaryEnumerator IDictionary.GetEnumerator()
+ {
+ return new MessageDictionaryEnumerator(this, _dict);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ throw new NotSupportedException();
+ }
+
+
+ public virtual void Add(Object key, Object value)
+ {
+ if (ContainsSpecialKey(key))
+ {
+ throw new ArgumentException(
+ Environment.GetResourceString(
+ "Argument_InvalidKey"));
+ }
+ else
+ {
+ if (_dict == null)
+ {
+ // no need to interlock, message object not guaranteed to
+ // be thread-safe.
+ _dict = new Hashtable();
+ }
+ _dict.Add(key, value);
+ }
+ }
+
+ public virtual void Clear()
+ {
+ // Remove all the entries from the hash table
+ if (null != _dict)
+ {
+ _dict.Clear();
+ }
+ }
+
+ public virtual void Remove(Object key)
+ {
+ if (ContainsSpecialKey(key) || (_dict == null))
+ {
+ throw new ArgumentException(
+ Environment.GetResourceString(
+ "Argument_InvalidKey"));
+ }
+ else
+ {
+ _dict.Remove(key);
+ }
+ }
+
+ public virtual ICollection Keys
+ {
+ get
+ {
+
+ int len = _keys.Length;
+ ICollection c = (_dict != null) ? _dict.Keys : null;
+ if (c != null)
+ {
+ len += c.Count;
+ }
+
+ ArrayList l = new ArrayList(len);
+ for (int i = 0; i<_keys.Length; i++)
+ {
+ l.Add(_keys[i]);
+ }
+
+ if (c != null)
+ {
+ l.AddRange(c);
+ }
+
+ return l;
+ }
+ }
+
+ public virtual ICollection Values
+ {
+ get
+ {
+ int len = _keys.Length;
+ ICollection c = (_dict != null) ? _dict.Keys : null;
+ if (c != null)
+ {
+ len += c.Count;
+ }
+
+ ArrayList l = new ArrayList(len);
+
+ for (int i = 0; i<_keys.Length; i++)
+ {
+ l.Add(GetMessageValue(i));
+ }
+
+ if (c != null)
+ {
+ l.AddRange(c);
+ }
+ return l;
+ }
+ }
+
+ public virtual int Count
+ {
+ get
+ {
+ if (_dict != null)
+ {
+ return _dict.Count+_keys.Length;
+ }
+ else
+ {
+ return _keys.Length;
+ }
+ }
+ }
+
+ }
+
+ //+================================================================================
+ //
+ // Synopsis: Dictionary enumerator for helper class
+ //
+ //-================================================================================
+ internal class MessageDictionaryEnumerator : IDictionaryEnumerator
+ {
+ private int i=-1;
+ private IDictionaryEnumerator _enumHash;
+ private MessageDictionary _md;
+
+
+ public MessageDictionaryEnumerator(MessageDictionary md, IDictionary hashtable)
+ {
+ _md = md;
+ if (hashtable != null)
+ {
+ _enumHash = hashtable.GetEnumerator();
+ }
+ else
+ {
+ _enumHash = null;
+ }
+ }
+ // Returns the key of the current element of the enumeration. The returned
+ // value is undefined before the first call to GetNext and following
+ // a call to GetNext that returned false. Multiple calls to
+ // GetKey with no intervening calls to GetNext will return
+ // the same object.
+ //
+ public Object Key {
+ get {
+ if (i < 0)
+ {
+ throw new InvalidOperationException(
+ Environment.GetResourceString(
+ "InvalidOperation_InternalState"));
+ }
+ if (i < _md._keys.Length)
+ {
+ return _md._keys[i];
+ }
+ else
+ {
+ Contract.Assert(_enumHash != null,"_enumHash != null");
+ return _enumHash.Key;
+ }
+ }
+ }
+
+ // Returns the value of the current element of the enumeration. The
+ // returned value is undefined before the first call to GetNext and
+ // following a call to GetNext that returned false. Multiple calls
+ // to GetValue with no intervening calls to GetNext will
+ // return the same object.
+ //
+ public Object Value {
+ get {
+ if (i < 0)
+ {
+ throw new InvalidOperationException(
+ Environment.GetResourceString(
+ "InvalidOperation_InternalState"));
+ }
+
+ if (i < _md._keys.Length)
+ {
+ return _md.GetMessageValue(i);
+ }
+ else
+ {
+ Contract.Assert(_enumHash != null,"_enumHash != null");
+ return _enumHash.Value;
+ }
+ }
+ }
+
+ // Advances the enumerator to the next element of the enumeration and
+ // returns a boolean indicating whether an element is available. Upon
+ // creation, an enumerator is conceptually positioned before the first
+ // element of the enumeration, and the first call to GetNext brings
+ // the first element of the enumeration into view.
+ //
+ public bool MoveNext()
+ {
+ if (i == -2)
+ {
+ throw new InvalidOperationException(
+ Environment.GetResourceString(
+ "InvalidOperation_InternalState"));
+ }
+ i++;
+ if (i < _md._keys.Length)
+ {
+ return true;
+ }
+ else
+ {
+ if (_enumHash != null && _enumHash.MoveNext())
+ {
+ return true;
+ }
+ else
+ {
+ i = -2;
+ return false;
+ }
+ }
+ }
+
+ // Returns the current element of the enumeration. The returned value is
+ // undefined before the first call to MoveNext and following a call
+ // to MoveNext that returned false. Multiple calls to
+ // Current with no intervening calls to MoveNext will return
+ // the same object.
+ //
+ public Object Current {
+ get {
+ return Entry;
+ }
+ }
+
+ public DictionaryEntry Entry {
+ get {
+ return new DictionaryEntry(Key, Value);
+ }
+ }
+
+ // Resets the enumerator, positioning it before the first element. If an
+ // Enumerator doesn't support Reset, a NotSupportedException is
+ // thrown.
+ public void Reset()
+ {
+ i = -1;
+ if (_enumHash != null)
+ {
+ _enumHash.Reset();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/mcs/class/corlib/ReferenceSources/RemotingFieldCachedData.cs b/mcs/class/corlib/ReferenceSources/RemotingFieldCachedData.cs
new file mode 100644
index 00000000000..4259077c93d
--- /dev/null
+++ b/mcs/class/corlib/ReferenceSources/RemotingFieldCachedData.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Metadata
+{
+ class RemotingCachedData
+ {
+
+ }
+
+ class RemotingFieldCachedData
+ {
+ internal RemotingFieldCachedData(RuntimeFieldInfo ri)
+ {
+ }
+
+ internal RemotingFieldCachedData(SerializationFieldInfo ri)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/mcs/class/corlib/ReferenceSources/RuntimeType.cs b/mcs/class/corlib/ReferenceSources/RuntimeType.cs
index e0f48d36255..8be507cbce1 100644
--- a/mcs/class/corlib/ReferenceSources/RuntimeType.cs
+++ b/mcs/class/corlib/ReferenceSources/RuntimeType.cs
@@ -37,6 +37,7 @@ using System.Reflection.Emit;
#endif
using System.Diagnostics.Contracts;
using System.Security;
+using System.Runtime.Serialization;
namespace System
{
@@ -54,6 +55,23 @@ namespace System
return att.Length != 0 ? ((DefaultMemberAttribute) att [0]).MemberName : null;
}
+ RuntimeConstructorInfo m_serializationCtor;
+ internal RuntimeConstructorInfo GetSerializationCtor()
+ {
+ if (m_serializationCtor == null) {
+ var s_SICtorParamTypes = new Type[] { typeof(SerializationInfo), typeof(StreamingContext) };
+
+ m_serializationCtor = GetConstructor(
+ BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
+ null,
+ CallingConventions.Any,
+ s_SICtorParamTypes,
+ null) as RuntimeConstructorInfo;
+ }
+
+ return m_serializationCtor;
+ }
+
internal Object CreateInstanceSlow(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark)
{
bool bNeedSecurityCheck = true;
@@ -650,4 +668,4 @@ namespace System
get { return get_core_clr_security_level () == 1; }
}
}
-}
\ No newline at end of file
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoAssembly.cs b/mcs/class/corlib/System.Reflection/MonoAssembly.cs
index 5b982977d83..96ded2372d3 100644
--- a/mcs/class/corlib/System.Reflection/MonoAssembly.cs
+++ b/mcs/class/corlib/System.Reflection/MonoAssembly.cs
@@ -136,6 +136,17 @@ namespace System.Reflection {
return (RuntimeAssembly) Assembly.Load (assemblyRef);
}
+
+ internal static RuntimeAssembly LoadWithPartialNameInternal (String partialName, Evidence securityEvidence, ref StackCrawlMark stackMark)
+ {
+ AssemblyName an = new AssemblyName(partialName);
+ return LoadWithPartialNameInternal (an, securityEvidence, ref stackMark);
+ }
+
+ internal static RuntimeAssembly LoadWithPartialNameInternal (AssemblyName an, Evidence securityEvidence, ref StackCrawlMark stackMark)
+ {
+ throw new NotImplementedException ("LoadWithPartialNameInternal");
+ }
}
[ComVisible (true)]
diff --git a/mcs/class/corlib/System.Reflection/MonoField.cs b/mcs/class/corlib/System.Reflection/MonoField.cs
index 117eea363fd..0e6b40607d4 100644
--- a/mcs/class/corlib/System.Reflection/MonoField.cs
+++ b/mcs/class/corlib/System.Reflection/MonoField.cs
@@ -38,6 +38,7 @@ using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
+using System.Diagnostics;
namespace System.Reflection {
@@ -54,6 +55,40 @@ namespace System.Reflection {
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern object UnsafeGetValue (object obj);
+
+ internal void CheckConsistency(Object target)
+ {
+ // only test instance fields
+ if ((Attributes & FieldAttributes.Static) != FieldAttributes.Static)
+ {
+ if (!DeclaringType.IsInstanceOfType(target))
+ {
+ if (target == null)
+ {
+#if FEATURE_LEGACYNETCF
+ if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
+ throw new ArgumentNullException(Environment.GetResourceString("RFLCT.Targ_StatFldReqTarg"));
+ else
+#endif
+ throw new TargetException(Environment.GetResourceString("RFLCT.Targ_StatFldReqTarg"));
+ }
+ else
+ {
+ throw new ArgumentException(
+ String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_FieldDeclTarget"),
+ Name, DeclaringType, target.GetType()));
+ }
+ }
+ }
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ internal void UnsafeSetValue (Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
+ {
+ bool domainInitialized = false;
+ RuntimeFieldHandle.SetValue (this, obj, value, null, Attributes, null, ref domainInitialized);
+ }
}
[Serializable]
diff --git a/mcs/class/corlib/System.Reflection/MonoMethod.cs b/mcs/class/corlib/System.Reflection/MonoMethod.cs
index c503c399b37..b8b19d873b8 100644
--- a/mcs/class/corlib/System.Reflection/MonoMethod.cs
+++ b/mcs/class/corlib/System.Reflection/MonoMethod.cs
@@ -491,6 +491,11 @@ namespace System.Reflection {
return 0;
}
}
+
+ internal void SerializationInvoke (Object target, SerializationInfo info, StreamingContext context)
+ {
+ Invoke (target, new object[] { info, context });
+ }
}
[Serializable()]
diff --git a/mcs/class/corlib/System.Reflection/MonoParameterInfo.cs b/mcs/class/corlib/System.Reflection/MonoParameterInfo.cs
index 5d99f6f7131..e2fd19f13d7 100644
--- a/mcs/class/corlib/System.Reflection/MonoParameterInfo.cs
+++ b/mcs/class/corlib/System.Reflection/MonoParameterInfo.cs
@@ -38,12 +38,17 @@ using System.Text;
namespace System.Reflection
{
+ abstract class RuntimeParameterInfo : ParameterInfo
+ {
+
+ }
+
[ComVisible (true)]
[ComDefaultInterfaceAttribute (typeof (_ParameterInfo))]
[Serializable]
[ClassInterfaceAttribute (ClassInterfaceType.None)]
[StructLayout (LayoutKind.Sequential)]
- class MonoParameterInfo : ParameterInfo {
+ class MonoParameterInfo : RuntimeParameterInfo {
#if !FULL_AOT_RUNTIME
internal MonoParameterInfo (ParameterBuilder pb, Type type, MemberInfo member, int position) {
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IInternalMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IInternalMessage.cs
index b46f89d1c75..b4ffb6ab8c7 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IInternalMessage.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IInternalMessage.cs
@@ -21,14 +21,15 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System;
-using System.Runtime.Remoting;
-
-namespace System.Runtime.Remoting.Messaging
-{
- internal interface IInternalMessage
- {
- Identity TargetIdentity { get; set; }
- string Uri { get; set; }
- }
-}
+using System;
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ internal interface IInternalMessage
+ {
+ Identity TargetIdentity { get; set; }
+ string Uri { get; set; }
+ bool HasProperties();
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs
index 957fbcda195..ab4edfcf705 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs
@@ -105,6 +105,12 @@ namespace System.Runtime.Remoting.Messaging
get { return _data; }
set { _data = value; }
}
+
+ internal CallContextRemotingData RemotingData {
+ get {
+ return _remotingData;
+ }
+ }
}
[Serializable]
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
index ad25859963f..9bb668a55dd 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
@@ -34,6 +34,7 @@ using System;
using System.Collections;
using System.Reflection;
using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
namespace System.Runtime.Remoting.Messaging {
@@ -118,6 +119,40 @@ namespace System.Runtime.Remoting.Messaging {
ResolveMethod();
}
+ internal MethodCall (Object handlerObject, BinaryMethodCallMessage smuggledMsg)
+ {
+ if (handlerObject != null)
+ {
+ _uri = handlerObject as String;
+ if (_uri == null)
+ {
+ // This must be the tranparent proxy
+ MarshalByRefObject mbr = handlerObject as MarshalByRefObject;
+ if (mbr != null)
+ {
+ throw new NotImplementedException ("MarshalByRefObject.GetIdentity");
+/*
+ bool fServer;
+ srvID = MarshalByRefObject.GetIdentity(mbr, out fServer) as ServerIdentity;
+ uri = srvID.URI;
+*/
+ }
+ }
+ }
+
+ _typeName = smuggledMsg.TypeName;
+ _methodName = smuggledMsg.MethodName;
+ _methodSignature = (Type[])smuggledMsg.MethodSignature;
+ _args = smuggledMsg.Args;
+ _genericArguments = smuggledMsg.InstantiationArgs;
+ _callContext = smuggledMsg.LogicalCallContext;
+
+ ResolveMethod();
+
+ if (smuggledMsg.HasProperties)
+ smuggledMsg.PopulateMessageProperties(Properties);
+ }
+
internal MethodCall ()
{
}
@@ -386,6 +421,11 @@ namespace System.Runtime.Remoting.Messaging {
set { _targetIdentity = value; }
}
+ bool IInternalMessage.HasProperties()
+ {
+ return (ExternalProperties != null) || (InternalProperties != null);
+ }
+
Type[] GenericArguments {
get {
if (_genericArguments != null)
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodDictionary.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodDictionary.cs
index d1f1b9e3ed7..f3f167b02df 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodDictionary.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodDictionary.cs
@@ -165,10 +165,10 @@ namespace System.Runtime.Remoting.Messaging
case "__OutArgs":
case "__Return": return;
- case "__MethodName" :
- case "__TypeName" :
- case "__MethodSignature" :
- case "__Args" : throw new ArgumentException ("key was invalid");
+ case "__MethodName" :
+ case "__TypeName" :
+ case "__MethodSignature" :
+ case "__Args" : return; //throw new ArgumentException ("key was invalid " + key);
case "__Uri": ((IInternalMessage)_message).Uri = (string) value; return;
}
}
@@ -297,7 +297,7 @@ namespace System.Runtime.Remoting.Messaging
public object Current
{
- get {return Entry.Value; }
+ get {return Entry; }
}
public bool MoveNext()
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
index 34d3bfb6b7e..9062665183f 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
@@ -35,6 +35,7 @@ using System.Collections;
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
namespace System.Runtime.Remoting.Messaging {
@@ -125,6 +126,36 @@ namespace System.Runtime.Remoting.Messaging {
CADMessageBase.UnmarshalProperties (Properties, retmsg.PropertiesCount, args);
}
+ internal MethodResponse(IMethodCallMessage msg,
+ Object handlerObject,
+ BinaryMethodReturnMessage smuggledMrm)
+ {
+ if (msg != null)
+ {
+ _methodBase = (MethodBase)msg.MethodBase;
+// _methodCache = InternalRemotingServices.GetReflectionCachedData(MI);
+
+ _methodName = msg.MethodName;
+ _uri = msg.Uri;
+// _typeName = msg.TypeName;
+
+// if (_methodCache.IsOverloaded())
+// _methodSignature = (Type[])msg.MethodSignature;
+
+// argCount = _methodCache.Parameters.Length;
+
+ }
+
+ _returnValue = smuggledMrm.ReturnValue;
+ _outArgs = smuggledMrm.Args;
+ _exception = smuggledMrm.Exception;
+
+ _callContext = smuggledMrm.LogicalCallContext;
+
+ if (smuggledMrm.HasProperties)
+ smuggledMrm.PopulateMessageProperties(Properties);
+ }
+
internal MethodResponse (SerializationInfo info, StreamingContext context)
{
foreach (SerializationEntry entry in info)
@@ -344,5 +375,10 @@ namespace System.Runtime.Remoting.Messaging {
set { _targetIdentity = value; }
}
+ bool IInternalMessage.HasProperties()
+ {
+ return (ExternalProperties != null) || (InternalProperties != null);
+ }
+
}
}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
index 00a4c46c5be..950d99f97ae 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
@@ -65,6 +65,8 @@ namespace System.Runtime.Remoting.Messaging {
Identity identity;
+ internal static String CallContextKey = "__CallContext";
+ internal static String UriKey = "__Uri";
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern void InitMessage (MonoMethod method, object [] out_args);
@@ -331,6 +333,11 @@ namespace System.Runtime.Remoting.Messaging {
set { identity = value; }
}
+ bool IInternalMessage.HasProperties()
+ {
+ return properties != null;
+ }
+
public bool IsAsync
{
get { return asyncResult != null; }
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
index 4c314c29177..8b1c7be6b6b 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
@@ -225,5 +225,14 @@ namespace System.Runtime.Remoting.Messaging
set { _targetIdentity = value; }
}
+ bool IInternalMessage.HasProperties ()
+ {
+ return _properties != null;
+ }
+
+ internal bool HasProperties ()
+ {
+ return _properties != null;
+ }
}
}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
index 7c5edb0a859..4337815c34a 100644
--- a/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
@@ -260,5 +260,9 @@ namespace System.Runtime.Remoting {
return _serverType;
}
}
+
+ internal void SetDomainID (int id)
+ {
+ }
}
}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
index 4005fa8a135..89d42d6ebda 100644
--- a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
@@ -109,6 +109,11 @@ namespace System.Runtime.Remoting
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static bool IsTransparentProxy (object proxy);
+
+ internal static bool ProxyCheckCast (RealProxy rp, RuntimeType castType)
+ {
+ throw new NotImplementedException ("ProxyCheckCast");
+ }
#endif
internal static IMethodReturnMessage InternalExecuteMessage (
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/.gitattributes b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/.gitattributes
deleted file mode 100644
index 1a37b8ffae6..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-/binary_serialization_format.htm -crlf
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs
deleted file mode 100644
index f6df7a26574..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs
+++ /dev/null
@@ -1,235 +0,0 @@
-// BinaryCommon.cs
-//
-// Author:
-// Lluis Sanchez Gual (lluis@ideary.com)
-//
-// (C) 2003 Lluis Sanchez Gual
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace System.Runtime.Serialization.Formatters.Binary
-{
- internal class BinaryCommon
- {
- // Header present in all binary serializations
- public static byte[] BinaryHeader = new Byte[] {0,1,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0};
-
- static Type[] _typeCodesToType;
- static byte[] _typeCodeMap;
- public static bool UseReflectionSerialization = false;
-
- static BinaryCommon()
- {
- _typeCodesToType = new Type [19];
- _typeCodesToType[(int)BinaryTypeCode.Boolean] = typeof (Boolean);
- _typeCodesToType[(int)BinaryTypeCode.Byte] = typeof (Byte);
- _typeCodesToType[(int)BinaryTypeCode.Char] = typeof (Char);
- _typeCodesToType[(int)BinaryTypeCode.TimeSpan] = typeof (TimeSpan);
- _typeCodesToType[(int)BinaryTypeCode.DateTime] = typeof (DateTime);
- _typeCodesToType[(int)BinaryTypeCode.Decimal] = typeof (Decimal);
- _typeCodesToType[(int)BinaryTypeCode.Double] = typeof (Double);
- _typeCodesToType[(int)BinaryTypeCode.Int16] = typeof (Int16);
- _typeCodesToType[(int)BinaryTypeCode.Int32] = typeof (Int32);
- _typeCodesToType[(int)BinaryTypeCode.Int64] = typeof (Int64);
- _typeCodesToType[(int)BinaryTypeCode.SByte] = typeof (SByte);
- _typeCodesToType[(int)BinaryTypeCode.Single] = typeof (Single);
- _typeCodesToType[(int)BinaryTypeCode.UInt16] = typeof (UInt16);
- _typeCodesToType[(int)BinaryTypeCode.UInt32] = typeof (UInt32);
- _typeCodesToType[(int)BinaryTypeCode.UInt64] = typeof (UInt64);
- _typeCodesToType[(int)BinaryTypeCode.Null] = null;
- _typeCodesToType[(int)BinaryTypeCode.String] = typeof (string);
-
- _typeCodeMap = new byte[30];
- _typeCodeMap[(int)TypeCode.Boolean] = (byte) BinaryTypeCode.Boolean;
- _typeCodeMap[(int)TypeCode.Byte] = (byte) BinaryTypeCode.Byte;
- _typeCodeMap[(int)TypeCode.Char] = (byte) BinaryTypeCode.Char;
- _typeCodeMap[(int)TypeCode.DateTime] = (byte) BinaryTypeCode.DateTime;
- _typeCodeMap[(int)TypeCode.Decimal] = (byte) BinaryTypeCode.Decimal;
- _typeCodeMap[(int)TypeCode.Double] = (byte) BinaryTypeCode.Double;
- _typeCodeMap[(int)TypeCode.Int16] = (byte) BinaryTypeCode.Int16;
- _typeCodeMap[(int)TypeCode.Int32] = (byte) BinaryTypeCode.Int32;
- _typeCodeMap[(int)TypeCode.Int64] = (byte) BinaryTypeCode.Int64;
- _typeCodeMap[(int)TypeCode.SByte] = (byte) BinaryTypeCode.SByte;
- _typeCodeMap[(int)TypeCode.Single] = (byte) BinaryTypeCode.Single;
- _typeCodeMap[(int)TypeCode.UInt16] = (byte) BinaryTypeCode.UInt16;
- _typeCodeMap[(int)TypeCode.UInt32] = (byte) BinaryTypeCode.UInt32;
- _typeCodeMap[(int)TypeCode.UInt64] = (byte) BinaryTypeCode.UInt64;
- _typeCodeMap[(int)TypeCode.String] = (byte) BinaryTypeCode.String;
-
- // TimeStamp does not have a TypeCode, so it is managed as a special
- // case in GetTypeCode()
- // This environment variable is only for test and benchmarking purposes.
- // By default, mono will always use IL generated class serializers.
- string s = Environment.GetEnvironmentVariable("MONO_REFLECTION_SERIALIZER");
- if (s == null) s = "no";
- UseReflectionSerialization = (s != "no");
- }
-
- public static bool IsPrimitive (Type type)
- {
- return (type.IsPrimitive && type != typeof (IntPtr)) ||
- type == typeof (DateTime) ||
- type == typeof (TimeSpan) ||
- type == typeof (Decimal);
- }
-
- public static byte GetTypeCode (Type type)
- {
- if (type == typeof(TimeSpan)) return (byte) BinaryTypeCode.TimeSpan;
- else return _typeCodeMap [(int)Type.GetTypeCode(type)];
- }
-
- public static Type GetTypeFromCode (int code)
- {
- return _typeCodesToType [code];
- }
-
- public static void CheckSerializable (Type type, ISurrogateSelector selector, StreamingContext context)
- {
- if (!type.IsSerializable && !type.IsInterface)
- {
- if (selector != null && selector.GetSurrogate (type, context, out selector) != null)
- return;
-
- throw new SerializationException ("Type " + type + " is not marked as Serializable.");
- }
- }
-
- public static void SwapBytes (byte[] byteArray, int size, int dataSize)
- {
- byte b;
- if (dataSize == 8) {
- for (int n=0; n List<> and friends does not work in a CoreCLR sandbox, because
- // the default deserialization code uses reflection to do its job, and the fields being reflected on live in mscorlib.dll.
- // DefaultSurrogateSelector enables embedders to provide an alternative method of deserializing specific types in a way
- // that does not violate the CoreCLR rules. See https://gist.github.com/878267 for some actual code that provides CoreCLR safe
- // deserialization code for List<> and Dictionary<,>.
- // DefaultSurrogateSelector is private, and needs to be set by the embedder trough reflection, so we do not expose any public
- // API point that is not present in .NET
- static ISurrogateSelector DefaultSurrogateSelector { get; set; }
-
- public FormatterAssemblyStyle AssemblyFormat
- {
- get {
- return(assembly_format);
- }
- set {
- assembly_format=value;
- }
- }
-
- public SerializationBinder Binder
- {
- get {
- return(binder);
- }
- set {
- binder=value;
- }
- }
-
- public StreamingContext Context
- {
- get {
- return(context);
- }
- set {
- context=value;
- }
- }
-
- public ISurrogateSelector SurrogateSelector
- {
- get {
- return(surrogate_selector);
- }
- set {
- surrogate_selector=value;
- }
- }
-
- public FormatterTypeStyle TypeFormat
- {
- get {
- return(type_format);
- }
- set {
- type_format=value;
- }
- }
-
- public TypeFilterLevel FilterLevel
- {
- get { return filter_level; }
- set { filter_level = value; }
- }
-
- [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
- public object Deserialize (Stream serializationStream)
- {
- return NoCheckDeserialize (serializationStream, null);
- }
-
- [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
- public object Deserialize (Stream serializationStream, HeaderHandler handler)
- {
- return NoCheckDeserialize (serializationStream, handler);
- }
-
- // shared by Deserialize and UnsafeDeserialize which both involve different security checks
- private object NoCheckDeserialize (Stream serializationStream, HeaderHandler handler)
- {
- if(serializationStream==null)
- {
- throw new ArgumentNullException("serializationStream");
- }
- if(serializationStream.CanSeek &&
- serializationStream.Length==0)
- {
- throw new SerializationException("serializationStream supports seeking, but its length is 0");
- }
-
- BinaryReader reader = new BinaryReader (serializationStream);
-
- bool hasHeader;
- ReadBinaryHeader (reader, out hasHeader);
-
- // Messages are read using a special static method, which does not use ObjectReader
- // if it is not needed. This saves time and memory.
-
- BinaryElement elem = (BinaryElement) reader.Read ();
-
- if (elem == BinaryElement.MethodCall) {
- return MessageFormatter.ReadMethodCall (elem, reader, hasHeader, handler, this);
- }
- else if (elem == BinaryElement.MethodResponse) {
- return MessageFormatter.ReadMethodResponse (elem, reader, hasHeader, handler, null, this);
- }
- else {
- ObjectReader serializer = new ObjectReader (this);
-
- object result;
- Header[] headers;
- serializer.ReadObjectGraph (elem, reader, hasHeader, out result, out headers);
- if (handler != null) handler(headers);
- return result;
- }
- }
-
- [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
- public object DeserializeMethodResponse (Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallMessage)
- {
- return NoCheckDeserializeMethodResponse (serializationStream, handler, methodCallMessage);
- }
-
- // shared by DeserializeMethodResponse and UnsafeDeserializeMethodResponse which both involve different security checks
- private object NoCheckDeserializeMethodResponse (Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallMessage)
- {
- if(serializationStream==null) {
- throw new ArgumentNullException("serializationStream");
- }
- if(serializationStream.CanSeek &&
- serializationStream.Length==0) {
- throw new SerializationException("serializationStream supports seeking, but its length is 0");
- }
-
- BinaryReader reader = new BinaryReader (serializationStream);
-
- bool hasHeader;
- ReadBinaryHeader (reader, out hasHeader);
- return MessageFormatter.ReadMethodResponse (reader, hasHeader, handler, methodCallMessage, this);
- }
-
- public void Serialize(Stream serializationStream, object graph)
- {
- Serialize (serializationStream, graph, null);
- }
-
- [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
- public void Serialize(Stream serializationStream, object graph, Header[] headers)
- {
- if(serializationStream==null) {
- throw new ArgumentNullException ("serializationStream");
- }
-
- BinaryWriter writer = new BinaryWriter (serializationStream);
- WriteBinaryHeader (writer, headers!=null);
-
- if (graph is IMethodCallMessage) {
- MessageFormatter.WriteMethodCall (writer, graph, headers, this);
- }
- else if (graph is IMethodReturnMessage) {
- MessageFormatter.WriteMethodResponse (writer, graph, headers, this);
- }
- else {
- ObjectWriter serializer = new ObjectWriter (this);
- serializer.WriteObjectGraph (writer, graph, headers);
- }
- writer.Flush();
- }
-
- // faster version (under CAS) as this requires a LinkDemand versus full Demand (i.e. a stack-walk)
- // shouldn't be called unless the code is intended to be executed at full-trust
- [ComVisible (false)]
- [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
- public object UnsafeDeserialize (Stream serializationStream, HeaderHandler handler)
- {
- return NoCheckDeserialize (serializationStream, handler);
- }
-
- // faster version (under CAS) as this requires a LinkDemand versus full Demand (i.e. a stack-walk)
- // shouldn't be called unless the code is intended to be executed at full-trust
- [ComVisible (false)]
- [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
- public object UnsafeDeserializeMethodResponse (Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallMessage)
- {
- return NoCheckDeserializeMethodResponse (serializationStream, handler, methodCallMessage);
- }
-
- private void WriteBinaryHeader (BinaryWriter writer, bool hasHeaders)
- {
- writer.Write ((byte)BinaryElement.Header);
- writer.Write ((int)1);
- if (hasHeaders) writer.Write ((int)2);
- else writer.Write ((int)-1);
- writer.Write ((int)1);
- writer.Write ((int)0);
- }
-
- private void ReadBinaryHeader (BinaryReader reader, out bool hasHeaders)
- {
- reader.ReadByte();
- reader.ReadInt32();
- int val = reader.ReadInt32();
- hasHeaders = (val==2);
- reader.ReadInt32();
- reader.ReadInt32();
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog
deleted file mode 100644
index 510fe781b7e..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog
+++ /dev/null
@@ -1,371 +0,0 @@
-2010-03-16 Jb Evain
-
- * BinaryCommon.cs: use MOONLIGHT symbol to disambiguate
- MonoTouch and Moonlight code.
-
-2010-02-26 Robert Jordan
-
- * 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.
-
-2009-10-31 Sebastien Pouliot
-
- * BinaryCommon.cs: Disable MONO_REFLECTION_SERIALIZER override
- for Moonlight plugin.
-
-2009-09-30 Gonzalo Paniagua Javier
-
- * 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.
-
-2009-03-29 Zoltan Varga
-
- * CodeGenerator.cs: Add synchronization as SRE is not thread safe.
-
-2008-09-17 Robert Jordan >
-
- * ObjectReader.cs (ReadTypeMetadata): Replace the check for
- ISerializable with something less `reflective'.
- Fixes #421664.
-
-2008-06-27 Andreas Nahr
-
- * BinaryFormatter.cs: Fix parameter name
-
-2008-04-26 Jb Evain
-
- * CodeGenerator.cs: replace usage of new Type [0] by
- Type.EmptyTypes. Found with Gendarme.
-
-2008-04-02 Andreas Nahr
-
- * BinaryFormatter.cs: Fix parameter names
-
-2007-08-25 Robert Jordan
-
- * ObjectReader.cs, ObjectWriter.cs, CodeGenerator.cs:
- Use DateTime.From/ToBinary. Fixes #82400.
-
-2007-08-25 Alan McGovern
-
- * ObjectReader.cs, ObjectWriter.cs, CodeGenerator.cs:
- Reverted fix for #82400.
-
-2007-08-25 Robert Jordan
-
- * ObjectReader.cs, ObjectWriter.cs, CodeGenerator.cs:
- Use DateTime.From/ToBinary. Fixes #82400.
-
-2007-08-23 Robert Jordan
-
- * 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.
-
-2007-05-03 Dick Porter
-
- * BinaryFormatter.cs: Update to 2.0 profile
-
-2006-12-25 Robert Jordan
-
- * 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.
-
-2006-12-01 Lluis Sanchez Gual
-
- * MessageFormatter.cs: Include the logical context in the message when
- throwing an exception. Fixes a compatibility issue with MS.NET.
-
-2006-10-29 Robert Jordan
-
- * ObjectWriter.cs, ObjectReader [NET_2_0]:
- Use the SerializationObjectManager.
-
-2006-09-05 Raja R Harinath
-
- 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.
-
-2005-12-07 Sebastien Pouliot
-
- * BinaryFormatter.cs: Implemented UnsafeDeserialize and
- UnsafeDeserializeMethodResponse methods. Fixes last TODO in this
- namespace (for both 1.1 and 2.0 profiles).
-
-2005-12-07 Lluis Sanchez Gual
-
- * ObjectReader.cs: Added null check in GetDeserializationType.
- Patch by Ben Maurer. Fixes bug #69666.
-
-2005-12-01 Sebastien Pouliot
-
- * BinaryFormatter.cs: Added a demand for SerializationFormatter on
- Serialize method (to make some CAS test work correctly).
-
-2005-05-26 Ben Maurer
-
- * CodeGenerator.cs: Move module creation to cctor to kill double
- checked locking and typeof locking.
-
-2005-05-17 Lluis Sanchez Gual
-
- * CodeGenerator.cs: Don't generate debug info here.
-
-2005-05-09 Lluis Sanchez Gual
-
- * ObjectWriter.cs:
- * CodeGenerator.cs: No need to add the class for inherited fields,
- since FieldInfo objects returned by the GetSerializableMembers
- method will already include the class name if needed.
-
-2005-03-23 Lluis Sanchez Gual
-
- * 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.
-
-2005-03-01 Lluis Sanchez Gual
-
- * 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.
-
-2005-02-25 Lluis Sanchez Gual
-
- * ObjectReader.cs: In ReadArrayOfPrimitiveType, added a specific
- read loop for each type. It's much faster and avoids value boxings.
-
-2005-01-10 Lluis Sanchez Gual
-
- * BinaryCommon.cs: IntPtr is not a primitive type in the serialization
- world. This fixes bug #70757.
-
-2004-12-15 Lluis Sanchez Gual
-
- * ObjectReader.cs: Use GetField instead of GetMembers. Properties can't
- be serialized, so it makes no sense to use GetMembers.
-
-2004-12-08 Zoltan Varga
-
- * CodeGenerator.cs: Call new DefineInternalDynamicAssembly method to prevent a race
- condition in the setting of the CorlibInternal flag.
-
-2004-12-06 Zoltan Varga
-
- * CodeGenerator.cs: Mark the created assembly builder as internal.
-
-2004-11-29 Lluis Sanchez Gual
-
- * CodeGenerator.cs: Addded EnumToUnderlying method to get the underlying
- type of an enum. This fixes bug #69753.
-
-2004-07-02 Lluis Sanchez Gual
-
- * BinaryCommon.cs: Added CheckSerializable method.
- * ObjectWriter.cs: Check for type serializability even for members with
- null values.
-
-2004-05-29 Gonzalo Paniagua Javier
-
- * ObjectWriter.cs: reduce contention in GetObjectData.
-
-2004-05-14 Vladimir Vukicevic
-
- * binary_serialization_format.htm: renamed filename from having
- spaces to _'s (checked with lluis)
-
-2004-05-13 Lluis Sanchez Gual
-
- * ObjectWriter.cs: Fixed and Simplified WriteGenericArray and
- WriteSingleDimensionArrayElements. This also fixes bug #58345.
-
-2004-05-03 Lluis Sanchez Gual
-
- * MessageFormatter.cs: In the all-are-primitive case, serialize Args,
- not OutArgs.
-
-2004-04-28 Lluis Sanchez Gual
-
- * MessageFormatter.cs: Serialize Args, not OutArgs, like in MS.NET.
-
-2004-04-26 Lluis Sanchez Gual
-
- * ObjectReader.cs, ObjectWriter.cs: FIXME cleaning.
-
-2004-04-20 Lluis Sanchez Gual
-
- * CodeGenerator.cs, ObjectReader.cs, ObjectWriter.cs: Serialize decimals
- as strings, like in MS.NET. This fixes bug #57186.
-
-2004-02-23 Lluis Sanchez Gual
-
- * BinaryCommon.cs: Added UseReflectionSerialization property.
- * CodeGenerator.cs, ObjectWriter.cs: When serializing the name of an
- inherited field, prefix the name with the class name. This fixes #54439.
- Moved check for reflection serialization variable to BinaryCommon.
-
-2004-02-17 Lluis Sanchez Gual
-
- * ObjectWriter.cs: Factorized some serialization code in new classes, so it
- is now possible to use fast IL generated classes that use direct access
- to class fields instead of using reflection.
- * CodeGenerator.cs: New file. Has several methods used by ObjectWriter to
- generate serialization code.
-
-2004-02-05 Lluis Sanchez Gual
-
- * ObjectWriter.cs: Get the assembly of a member from the member's type, not
- from the type of the value, because that is the type written in the
- metadata section of the object.
-
-2003-12-23 Lluis Sanchez Gual
-
- * ObjectReader.cs: Field names can include the type name if the field
- belongs to a base type. Take this into account.
-
-2003-11-26 Lluis Sanchez Gual
-
- * BinaryFormatter.cs: Added missing methods.
-
-2003-11-20 Lluis Sanchez Gual
-
- * BinaryFormatter.cs, MessageFormatter.cs, ObjectReader.cs: Added support
- for TypeFilter property.
-
-2003-11-16 Lluis Sanchez Gual
-
- * BinaryFormatter.cs, MessageFormatter.cs, ObjectWriter.cs:
- Implemented support for AssemblyFormat property.
-
-2003-11-12 Lluis Sanchez Gual
-
- * ObjectReader.cs, ObjectWriter.cs: Changed some GetType calls to "is" checks.
-
-2003-07-28 Duncan Mak
-
- * BinaryFormatter.cs (WriteBinaryHeader): changed from public to
- private.
-
-2003-07-25 Lluis Sanchez Gual
-
- * MessageFormatter.cs: WriteMethodCall(): It must write all parameters,
- including ref and out.
-
-2003-07-24 Lluis Sanchez Gual
-
- * ObjectReader.cs, ObjectWriter.cs, BinaryCommon.cs: Fixed bug #45970.
-
-2003-07-17 Lluis Sanchez Gual
-
- * 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.
-
-2003-05-13 Lluis Sanchez Gual
-
- * 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.
-
-2003-02-25 Lluis Sanchez Gual
-
- * BinaryFormatter.cs: Implemented support for binders.
- * MessageFormatter.cs: Implemented support for binders.
- * ObjectReader.cs: Implemented support for binders.
-
-2003-02-04 Lluis Sanchez Gual
-
- * MessageFormatter.cs: Fixed bug in serialization of arguments.
- * ObjectReader.cs: Fixed bug causing array of structs to fail.
-
-2003-02-11 Patrik Torstensson
-
- * ObjectReader.cs: Fixed root object bug causing object reader to return root object
- before fixup. Closes bug #37842.
-
-2003-02-04 Lluis Sanchez Gual
-
- * MessageFormatter.cs: Corrected some bugs that affected serialization of exceptions
-
-2003-02-04 Lluis Sanchez Gual
-
- * MessageFormatter.cs: Implemented serialization of message properties.
-
-2003-01-24 Martin Baulig
-
- * ObjectReader.cs (ReadNextObject): Call
- RaiseDeserializationEvent() on the ObjectManager when we're done
- reading the whole graph.
-
-2003-01-24 Lluis Sanchez Gual
-
- * 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.
-
-2003-01-17 Gonzalo Paniagua Javier
-
- * ObjectWriter.cs: make the exception message more useful.
-
-2003-01-16 Lluis Sanchez Gual
-
- * BinaryFormatter.cs: implemented Serialize and Deserialize methods.
- * ObjectReader.cs: added.
- * ObjectWriter.cs: added.
- * BinaryCommon.cs. added.
-
-2002-08-22 Nick Drochak
-
- * BinaryArrayTypeEnum.cs: Removed Non-existent enum (must have been
- from beta days)
-
-2002-08-18 Dick Porter
-
- * BinaryFormatter.cs: Stubbed out
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
deleted file mode 100644
index fd38471644b..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
+++ /dev/null
@@ -1,405 +0,0 @@
-// CodeGenerator.cs
-//
-// Author:
-// Lluis Sanchez Gual (lluis@ximian.com)
-//
-// (C) 2004 Novell, Inc
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if !FULL_AOT_RUNTIME
-using System;
-using System.IO;
-using System.Collections;
-using System.Runtime.Serialization;
-using System.Reflection;
-using System.Reflection.Emit;
-using System.Globalization;
-
-namespace System.Runtime.Serialization.Formatters.Binary
-{
- internal class CodeGenerator
- {
- // Code generation
-
- static object monitor = new object ();
-
- static ModuleBuilder _module;
-
- static CodeGenerator ()
- {
- AppDomain myDomain = System.Threading.Thread.GetDomain();
- AssemblyName myAsmName = new AssemblyName();
- myAsmName.Name = "__MetadataTypes";
-
- AssemblyBuilder myAsmBuilder = myDomain.DefineInternalDynamicAssembly (myAsmName, AssemblyBuilderAccess.Run);
- _module = myAsmBuilder.DefineDynamicModule("__MetadataTypesModule", false);
- }
-
- static public Type GenerateMetadataType (Type type, StreamingContext context) {
- /* SRE is not thread safe */
- lock (monitor) {
- return GenerateMetadataTypeInternal (type, context);
- }
- }
-
- static public Type GenerateMetadataTypeInternal (Type type, StreamingContext context)
- {
- string name = type.Name + "__TypeMetadata";
- string sufix = "";
- int n = 0;
- while (_module.GetType (name + sufix) != null)
- sufix = (++n).ToString();
-
- name += sufix;
-
- MemberInfo[] members = FormatterServices.GetSerializableMembers (type, context);
-
- TypeBuilder typeBuilder = _module.DefineType (name, TypeAttributes.Public, typeof(ClrTypeMetadata));
-
- Type[] parameters;
- MethodBuilder method;
- ILGenerator gen;
-
- // *********************
- // METHOD public constructor (Type t): base (t);
-
- parameters = Type.EmptyTypes;
-
- ConstructorBuilder ctor = typeBuilder.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard, parameters);
- ConstructorInfo baseCtor = typeof(ClrTypeMetadata).GetConstructor (new Type[] { typeof(Type) });
- gen = ctor.GetILGenerator();
-
- gen.Emit (OpCodes.Ldarg_0);
- gen.Emit (OpCodes.Ldtoken, type);
- gen.EmitCall (OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle"), null);
- gen.Emit (OpCodes.Call, baseCtor);
- gen.Emit (OpCodes.Ret);
-
- // *********************
- // METHOD public override void WriteAssemblies (ObjectWriter ow, BinaryWriter writer);
-
- parameters = new Type[] { typeof(ObjectWriter), typeof(BinaryWriter) };
- method = typeBuilder.DefineMethod ("WriteAssemblies", MethodAttributes.Public | MethodAttributes.Virtual, typeof(void), parameters);
- gen = method.GetILGenerator();
-
- foreach (FieldInfo field in members)
- {
- Type memberType = field.FieldType;
- while (memberType.IsArray)
- memberType = memberType.GetElementType();
-
- if (memberType.Assembly != ObjectWriter.CorlibAssembly)
- {
- // EMIT ow.WriteAssembly (writer, memberType.Assembly);
- gen.Emit (OpCodes.Ldarg_1);
- gen.Emit (OpCodes.Ldarg_2);
- EmitLoadTypeAssembly (gen, memberType, field.Name);
- gen.EmitCall (OpCodes.Callvirt, typeof(ObjectWriter).GetMethod("WriteAssembly"), null);
- gen.Emit (OpCodes.Pop);
- }
- }
- gen.Emit(OpCodes.Ret);
- typeBuilder.DefineMethodOverride (method, typeof(TypeMetadata).GetMethod ("WriteAssemblies"));
-
- // *********************
- // METHOD public override void WriteTypeData (ObjectWriter ow, BinaryWriter writer, bool writeTypes);
-
- parameters = new Type[] { typeof(ObjectWriter), typeof(BinaryWriter), typeof(bool) };
- method = typeBuilder.DefineMethod ("WriteTypeData", MethodAttributes.Public | MethodAttributes.Virtual, typeof(void), parameters);
- gen = method.GetILGenerator();
-
- // EMIT writer.Write (members.Length);
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldc_I4, members.Length);
- EmitWrite (gen, typeof(int));
-
- // Names of fields
- foreach (FieldInfo field in members)
- {
- // EMIT writer.Write (name);
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldstr, field.Name);
- EmitWrite (gen, typeof(string));
- }
-
- Label falseLabel = gen.DefineLabel ();
- gen.Emit (OpCodes.Ldarg_3);
- gen.Emit (OpCodes.Brfalse, falseLabel);
-
- // Types of fields
- foreach (FieldInfo field in members)
- {
- // EMIT writer.Write ((byte) ObjectWriter.GetTypeTag (type));
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldc_I4_S, (byte) ObjectWriter.GetTypeTag (field.FieldType));
- EmitWrite (gen, typeof(byte));
- }
-
- // Type specs of fields
- foreach (FieldInfo field in members)
- {
- // EMIT ow.WriteTypeSpec (writer, field.FieldType);
- EmitWriteTypeSpec (gen, field.FieldType, field.Name);
- }
- gen.MarkLabel(falseLabel);
-
- gen.Emit(OpCodes.Ret);
- typeBuilder.DefineMethodOverride (method, typeof(TypeMetadata).GetMethod ("WriteTypeData"));
-
- // *********************
- // METHOD public override void WriteObjectData (ObjectWriter ow, BinaryWriter writer, object data)
-
- parameters = new Type[] { typeof(ObjectWriter), typeof(BinaryWriter), typeof(object) };
- method = typeBuilder.DefineMethod ("WriteObjectData", MethodAttributes.Public | MethodAttributes.Virtual, typeof(void), parameters);
- gen = method.GetILGenerator();
-
- LocalBuilder localBuilder = gen.DeclareLocal (type);
- OpCode lload = OpCodes.Ldloc;
-
- gen.Emit (OpCodes.Ldarg_3);
- if (type.IsValueType)
- {
- gen.Emit (OpCodes.Unbox, type);
- LoadFromPtr (gen, type);
- lload = OpCodes.Ldloca_S;
- }
- else
- gen.Emit (OpCodes.Castclass, type);
-
- gen.Emit (OpCodes.Stloc, localBuilder);
-
- foreach (FieldInfo field in members)
- {
- // EMIT ow.WriteValue (writer, ((FieldInfo)members[n]).FieldType, values[n]);
- Type ftype = field.FieldType;
- if (BinaryCommon.IsPrimitive (ftype))
- {
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (lload, localBuilder);
- if (ftype == typeof(DateTime) || ftype == typeof(TimeSpan) || ftype == typeof(decimal))
- gen.Emit (OpCodes.Ldflda, field);
- else
- gen.Emit (OpCodes.Ldfld, field);
- EmitWritePrimitiveValue (gen, ftype);
- }
- else
- {
- gen.Emit (OpCodes.Ldarg_1);
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldtoken, ftype);
- gen.EmitCall (OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle"), null);
- gen.Emit (lload, localBuilder);
- gen.Emit (OpCodes.Ldfld, field);
- if (ftype.IsValueType)
- gen.Emit (OpCodes.Box, ftype);
- gen.EmitCall (OpCodes.Call, typeof(ObjectWriter).GetMethod("WriteValue"), null);
- }
- }
-
- gen.Emit(OpCodes.Ret);
- typeBuilder.DefineMethodOverride (method, typeof(TypeMetadata).GetMethod ("WriteObjectData"));
-
- return typeBuilder.CreateType();
- }
-
- public static void LoadFromPtr (ILGenerator ig, Type t)
- {
- if (t == typeof(int))
- ig.Emit (OpCodes.Ldind_I4);
- else if (t == typeof(uint))
- ig.Emit (OpCodes.Ldind_U4);
- else if (t == typeof(short))
- ig.Emit (OpCodes.Ldind_I2);
- else if (t == typeof(ushort))
- ig.Emit (OpCodes.Ldind_U2);
- else if (t == typeof(char))
- ig.Emit (OpCodes.Ldind_U2);
- else if (t == typeof(byte))
- ig.Emit (OpCodes.Ldind_U1);
- else if (t == typeof(sbyte))
- ig.Emit (OpCodes.Ldind_I1);
- else if (t == typeof(ulong))
- ig.Emit (OpCodes.Ldind_I8);
- else if (t == typeof(long))
- ig.Emit (OpCodes.Ldind_I8);
- else if (t == typeof(float))
- ig.Emit (OpCodes.Ldind_R4);
- else if (t == typeof(double))
- ig.Emit (OpCodes.Ldind_R8);
- else if (t == typeof(bool))
- ig.Emit (OpCodes.Ldind_I1);
- else if (t == typeof(IntPtr))
- ig.Emit (OpCodes.Ldind_I);
- else if (t.IsEnum) {
- if (t == typeof(Enum))
- ig.Emit (OpCodes.Ldind_Ref);
- else
- LoadFromPtr (ig, EnumToUnderlying (t));
- } else if (t.IsValueType)
- ig.Emit (OpCodes.Ldobj, t);
- else
- ig.Emit (OpCodes.Ldind_Ref);
- }
-
- static void EmitWriteTypeSpec (ILGenerator gen, Type type, string member)
- {
- // WARNING Keep in sync with WriteTypeSpec
-
- switch (ObjectWriter.GetTypeTag (type))
- {
- case TypeTag.PrimitiveType:
- // EMIT writer.Write (BinaryCommon.GetTypeCode (type));
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldc_I4_S, (byte) BinaryCommon.GetTypeCode (type));
- EmitWrite (gen, typeof(byte));
- break;
-
- case TypeTag.RuntimeType:
- // EMIT writer.Write (type.FullName);
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldstr, type.FullName);
- EmitWrite (gen, typeof(string));
- break;
-
- case TypeTag.GenericType:
- // EMIT writer.Write (type.FullName);
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldstr, type.FullName);
- EmitWrite (gen, typeof(string));
-
- // EMIT writer.Write ((int)ow.GetAssemblyId (type.Assembly));
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldarg_1);
- EmitLoadTypeAssembly (gen, type, member);
- gen.EmitCall (OpCodes.Callvirt, typeof(ObjectWriter).GetMethod("GetAssemblyId"), null);
- gen.Emit (OpCodes.Conv_I4);
- EmitWrite (gen, typeof(int));
- break;
-
- case TypeTag.ArrayOfPrimitiveType:
- // EMIT writer.Write (BinaryCommon.GetTypeCode (type.GetElementType()));
- gen.Emit (OpCodes.Ldarg_2);
- gen.Emit (OpCodes.Ldc_I4_S, (byte) BinaryCommon.GetTypeCode (type.GetElementType()));
- EmitWrite (gen, typeof(byte));
- break;
-
- default:
- // Type spec not needed
- break;
- }
- }
-
- static void EmitLoadTypeAssembly (ILGenerator gen, Type type, string member)
- {
- gen.Emit (OpCodes.Ldtoken, type);
- gen.EmitCall (OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle"), null);
- gen.EmitCall (OpCodes.Callvirt, typeof(Type).GetProperty("Assembly").GetGetMethod(), null);
- }
-
- static void EmitWrite (ILGenerator gen, Type type)
- {
- gen.EmitCall (OpCodes.Callvirt, typeof(BinaryWriter).GetMethod("Write", new Type[] { type }), null);
- }
-
- public static void EmitWritePrimitiveValue (ILGenerator gen, Type type)
- {
- switch (Type.GetTypeCode (type))
- {
- case TypeCode.Boolean:
- case TypeCode.Byte:
- case TypeCode.Char:
- case TypeCode.Double:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.SByte:
- case TypeCode.Single:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- case TypeCode.String:
- EmitWrite (gen, type);
- break;
-
- case TypeCode.Decimal:
- // writer.Write (val.ToString (CultureInfo.InvariantCulture));
- gen.EmitCall (OpCodes.Call, typeof(CultureInfo).GetProperty("InvariantCulture").GetGetMethod(), null);
- gen.EmitCall (OpCodes.Call, typeof(Decimal).GetMethod("ToString", new Type[] {typeof(IFormatProvider)}), null);
- EmitWrite (gen, typeof(string));
- break;
-
- case TypeCode.DateTime:
- gen.EmitCall (OpCodes.Call, typeof(DateTime).GetMethod("ToBinary", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance), null);
- EmitWrite (gen, typeof(long));
- break;
-
- default:
- if (type == typeof (TimeSpan)) {
- gen.EmitCall (OpCodes.Call, typeof(TimeSpan).GetProperty("Ticks").GetGetMethod(), null);
- EmitWrite (gen, typeof(long));
- }
- else
- throw new NotSupportedException ("Unsupported primitive type: " + type.FullName);
- break;
- }
- }
-
- //
- // This is needed, because enumerations from assemblies
- // do not report their underlyingtype, but they report
- // themselves
- //
- public static Type EnumToUnderlying (Type t)
- {
- TypeCode tc = Type.GetTypeCode (t);
-
- switch (tc){
- case TypeCode.Boolean:
- return typeof (bool);
- case TypeCode.Byte:
- return typeof (byte);
- case TypeCode.SByte:
- return typeof (sbyte);
- case TypeCode.Char:
- return typeof (char);
- case TypeCode.Int16:
- return typeof (short);
- case TypeCode.UInt16:
- return typeof (ushort);
- case TypeCode.Int32:
- return typeof (int);
- case TypeCode.UInt32:
- return typeof (uint);
- case TypeCode.Int64:
- return typeof (long);
- case TypeCode.UInt64:
- return typeof (ulong);
- }
- throw new Exception ("Unhandled typecode in enum " + tc + " from " + t.AssemblyQualifiedName);
- }
- }
- }
-
-#endif
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs
deleted file mode 100644
index 6bae636035a..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs
+++ /dev/null
@@ -1,504 +0,0 @@
-//
-// System.Runtime.Remoting.MessageFormatter.cs
-//
-// Author: Lluis Sanchez Gual (lluis@ideary.com)
-//
-// (C) 2003, Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Collections;
-using System.Runtime.Remoting;
-using System.Runtime.Serialization;
-using System.Runtime.Remoting.Messaging;
-
-namespace System.Runtime.Serialization.Formatters.Binary
-{
- internal class MessageFormatter
- {
- public static void WriteMethodCall (BinaryWriter writer, object obj, Header[] headers, BinaryFormatter formatter)
- {
- IMethodCallMessage call = (IMethodCallMessage)obj;
- writer.Write ((byte) BinaryElement.MethodCall);
-
- MethodFlags methodFlags;
- int infoArraySize = 0;
- object info = null;
- object[] extraProperties = null;
-
- if (call.LogicalCallContext != null && call.LogicalCallContext.HasInfo)
- {
- methodFlags = MethodFlags.IncludesLogicalCallContext;
- infoArraySize++;
- }
- else
- methodFlags = MethodFlags.ExcludeLogicalCallContext;
-
- if (RemotingServices.IsMethodOverloaded (call))
- {
- infoArraySize++;
- methodFlags |= MethodFlags.IncludesSignature;
- }
-
- if (call.Properties.Count > MethodCallDictionary.InternalKeys.Length)
- {
- extraProperties = GetExtraProperties (call.Properties, MethodCallDictionary.InternalKeys);
- infoArraySize++;
- }
-
- if (call.MethodBase.IsGenericMethod) {
- infoArraySize++;
- methodFlags |= MethodFlags.GenericArguments;
- }
- if (call.ArgCount == 0)
- methodFlags |= MethodFlags.NoArguments;
- else {
- if (AllTypesArePrimitive (call.Args))
- methodFlags |= MethodFlags.PrimitiveArguments;
- else {
- if (infoArraySize == 0)
- methodFlags |= MethodFlags.ArgumentsInSimpleArray;
- else {
- methodFlags |= MethodFlags.ArgumentsInMultiArray;
- infoArraySize++;
- }
- }
- }
-
- writer.Write ((int) methodFlags);
-
- // Method name
- writer.Write ((byte) BinaryTypeCode.String);
- writer.Write (call.MethodName);
-
- // Class name
- writer.Write ((byte) BinaryTypeCode.String);
- writer.Write (call.TypeName);
-
- // Arguments
-
- if ((methodFlags & MethodFlags.PrimitiveArguments) > 0)
- {
- writer.Write ((uint)call.Args.Length);
- for (int n=0; n 0)
- {
- object[] ainfo = new object[infoArraySize];
- int n=0;
- if ((methodFlags & MethodFlags.ArgumentsInMultiArray) > 0) ainfo[n++] = call.Args;
- if ((methodFlags & MethodFlags.GenericArguments) > 0) ainfo[n++] = call.MethodBase.GetGenericArguments ();
- if ((methodFlags & MethodFlags.IncludesSignature) > 0) ainfo[n++] = call.MethodSignature;
- if ((methodFlags & MethodFlags.IncludesLogicalCallContext) > 0) ainfo[n++] = call.LogicalCallContext;
- if (extraProperties != null) ainfo[n++] = extraProperties;
- info = ainfo;
- }
- else if ((methodFlags & MethodFlags.ArgumentsInSimpleArray) > 0)
- info = call.Args;
-
- if (info != null)
- {
- ObjectWriter objectWriter = new ObjectWriter (formatter);
- objectWriter.WriteObjectGraph (writer, info, headers);
- }
- else
- writer.Write ((byte) BinaryElement.End);
- }
-
- public static void WriteMethodResponse (BinaryWriter writer, object obj, Header[] headers, BinaryFormatter formatter)
- {
- IMethodReturnMessage resp = (IMethodReturnMessage)obj;
- writer.Write ((byte) BinaryElement.MethodResponse);
-
- string[] internalProperties = MethodReturnDictionary.InternalReturnKeys;
-
- int infoArrayLength = 0;
- object info = null;
- object[] extraProperties = null;
-
- // Type of return value
-
- ReturnTypeTag returnTypeTag;
- MethodFlags contextFlag = MethodFlags.ExcludeLogicalCallContext;
-
- if (resp.Exception != null) {
- returnTypeTag = ReturnTypeTag.Exception | ReturnTypeTag.Null;
- internalProperties = MethodReturnDictionary.InternalExceptionKeys;
- infoArrayLength = 1;
- }
- else if (resp.ReturnValue == null) {
- returnTypeTag = ReturnTypeTag.Null;
- }
- else if (IsMethodPrimitive(resp.ReturnValue.GetType())) {
- returnTypeTag = ReturnTypeTag.PrimitiveType;
- }
- else {
- returnTypeTag = ReturnTypeTag.ObjectType;
- infoArrayLength++;
- }
-
- // Message flags
-
- MethodFlags formatFlag;
-
- if ((resp.LogicalCallContext != null) && resp.LogicalCallContext.HasInfo)
- {
- contextFlag = MethodFlags.IncludesLogicalCallContext;
- infoArrayLength++;
- }
-
- if (resp.Properties.Count > internalProperties.Length && ((returnTypeTag & ReturnTypeTag.Exception) == 0))
- {
- extraProperties = GetExtraProperties (resp.Properties, internalProperties);
- infoArrayLength++;
- }
-
- if (resp.OutArgCount == 0)
- formatFlag = MethodFlags.NoArguments;
- else
- {
- if (AllTypesArePrimitive (resp.Args))
- formatFlag = MethodFlags.PrimitiveArguments;
- else
- {
- if (infoArrayLength == 0)
- formatFlag = MethodFlags.ArgumentsInSimpleArray;
- else {
- formatFlag = MethodFlags.ArgumentsInMultiArray;
- infoArrayLength++;
- }
- }
- }
-
- writer.Write ((byte) (contextFlag | formatFlag));
- writer.Write ((byte) returnTypeTag);
-
- // FIXME: what are the following 2 bytes for?
- writer.Write ((byte) 0);
- writer.Write ((byte) 0);
-
- // Arguments
-
- if (returnTypeTag == ReturnTypeTag.PrimitiveType)
- {
- writer.Write (BinaryCommon.GetTypeCode (resp.ReturnValue.GetType()));
- ObjectWriter.WritePrimitiveValue (writer, resp.ReturnValue);
- }
-
- if (formatFlag == MethodFlags.PrimitiveArguments)
- {
- writer.Write ((uint)resp.ArgCount);
- for (int n=0; n 0)
- {
- object[] infoArray = new object[infoArrayLength];
- int n = 0;
-
- if ((returnTypeTag & ReturnTypeTag.Exception) != 0)
- infoArray[n++] = resp.Exception;
-
- if (formatFlag == MethodFlags.ArgumentsInMultiArray)
- infoArray[n++] = resp.Args;
-
- if (returnTypeTag == ReturnTypeTag.ObjectType)
- infoArray[n++] = resp.ReturnValue;
-
- if (contextFlag == MethodFlags.IncludesLogicalCallContext)
- infoArray[n++] = resp.LogicalCallContext;
-
- if (extraProperties != null)
- infoArray[n++] = extraProperties;
-
- info = infoArray;
- }
- else if ((formatFlag & MethodFlags.ArgumentsInSimpleArray) > 0)
- info = resp.Args;
-
- if (info != null)
- {
- ObjectWriter objectWriter = new ObjectWriter (formatter);
- objectWriter.WriteObjectGraph (writer, info, headers);
- }
- else
- writer.Write ((byte) BinaryElement.End);
- }
-
- public static object ReadMethodCall (BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, BinaryFormatter formatter)
- {
- BinaryElement elem = (BinaryElement)reader.ReadByte(); // The element code
- return ReadMethodCall (elem, reader, hasHeaders, headerHandler, formatter);
- }
-
- public static object ReadMethodCall (BinaryElement elem, BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, BinaryFormatter formatter)
- {
- if (elem != BinaryElement.MethodCall) throw new SerializationException("Invalid format. Expected BinaryElement.MethodCall, found " + elem);
-
- MethodFlags flags = (MethodFlags) reader.ReadInt32();
-
- if (((BinaryTypeCode)reader.ReadByte()) != BinaryTypeCode.String) throw new SerializationException ("Invalid format");
- string methodName = reader.ReadString();
-
- if (((BinaryTypeCode)reader.ReadByte()) != BinaryTypeCode.String) throw new SerializationException ("Invalid format");
- string className = reader.ReadString();
-
- //bool hasContextInfo = (flags & MethodFlags.IncludesLogicalCallContext) > 0;
-
- object[] arguments = null;
- object methodSignature = null;
- object callContext = null;
- object[] extraProperties = null;
- Header[] headers = null;
- Type[] genericArguments = null;
-
- if ((flags & MethodFlags.PrimitiveArguments) > 0)
- {
- uint count = reader.ReadUInt32();
- arguments = new object[count];
- for (int n=0; n 0)
- {
- ObjectReader objectReader = new ObjectReader (formatter);
-
- object result;
- objectReader.ReadObjectGraph (reader, hasHeaders, out result, out headers);
- object[] msgInfo = (object[]) result;
-
- if ((flags & MethodFlags.ArgumentsInSimpleArray) > 0) {
- arguments = msgInfo;
- }
- else
- {
- int n = 0;
- if ((flags & MethodFlags.ArgumentsInMultiArray) > 0) {
- if (msgInfo.Length > 1) arguments = (object[]) msgInfo[n++];
- else arguments = new object[0];
- }
-
- if ((flags & MethodFlags.GenericArguments) > 0)
- genericArguments = (Type[]) msgInfo[n++];
-
- if ((flags & MethodFlags.IncludesSignature) > 0)
- methodSignature = msgInfo[n++];
-
- if ((flags & MethodFlags.IncludesLogicalCallContext) > 0)
- callContext = msgInfo[n++];
-
- if (n < msgInfo.Length)
- extraProperties = (object[]) msgInfo[n];
- }
- }
- else {
- reader.ReadByte (); // Reads the stream ender
- }
-
- if (arguments == null) arguments = new object[0];
-
- string uri = null;
- if (headerHandler != null)
- uri = headerHandler(headers) as string;
-
- Header[] methodInfo = new Header[7];
- methodInfo[0] = new Header("__MethodName", methodName);
- methodInfo[1] = new Header("__MethodSignature", methodSignature);
- methodInfo[2] = new Header("__TypeName", className);
- methodInfo[3] = new Header("__Args", arguments);
- methodInfo[4] = new Header("__CallContext", callContext);
- methodInfo[5] = new Header("__Uri", uri);
- methodInfo[6] = new Header("__GenericArguments", genericArguments);
-
- MethodCall call = new MethodCall (methodInfo);
-
- if (extraProperties != null) {
- foreach (DictionaryEntry entry in extraProperties)
- call.Properties [(string)entry.Key] = entry.Value;
- }
-
- return call;
- }
-
- public static object ReadMethodResponse (BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, IMethodCallMessage methodCallMessage, BinaryFormatter formatter)
- {
- BinaryElement elem = (BinaryElement) reader.ReadByte ();
- return ReadMethodResponse (elem, reader, hasHeaders, headerHandler, methodCallMessage, formatter);
- }
-
- public static object ReadMethodResponse (BinaryElement elem, BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, IMethodCallMessage methodCallMessage, BinaryFormatter formatter)
- {
- if (elem != BinaryElement.MethodResponse) throw new SerializationException("Invalid format. Expected BinaryElement.MethodResponse, found " + elem);
-
- MethodFlags flags = (MethodFlags) reader.ReadByte ();
- ReturnTypeTag typeTag = (ReturnTypeTag) reader.ReadByte ();
- bool hasContextInfo = (flags & MethodFlags.IncludesLogicalCallContext) > 0;
-
- // FIXME: find a meaning for those 2 bytes
- reader.ReadByte();
- reader.ReadByte();
-
- object returnValue = null;
- object[] outArgs = null;
- LogicalCallContext callContext = null;
- Exception exception = null;
- object[] extraProperties = null;
- Header[] headers = null;
-
- if ((typeTag & ReturnTypeTag.PrimitiveType) > 0)
- {
- Type type = BinaryCommon.GetTypeFromCode (reader.ReadByte());
- returnValue = ObjectReader.ReadPrimitiveTypeValue (reader, type);
- }
-
- if ((flags & MethodFlags.PrimitiveArguments) > 0)
- {
- uint count = reader.ReadUInt32();
- outArgs = new object[count];
- for (int n=0; n 0 ||
- (typeTag & ReturnTypeTag.Exception) > 0 ||
- (flags & MethodFlags.ArgumentsInSimpleArray) > 0 ||
- (flags & MethodFlags.ArgumentsInMultiArray) > 0)
- {
- // There objects that need to be deserialized using an ObjectReader
-
- ObjectReader objectReader = new ObjectReader (formatter);
- object result;
- objectReader.ReadObjectGraph (reader, hasHeaders, out result, out headers);
- object[] msgInfo = (object[]) result;
-
- if ((typeTag & ReturnTypeTag.Exception) > 0) {
- exception = (Exception) msgInfo[0];
- if (hasContextInfo) callContext = (LogicalCallContext)msgInfo[1];
- }
- else if ((flags & MethodFlags.NoArguments) > 0 || (flags & MethodFlags.PrimitiveArguments) > 0) {
- int n = 0;
- if ((typeTag & ReturnTypeTag.ObjectType) > 0) returnValue = msgInfo [n++];
- if (hasContextInfo) callContext = (LogicalCallContext)msgInfo[n++];
- if (n < msgInfo.Length) extraProperties = (object[]) msgInfo[n];
- }
- else if ((flags & MethodFlags.ArgumentsInSimpleArray) > 0) {
- outArgs = msgInfo;
- }
- else {
- int n = 0;
- outArgs = (object[]) msgInfo[n++];
- if ((typeTag & ReturnTypeTag.ObjectType) > 0) returnValue = msgInfo[n++];
- if (hasContextInfo) callContext = (LogicalCallContext)msgInfo[n++];
- if (n < msgInfo.Length) extraProperties = (object[]) msgInfo[n];
- }
- }
- else {
- reader.ReadByte (); // Reads the stream ender
- }
-
- if (headerHandler != null)
- headerHandler(headers);
-
- if (exception != null)
- return new ReturnMessage (exception, methodCallMessage);
- else
- {
- int argCount = (outArgs!=null) ? outArgs.Length : 0;
- ReturnMessage result = new ReturnMessage (returnValue, outArgs, argCount, callContext, methodCallMessage);
-
- if (extraProperties != null) {
- foreach (DictionaryEntry entry in extraProperties)
- result.Properties [(string)entry.Key] = entry.Value;
- }
-
- return result;
- }
- }
-
- private static bool AllTypesArePrimitive(object[] objects)
- {
- foreach (object ob in objects)
- {
- if (ob != null && !IsMethodPrimitive(ob.GetType()))
- return false;
- }
- return true;
- }
-
- // When serializing methods, string are considered primitive types
- public static bool IsMethodPrimitive (Type type)
- {
- return type.IsPrimitive || type == typeof(string) || type == typeof (DateTime) || type == typeof (Decimal);
- }
-
- static object[] GetExtraProperties (IDictionary properties, string[] internalKeys)
- {
- object[] extraProperties = new object [properties.Count - internalKeys.Length];
-
- int n = 0;
- IDictionaryEnumerator e = properties.GetEnumerator();
- while (e.MoveNext())
- if (!IsInternalKey ((string) e.Entry.Key, internalKeys)) extraProperties [n++] = e.Entry;
-
- return extraProperties;
- }
-
- static bool IsInternalKey (string key, string[] internalKeys)
- {
- foreach (string ikey in internalKeys)
- if (key == ikey) return true;
- return false;
- }
-
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
deleted file mode 100644
index e3962a3b715..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
+++ /dev/null
@@ -1,994 +0,0 @@
-// ObjectReader.cs
-//
-// Author:
-// Lluis Sanchez Gual (lluis@ideary.com)
-// Patrik Torstensson
-//
-// (C) 2003 Lluis Sanchez Gual
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.Serialization;
-using System.IO;
-using System.Collections;
-using System.Reflection;
-using System.Runtime.Remoting.Messaging;
-using System.Globalization;
-
-namespace System.Runtime.Serialization.Formatters.Binary
-{
- internal class ObjectReader
- {
-// BinaryFormatter _formatter;
- ISurrogateSelector _surrogateSelector;
- StreamingContext _context;
- SerializationBinder _binder;
-
- TypeFilterLevel _filterLevel;
-
- ObjectManager _manager;
- Hashtable _registeredAssemblies = new Hashtable();
- Hashtable _typeMetadataCache = new Hashtable();
-
- object _lastObject = null;
- long _lastObjectID = 0;
- long _rootObjectID = 0;
- byte[] arrayBuffer;
- int ArrayBufferLength = 4096;
-
- class TypeMetadata
- {
- public Type Type;
- public Type[] MemberTypes;
- public string[] MemberNames;
- public MemberInfo[] MemberInfos;
- public int FieldCount;
- public bool NeedsSerializationInfo;
- }
-
- class ArrayNullFiller
- {
- public ArrayNullFiller(int count) { NullCount = count; }
- public int NullCount;
- }
-
- public ObjectReader (BinaryFormatter formatter)
- {
-// _formatter = formatter;
- _surrogateSelector = formatter.SurrogateSelector;
- _context = formatter.Context;
- _binder = formatter.Binder;
- _manager = new ObjectManager (_surrogateSelector, _context);
-
- _filterLevel = formatter.FilterLevel;
- }
-
- public void ReadObjectGraph (BinaryReader reader, bool readHeaders, out object result, out Header[] headers)
- {
- BinaryElement elem = (BinaryElement)reader.ReadByte ();
- ReadObjectGraph (elem, reader, readHeaders, out result, out headers);
- }
-
- public void ReadObjectGraph (BinaryElement elem, BinaryReader reader, bool readHeaders, out object result, out Header[] headers)
- {
- headers = null;
-
- // Reads the objects. The first object in the stream is the
- // root object.
- bool next = ReadNextObject (elem, reader);
- if (next) {
- do {
- if (readHeaders && (headers == null))
- headers = (Header[])CurrentObject;
- else
- if (_rootObjectID == 0) _rootObjectID = _lastObjectID;
- } while (ReadNextObject (reader));
- }
-
- result = _manager.GetObject (_rootObjectID);
- }
-
- bool ReadNextObject (BinaryElement element, BinaryReader reader)
- {
- if (element == BinaryElement.End)
- {
- _manager.DoFixups();
-
- _manager.RaiseDeserializationEvent();
- return false;
- }
-
- SerializationInfo info;
- long objectId;
-
- ReadObject (element, reader, out objectId, out _lastObject, out info);
-
- if (objectId != 0) {
- RegisterObject (objectId, _lastObject, info, 0, null, null);
- _lastObjectID = objectId;
- }
-
- return true;
- }
-
- public bool ReadNextObject (BinaryReader reader)
- {
- BinaryElement element = (BinaryElement)reader.ReadByte ();
- if (element == BinaryElement.End)
- {
- _manager.DoFixups();
-
- _manager.RaiseDeserializationEvent();
- return false;
- }
-
- SerializationInfo info;
- long objectId;
-
- ReadObject (element, reader, out objectId, out _lastObject, out info);
-
- if (objectId != 0) {
- RegisterObject (objectId, _lastObject, info, 0, null, null);
- _lastObjectID = objectId;
- }
-
- return true;
- }
-
- public object CurrentObject
- {
- get { return _lastObject; }
- }
-
- // Reads an object from the stream. The object is registered in the ObjectManager.
- // The result can be either the object instance
- // or the id of the object (when what is found in the stream is an object reference).
- // If an object instance is read, the objectId is set to 0.
-
- private void ReadObject (BinaryElement element, BinaryReader reader, out long objectId, out object value, out SerializationInfo info)
- {
- switch (element)
- {
- case BinaryElement.RefTypeObject:
- ReadRefTypeObjectInstance (reader, out objectId, out value, out info);
- break;
-
- case BinaryElement.UntypedRuntimeObject:
- ReadObjectInstance (reader, true, false, out objectId, out value, out info);
- break;
-
- case BinaryElement.UntypedExternalObject:
- ReadObjectInstance (reader, false, false, out objectId, out value, out info);
- break;
-
- case BinaryElement.RuntimeObject:
- ReadObjectInstance (reader, true, true, out objectId, out value, out info);
- break;
-
- case BinaryElement.ExternalObject:
- ReadObjectInstance (reader, false, true, out objectId, out value, out info);
- break;
-
- case BinaryElement.String:
- info = null;
- ReadStringIntance (reader, out objectId, out value);
- break;
-
- case BinaryElement.GenericArray:
- info = null;
- ReadGenericArray (reader, out objectId, out value);
- break;
-
-
- case BinaryElement.BoxedPrimitiveTypeValue:
- value = ReadBoxedPrimitiveTypeValue (reader);
- objectId = 0;
- info = null;
- break;
-
- case BinaryElement.NullValue:
- value = null;
- objectId = 0;
- info = null;
- break;
-
- case BinaryElement.Assembly:
- ReadAssembly (reader);
- ReadObject ((BinaryElement)reader.ReadByte (), reader, out objectId, out value, out info);
- break;
-
- case BinaryElement.ArrayFiller8b:
- value = new ArrayNullFiller(reader.ReadByte());
- objectId = 0;
- info = null;
- break;
-
- case BinaryElement.ArrayFiller32b:
- value = new ArrayNullFiller(reader.ReadInt32());
- objectId = 0;
- info = null;
- break;
-
- case BinaryElement.ArrayOfPrimitiveType:
- ReadArrayOfPrimitiveType (reader, out objectId, out value);
- info = null;
- break;
-
- case BinaryElement.ArrayOfObject:
- ReadArrayOfObject (reader, out objectId, out value);
- info = null;
- break;
-
- case BinaryElement.ArrayOfString:
- ReadArrayOfString (reader, out objectId, out value);
- info = null;
- break;
-
- default:
- throw new SerializationException ("Unexpected binary element: " + (int)element);
- }
- }
-
- private void ReadAssembly (BinaryReader reader)
- {
- long id = (long) reader.ReadUInt32 ();
- string assemblyName = reader.ReadString ();
- _registeredAssemblies [id] = assemblyName;
- }
-
- private void ReadObjectInstance (BinaryReader reader, bool isRuntimeObject, bool hasTypeInfo, out long objectId, out object value, out SerializationInfo info)
- {
- objectId = (long) reader.ReadUInt32 ();
-
- TypeMetadata metadata = ReadTypeMetadata (reader, isRuntimeObject, hasTypeInfo);
- ReadObjectContent (reader, metadata, objectId, out value, out info);
- }
-
- private void ReadRefTypeObjectInstance (BinaryReader reader, out long objectId, out object value, out SerializationInfo info)
- {
- objectId = (long) reader.ReadUInt32 ();
- long refTypeObjectId = (long) reader.ReadUInt32 ();
-
- // Gets the type of the referred object and its metadata
-
- object refObj = _manager.GetObject (refTypeObjectId);
- if (refObj == null) throw new SerializationException ("Invalid binary format");
- TypeMetadata metadata = (TypeMetadata)_typeMetadataCache [refObj.GetType()];
-
- ReadObjectContent (reader, metadata, objectId, out value, out info);
- }
-
- private void ReadObjectContent (BinaryReader reader, TypeMetadata metadata, long objectId, out object objectInstance, out SerializationInfo info)
- {
- if (_filterLevel == TypeFilterLevel.Low)
- objectInstance = FormatterServices.GetSafeUninitializedObject (metadata.Type);
- else
- objectInstance = FormatterServices.GetUninitializedObject (metadata.Type);
- _manager.RaiseOnDeserializingEvent (objectInstance);
-
- info = metadata.NeedsSerializationInfo ? new SerializationInfo(metadata.Type, new FormatterConverter()) : null;
-
- if (metadata.MemberNames != null) {
- for (int n=0; n= 0; dim--)
- indices[dim] = array.GetLowerBound (dim);
-
- bool end = false;
- while (!end)
- {
- ReadValue (reader, array, objectId, null, elementType, null, null, indices);
-
- for (int dim = array.Rank-1; dim >= 0; dim--)
- {
- indices[dim]++;
- if (indices[dim] > array.GetUpperBound (dim))
- {
- if (dim > 0)
- {
- indices[dim] = array.GetLowerBound (dim);
- continue; // Increment the next dimension's index
- }
- end = true; // That was the last dimension. Finished.
- }
- break;
- }
- }
- val = array;
- }
-
- private object ReadBoxedPrimitiveTypeValue (BinaryReader reader)
- {
- Type type = ReadType (reader, TypeTag.PrimitiveType);
- return ReadPrimitiveTypeValue (reader, type);
- }
-
- private void ReadArrayOfPrimitiveType (BinaryReader reader, out long objectId, out object val)
- {
- objectId = (long) reader.ReadUInt32 ();
- int length = reader.ReadInt32 ();
- Type elementType = ReadType (reader, TypeTag.PrimitiveType);
-
- switch (Type.GetTypeCode (elementType))
- {
- case TypeCode.Boolean: {
- bool[] arr = new bool [length];
- for (int n = 0; n < length; n++) arr [n] = reader.ReadBoolean();
- val = arr;
- break;
- }
-
- case TypeCode.Byte: {
- byte[] arr = new byte [length];
- int pos = 0;
- while (pos < length) {
- int nr = reader.Read (arr, pos, length - pos);
- if (nr == 0) break;
- pos += nr;
- }
- val = arr;
- break;
- }
-
- case TypeCode.Char: {
- char[] arr = new char [length];
- int pos = 0;
- while (pos < length) {
- int nr = reader.Read (arr, pos, length - pos);
- if (nr == 0) break;
- pos += nr;
- }
- val = arr;
- break;
- }
-
- case TypeCode.DateTime: {
- DateTime[] arr = new DateTime [length];
- for (int n = 0; n < length; n++) {
- arr [n] = DateTime.FromBinary (reader.ReadInt64 ());
- }
- val = arr;
- break;
- }
-
- case TypeCode.Decimal: {
- Decimal[] arr = new Decimal [length];
- for (int n = 0; n < length; n++) arr [n] = reader.ReadDecimal();
- val = arr;
- break;
- }
-
- case TypeCode.Double: {
- Double[] arr = new Double [length];
- if (length > 2)
- BlockRead (reader, arr, 8);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadDouble();
- val = arr;
- break;
- }
-
- case TypeCode.Int16: {
- short[] arr = new short [length];
- if (length > 2)
- BlockRead (reader, arr, 2);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadInt16();
- val = arr;
- break;
- }
-
- case TypeCode.Int32: {
- int[] arr = new int [length];
- if (length > 2)
- BlockRead (reader, arr, 4);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadInt32();
- val = arr;
- break;
- }
-
- case TypeCode.Int64: {
- long[] arr = new long [length];
- if (length > 2)
- BlockRead (reader, arr, 8);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadInt64();
- val = arr;
- break;
- }
-
- case TypeCode.SByte: {
- sbyte[] arr = new sbyte [length];
- if (length > 2)
- BlockRead (reader, arr, 1);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadSByte();
- val = arr;
- break;
- }
-
- case TypeCode.Single: {
- float[] arr = new float [length];
- if (length > 2)
- BlockRead (reader, arr, 4);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadSingle();
- val = arr;
- break;
- }
-
- case TypeCode.UInt16: {
- ushort[] arr = new ushort [length];
- if (length > 2)
- BlockRead (reader, arr, 2);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadUInt16();
- val = arr;
- break;
- }
-
- case TypeCode.UInt32: {
- uint[] arr = new uint [length];
- if (length > 2)
- BlockRead (reader, arr, 4);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadUInt32();
- val = arr;
- break;
- }
-
- case TypeCode.UInt64: {
- ulong[] arr = new ulong [length];
- if (length > 2)
- BlockRead (reader, arr, 8);
- else
- for (int n = 0; n < length; n++) arr [n] = reader.ReadUInt64();
- val = arr;
- break;
- }
-
- case TypeCode.String: {
- string[] arr = new string [length];
- for (int n = 0; n < length; n++) arr [n] = reader.ReadString();
- val = arr;
- break;
- }
-
- default: {
- if (elementType == typeof(TimeSpan)) {
- TimeSpan[] arr = new TimeSpan [length];
- for (int n = 0; n < length; n++) arr [n] = new TimeSpan (reader.ReadInt64 ());
- val = arr;
- }
- else
- throw new NotSupportedException ("Unsupported primitive type: " + elementType.FullName);
- break;
- }
- }
- }
-
- private void BlockRead (BinaryReader reader, Array array, int dataSize)
- {
- int totalSize = Buffer.ByteLength (array);
-
- if (arrayBuffer == null || (totalSize > arrayBuffer.Length && arrayBuffer.Length != ArrayBufferLength))
- arrayBuffer = new byte [totalSize <= ArrayBufferLength ? totalSize : ArrayBufferLength];
-
- int pos = 0;
- while (totalSize > 0) {
- int size = totalSize < arrayBuffer.Length ? totalSize : arrayBuffer.Length;
- int ap = 0;
- do {
- int nr = reader.Read (arrayBuffer, ap, size - ap);
- if (nr == 0) break;
- ap += nr;
- } while (ap < size);
-
- if (!BitConverter.IsLittleEndian && dataSize > 1)
- BinaryCommon.SwapBytes (arrayBuffer, size, dataSize);
-
- Buffer.BlockCopy (arrayBuffer, 0, array, pos, size);
- totalSize -= size;
- pos += size;
- }
- }
-
-
- private void ReadArrayOfObject (BinaryReader reader, out long objectId, out object array)
- {
- ReadSimpleArray (reader, typeof (object), out objectId, out array);
- }
-
- private void ReadArrayOfString (BinaryReader reader, out long objectId, out object array)
- {
- ReadSimpleArray (reader, typeof (string), out objectId, out array);
- }
-
- private void ReadSimpleArray (BinaryReader reader, Type elementType, out long objectId, out object val)
- {
- objectId = (long) reader.ReadUInt32 ();
- int length = reader.ReadInt32 ();
- int[] indices = new int[1];
-
- Array array = Array.CreateInstance (elementType, length);
- for (int n = 0; n < length; n++)
- {
- indices[0] = n;
- ReadValue (reader, array, objectId, null, elementType, null, null, indices);
- n = indices[0];
- }
- val = array;
- }
-
- private TypeMetadata ReadTypeMetadata (BinaryReader reader, bool isRuntimeObject, bool hasTypeInfo)
- {
- TypeMetadata metadata = new TypeMetadata();
-
- string className = reader.ReadString ();
- int fieldCount = reader.ReadInt32 ();
-
- Type[] types = new Type[fieldCount];
- string[] names = new string[fieldCount];
-
- for (int n=0; n 0)
- WriteObjectInstance (writer, _pendingObjects.Dequeue(), false);
- }
-
- public void WriteObjectInstance (BinaryWriter writer, object obj, bool isValueObject)
- {
- bool firstTime;
- long id;
-
- // If the object is a value type (not boxed) then there is no need
- // to register it in the id generator, because it won't have other
- // references to it
-
- if (isValueObject) id = _idGenerator.NextId;
- else id = _idGenerator.GetId (obj, out firstTime);
-
- if (obj is string) {
- WriteString (writer, id, (string)obj);
- }
- else if (obj is Array) {
- WriteArray (writer, id, (Array)obj);
- }
- else
- WriteObject (writer, id, obj);
- }
-
- public static void WriteSerializationEnd (BinaryWriter writer)
- {
- writer.Write ((byte) BinaryElement.End);
- }
-
- private void WriteObject (BinaryWriter writer, long id, object obj)
- {
- object data;
- TypeMetadata metadata;
-
- GetObjectData (obj, out metadata, out data);
- MetadataReference metadataReference = (MetadataReference)_cachedMetadata [metadata.InstanceTypeName];
-
- if (metadataReference != null && metadata.IsCompatible (metadataReference.Metadata))
- {
- // An object of the same type has already been serialized
- // It is not necessary to write again type metadata
-
- writer.Write ((byte) BinaryElement.RefTypeObject);
- writer.Write ((int)id);
-
- writer.Write ((int)metadataReference.ObjectID);
- metadata.WriteObjectData (this, writer, data);
- return;
- }
-
- if (metadataReference == null)
- {
- metadataReference = new MetadataReference (metadata, id);
- _cachedMetadata [metadata.InstanceTypeName] = metadataReference;
- }
-
- bool writeTypes = metadata.RequiresTypes || _typeFormat == FormatterTypeStyle.TypesAlways;
-
- BinaryElement objectTag;
-
- int assemblyId;
- if (metadata.TypeAssemblyName == CorlibAssemblyName)
- {
- // A corlib type
- objectTag = writeTypes ? BinaryElement.RuntimeObject : BinaryElement.UntypedRuntimeObject;
- assemblyId = -1;
- }
- else
- {
- objectTag = writeTypes ? BinaryElement.ExternalObject : BinaryElement.UntypedExternalObject;
- assemblyId = WriteAssemblyName (writer, metadata.TypeAssemblyName);
- }
-
- // Registers the assemblies needed for each field
- // If there are assemblies that where not registered before this object,
- // write them now
-
- metadata.WriteAssemblies (this, writer);
-
- // Writes the object
-
- writer.Write ((byte) objectTag);
- writer.Write ((int)id);
- writer.Write (metadata.InstanceTypeName);
-
- metadata.WriteTypeData (this, writer, writeTypes);
- if (assemblyId != -1) writer.Write (assemblyId);
-
- metadata.WriteObjectData (this, writer, data);
- }
-
- private void GetObjectData (object obj, out TypeMetadata metadata, out object data)
- {
- Type instanceType = obj.GetType();
- string binderAssemblyName = null;
- string binderTypeName = null;
- if (_binder != null)
- _binder.BindToName (instanceType, out binderAssemblyName, out binderTypeName);
- // Check if the formatter has a surrogate selector, if it does,
- // check if the surrogate selector handles objects of the given type.
-
- if (_surrogateSelector != null)
- {
- ISurrogateSelector selector;
- ISerializationSurrogate surrogate = _surrogateSelector.GetSurrogate (instanceType, _context, out selector);
- if (surrogate != null)
- {
- SerializationInfo info = new SerializationInfo (instanceType, new FormatterConverter ());
- surrogate.GetObjectData (obj, info, _context);
- metadata = new SerializableTypeMetadata (instanceType, info);
- if (_binder != null)
- metadata.BindToName (binderAssemblyName, binderTypeName);
-
- data = info;
- return;
- }
- }
-
- // Check if the object is marked with the Serializable attribute
-
- BinaryCommon.CheckSerializable (instanceType, _surrogateSelector, _context);
-
- _manager.RegisterObject (obj);
-
- ISerializable ser = obj as ISerializable;
-
- if (ser != null)
- {
- SerializationInfo info = new SerializationInfo (instanceType, new FormatterConverter ());
- ser.GetObjectData (info, _context);
- metadata = new SerializableTypeMetadata (instanceType, info);
- if (_binder != null)
- metadata.BindToName (binderAssemblyName, binderTypeName);
-
- data = info;
- }
- else
- {
- data = obj;
- if (_context.Context != null)
- {
- // Don't cache metadata info when the Context property is not null sice
- // we can't control the number of possible contexts in this case
- metadata = new MemberTypeMetadata (instanceType, _context);
- if (_binder != null)
- metadata.BindToName (binderAssemblyName, binderTypeName);
-
- return;
- }
-
- Hashtable typesTable;
- bool isNew = false;
- lock (_cachedTypes) {
- typesTable = (Hashtable) _cachedTypes [_context.State];
- if (typesTable == null) {
- typesTable = new Hashtable ();
- _cachedTypes [_context.State] = typesTable;
- isNew = true;
- }
- }
-
- metadata = null;
- lock (typesTable) {
- if (!isNew) {
- metadata = (TypeMetadata) typesTable [instanceType];
- }
-
- if (metadata == null) {
- metadata = CreateMemberTypeMetadata (instanceType);
- if (_binder != null)
- metadata.BindToName (binderAssemblyName, binderTypeName);
- }
-
- typesTable [instanceType] = metadata;
- }
- }
- }
-
- TypeMetadata CreateMemberTypeMetadata (Type type)
- {
-#if !FULL_AOT_RUNTIME
- if (!BinaryCommon.UseReflectionSerialization) {
- Type metaType = CodeGenerator.GenerateMetadataType (type, _context);
- return (TypeMetadata) Activator.CreateInstance (metaType);
- }
- else
-#endif
- return new MemberTypeMetadata (type, _context);
- }
-
- private void WriteArray (BinaryWriter writer, long id, Array array)
- {
- // There are 4 ways of serializing arrays:
- // The element GenericArray (7) can be used for all arrays.
- // The element ArrayOfPrimitiveType (15) can be used for single-dimensional
- // arrays of primitive types
- // The element ArrayOfObject (16) can be used for single-dimensional Object arrays
- // The element ArrayOfString (17) can be used for single-dimensional string arrays
-
- Type elementType = array.GetType().GetElementType();
-
- if (elementType == typeof (object) && array.Rank == 1) {
- WriteObjectArray (writer, id, array);
- }
- else if (elementType == typeof (string) && array.Rank == 1) {
- WriteStringArray (writer, id, array);
- }
- else if (BinaryCommon.IsPrimitive(elementType) && array.Rank == 1) {
- WritePrimitiveTypeArray (writer, id, array);
- }
- else
- WriteGenericArray (writer, id, array);
- }
-
- private void WriteGenericArray (BinaryWriter writer, long id, Array array)
- {
- Type elementType = array.GetType().GetElementType();
-
- // Registers and writes the assembly of the array element type if needed
-
- var tag = GetTypeTag (elementType);
- if ((tag != TypeTag.ArrayOfObject) && (tag != TypeTag.ArrayOfString) && (tag != TypeTag.ArrayOfPrimitiveType))
- WriteAssembly (writer, elementType.Assembly);
-
- // Writes the array
-
- writer.Write ((byte) BinaryElement.GenericArray);
- writer.Write ((int)id);
-
- // Write the structure of the array
-
- if (elementType.IsArray)
- writer.Write ((byte) ArrayStructure.Jagged);
- else if (array.Rank == 1)
- writer.Write ((byte) ArrayStructure.SingleDimensional);
- else
- writer.Write ((byte) ArrayStructure.MultiDimensional);
-
- // Write the number of dimensions and the length
- // of each dimension
-
- writer.Write (array.Rank);
- for (int n=0; n 2)
- BlockWrite (writer, array, 8);
- else
- foreach (double item in (double[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.Int16:
- if (array.Length > 2)
- BlockWrite (writer, array, 2);
- else
- foreach (short item in (short[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.Int32:
- if (array.Length > 2)
- BlockWrite (writer, array, 4);
- else
- foreach (int item in (int[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.Int64:
- if (array.Length > 2)
- BlockWrite (writer, array, 8);
- else
- foreach (long item in (long[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.SByte:
- if (array.Length > 2)
- BlockWrite (writer, array, 1);
- else
- foreach (sbyte item in (sbyte[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.Single:
- if (array.Length > 2)
- BlockWrite (writer, array, 4);
- else
- foreach (float item in (float[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.UInt16:
- if (array.Length > 2)
- BlockWrite (writer, array, 2);
- else
- foreach (ushort item in (ushort[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.UInt32:
- if (array.Length > 2)
- BlockWrite (writer, array, 4);
- else
- foreach (uint item in (uint[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.UInt64:
- if (array.Length > 2)
- BlockWrite (writer, array, 8);
- else
- foreach (ulong item in (ulong[]) array)
- writer.Write (item);
- break;
-
- case TypeCode.String:
- foreach (string item in (string[]) array)
- writer.Write (item);
- break;
-
- default:
- if (elementType == typeof (TimeSpan)) {
- foreach (TimeSpan item in (TimeSpan[]) array)
- writer.Write (item.Ticks);
- }
- else
- throw new NotSupportedException ("Unsupported primitive type: " + elementType.FullName);
- break;
- }
- }
-
- private void BlockWrite (BinaryWriter writer, Array array, int dataSize)
- {
- int totalSize = Buffer.ByteLength (array);
-
- if (arrayBuffer == null || (totalSize > arrayBuffer.Length && arrayBuffer.Length != ArrayBufferLength))
- arrayBuffer = new byte [totalSize <= ArrayBufferLength ? totalSize : ArrayBufferLength];
-
- int pos = 0;
- while (totalSize > 0) {
- int size = totalSize < arrayBuffer.Length ? totalSize : arrayBuffer.Length;
- Buffer.BlockCopy (array, pos, arrayBuffer, 0, size);
-
- if (!BitConverter.IsLittleEndian && dataSize > 1)
- BinaryCommon.SwapBytes (arrayBuffer, size, dataSize);
-
- writer.Write (arrayBuffer, 0, size);
- totalSize -= size;
- pos += size;
- }
- }
-
- private void WriteSingleDimensionArrayElements (BinaryWriter writer, Array array, Type elementType)
- {
- int numNulls = 0;
- foreach (object val in array)
- {
- if (val != null && numNulls > 0)
- {
- WriteNullFiller (writer, numNulls);
- WriteValue (writer, elementType, val);
- numNulls = 0;
- }
- else if (val == null)
- numNulls++;
- else
- WriteValue (writer, elementType, val);
- }
- if (numNulls > 0)
- WriteNullFiller (writer, numNulls);
- }
-
- private void WriteNullFiller (BinaryWriter writer, int numNulls)
- {
- if (numNulls == 1) {
- writer.Write ((byte) BinaryElement.NullValue);
- }
- else if (numNulls == 2) {
- writer.Write ((byte) BinaryElement.NullValue);
- writer.Write ((byte) BinaryElement.NullValue);
- }
- else if (numNulls <= byte.MaxValue) {
- writer.Write ((byte) BinaryElement.ArrayFiller8b);
- writer.Write ((byte) numNulls);
- }
- else {
- writer.Write ((byte) BinaryElement.ArrayFiller32b);
- writer.Write (numNulls);
- }
- }
-
- private void WriteObjectReference (BinaryWriter writer, long id)
- {
-
- writer.Write ((byte) BinaryElement.ObjectReference);
- writer.Write ((int)id);
- }
-
- public void WriteValue (BinaryWriter writer, Type valueType, object val)
- {
- if (val == null)
- {
- BinaryCommon.CheckSerializable (valueType, _surrogateSelector, _context);
- writer.Write ((byte) BinaryElement.NullValue);
- }
- else if (BinaryCommon.IsPrimitive(val.GetType()))
- {
- if (!BinaryCommon.IsPrimitive(valueType))
- {
- // It is a boxed primitive type value
- writer.Write ((byte) BinaryElement.BoxedPrimitiveTypeValue);
- WriteTypeSpec (writer, val.GetType());
- }
- WritePrimitiveValue (writer, val);
- }
- else if (valueType.IsValueType)
- {
- // Value types are written embedded in the containing object
- WriteObjectInstance (writer, val, true);
- }
- else if (val is string)
- {
- // Strings are written embedded, unless already registered
- bool firstTime;
- long id = _idGenerator.GetId (val, out firstTime);
-
- if (firstTime) WriteObjectInstance (writer, val, false);
- else WriteObjectReference (writer, id);
- }
- else
- {
- // It is a reference type. Write a forward reference and queue the
- // object to the pending object list (unless already written).
-
- bool firstTime;
- long id = _idGenerator.GetId (val, out firstTime);
-
- if (firstTime) _pendingObjects.Enqueue (val);
- WriteObjectReference (writer, id);
- }
- }
-
- private void WriteString (BinaryWriter writer, long id, string str)
- {
- writer.Write ((byte) BinaryElement.String);
- writer.Write ((int)id);
- writer.Write (str);
- }
-
- public int WriteAssembly (BinaryWriter writer, Assembly assembly)
- {
- return WriteAssemblyName (writer, assembly.FullName);
- }
-
- public int WriteAssemblyName (BinaryWriter writer, string assembly)
- {
- if (assembly == ObjectWriter.CorlibAssemblyName) return -1;
-
- bool firstTime;
- int id = RegisterAssembly (assembly, out firstTime);
- if (!firstTime) return id;
-
- writer.Write ((byte) BinaryElement.Assembly);
- writer.Write (id);
- if (_assemblyFormat == FormatterAssemblyStyle.Full)
- writer.Write (assembly);
- else {
- int i = assembly.IndexOf (',');
- if (i != -1) assembly = assembly.Substring (0, i);
- writer.Write (assembly);
- }
-
- return id;
- }
-
- public int GetAssemblyId (Assembly assembly)
- {
- return GetAssemblyNameId (assembly.FullName);
- }
-
- public int GetAssemblyNameId (string assembly)
- {
- return (int)_assemblyCache[assembly];
- }
-
- private int RegisterAssembly (string assembly, out bool firstTime)
- {
- if (_assemblyCache.ContainsKey (assembly))
- {
- firstTime = false;
- return (int)_assemblyCache[assembly];
- }
- else
- {
- int id = (int)_idGenerator.GetId (0, out firstTime);
- _assemblyCache.Add (assembly, id);
- return id;
- }
- }
-
- public static void WritePrimitiveValue (BinaryWriter writer, object value)
- {
- Type type = value.GetType();
-
- switch (Type.GetTypeCode (type))
- {
- case TypeCode.Boolean:
- writer.Write ((bool)value);
- break;
-
- case TypeCode.Byte:
- writer.Write ((byte) value);
- break;
-
- case TypeCode.Char:
- writer.Write ((char) value);
- break;
-
- case TypeCode.DateTime:
- writer.Write ( ((DateTime)value).ToBinary ());
- break;
-
- case TypeCode.Decimal:
- writer.Write (((decimal) value).ToString (CultureInfo.InvariantCulture));
- break;
-
- case TypeCode.Double:
- writer.Write ((double) value);
- break;
-
- case TypeCode.Int16:
- writer.Write ((short) value);
- break;
-
- case TypeCode.Int32:
- writer.Write ((int) value);
- break;
-
- case TypeCode.Int64:
- writer.Write ((long) value);
- break;
-
- case TypeCode.SByte:
- writer.Write ((sbyte) value);
- break;
-
- case TypeCode.Single:
- writer.Write ((float) value);
- break;
-
- case TypeCode.UInt16:
- writer.Write ((ushort) value);
- break;
-
- case TypeCode.UInt32:
- writer.Write ((uint) value);
- break;
-
- case TypeCode.UInt64:
- writer.Write ((ulong) value);
- break;
-
- case TypeCode.String:
- writer.Write ((string) value);
- break;
-
- default:
- if (type == typeof (TimeSpan))
- writer.Write (((TimeSpan)value).Ticks);
- else
- throw new NotSupportedException ("Unsupported primitive type: " + value.GetType().FullName);
- break;
- }
- }
-
- public static void WriteTypeCode (BinaryWriter writer, Type type)
- {
- writer.Write ((byte) GetTypeTag (type));
- }
-
- public static TypeTag GetTypeTag (Type type)
- {
- if (type == typeof (string)) {
- return TypeTag.String;
- }
- else if (BinaryCommon.IsPrimitive (type)) {
- return TypeTag.PrimitiveType;
- }
- else if (type == typeof (object)) {
- return TypeTag.ObjectType;
- }
- else if (type.IsArray && type.GetArrayRank() == 1 && type.GetElementType() == typeof (object)) {
- return TypeTag.ArrayOfObject;
- }
- else if (type.IsArray && type.GetArrayRank() == 1 && type.GetElementType() == typeof (string)){
- return TypeTag.ArrayOfString;
- }
- else if (type.IsArray && type.GetArrayRank() == 1 && BinaryCommon.IsPrimitive(type.GetElementType())) {
- return TypeTag.ArrayOfPrimitiveType;
- }
- else if (type.Assembly == CorlibAssembly) {
- return TypeTag.RuntimeType;
- }
- else
- return TypeTag.GenericType;
- }
-
- public void WriteTypeSpec (BinaryWriter writer, Type type)
- {
- // WARNING Keep in sync with EmitWriteTypeSpec
-
- switch (GetTypeTag (type))
- {
- case TypeTag.PrimitiveType:
- writer.Write (BinaryCommon.GetTypeCode (type));
- break;
-
- case TypeTag.RuntimeType:
- string fullName = type.FullName;
- // Map System.MonoType to MS.NET's System.RuntimeType,
- // when called in remoting context.
- // Note that this code does not need to be in sync with
- // EmitWriteTypeSpec because serializing a MethodCall
- // won't trigger the CodeGenerator.
- if (_context.State == StreamingContextStates.Remoting)
- if (type == typeof (System.MonoType))
- fullName = "System.RuntimeType";
- else if (type == typeof (System.MonoType[]))
- fullName = "System.RuntimeType[]";
- writer.Write (fullName);
- break;
-
- case TypeTag.GenericType:
- writer.Write (type.FullName);
- writer.Write ((int)GetAssemblyId (type.Assembly));
- break;
-
- case TypeTag.ArrayOfPrimitiveType:
- writer.Write (BinaryCommon.GetTypeCode (type.GetElementType()));
- break;
-
- default:
- // Type spec not needed
- break;
- }
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/binary_serialization_format.htm b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/binary_serialization_format.htm
deleted file mode 100644
index b1ade4f4b82..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/binary_serialization_format.htm
+++ /dev/null
@@ -1,1552 +0,0 @@
-
-
- Binary Serialization Format
-
-
-
- Binary Serialization Format
- by Lluis Sanchez Gual (lluis@ideary.com)
-
-
- Introduction
- This document describes the format used by the class BinaryFormatter to
- serialize object graphs. The document is based on the analysis of the output of
- the BinaryFormatter of the Microsoft .NET runtime, so it is probably not
- complete, since I cannot be sure that I have tested all cases. In fact, there
- are some gaps in some tables of codes, so if you find a meaning for the missing
- codes, please contact me and I'll update the document.
-
- Format description
- An object serialization is a sequence of binary elements. A binary element
- coluld be for example a description of an object, an array, an assembly, etc.
- Each binary element has a specific format, which is described in the following
- sections.
- This table shows the available binary elements:
-
-
-
- All elements begin with a byte that identifies the type of element. It is shown
- in the "Code" column. In the implementation of the formatter I use an enum to
- represent those codes. The "Label" column is the name of the corresponding enum
- element.
-
- An example
- The best way to underestand the format is to look at an example. Let's see how
- the following structure of classes would be serialized:
-
- class A
- {
- B bval = new B();
- C cval = new C();
- string msg = "hello";
- }
-
- class B
- {
- string str = "bye";
- }
-
- struct C
- {
- string[] info = new string[] {"hello","world"}
- }
-
- The serialization of an instance of class A would result in a sequence of binary
- elements like the following:
-
-
-
- Element |
- Bytes |
- Data |
- Comments |
-
-
- Header |
- 0
- 1,0,0,0,
- 255,255,255,255,
- 1,0,0,0,0,0,0,0 |
- Element code ? |
- This sequence of bytes is serialized at the beginning. I'm sure it
- has a meaning, but I don't know it. |
-
-
- Assembly |
- 1
- 1,0,0,0
- "MyAssembly" |
- Element code
- ID of the assembly (1)
- Full name of the assembly |
-
- Before serializing an object, the assembly where the object is implemented has
- to be serialized. The formatter assigns an ID to the assembly (ID 1 in this
- case). This ID will by used to refer to this assembly.
- |
-
-
- ExternalObject |
- 5
- 2,0,0,0
- "A"
- 3,0,0,0
- "bval","cval","msg"
- 4,4,1
- "B"
- 1,0,0,0
- "C"
- 1,0,0,0
- 1,0,0,0 |
- Element code
- Object ID (2)
- Class name
- Field count
- Field names
- Field type tags
- Class name of field "bval"
- Assembly ID of field "bval"
- Class name of field "cval"
- Assembly ID of field "cval"
- Assembly ID of this object |
- Serialization of the root object. Each object has an ID that is
- used, for example, to specify object relations. The object binary element has
- two parts. The first one is type metadata: the name and type of serialized
- fields. The second part is the object data: field values. The data part is
- shown in the following nested elements. |
-
-
- ObjectReference |
- 9
- 5,0,0,0 |
- Element code
- ID of the referred object (5) |
- Reference objects are not serialized inside the container element.
- Instead, an ObjectReference is serialized, and the object itself queued for
- later serialization. |
-
-
- ExternalObject |
- 5
- 3,0,0,0
- C
- 1,0,0,0
- "info"
- 6
- 1,0,0,0 |
- Element code
- Object ID (3)
- Class name
- Field count
- Field name
- Field type tag
- Assembly ID of this object |
- On the other hand, value type objects are serialized inside the
- container element. |
-
-
-
- ObjectReference |
- 9
- 7,0,0,0 |
- Element code
- ID of the referred object (7) |
- This is again a reference object, so it is serialized later. |
-
-
- String |
- 6
- 4,0,0,0
- "hello" |
- Element code
- Object ID (4)
- String value |
- Strings are serialized like value objects |
-
-
- ExternalObject |
- 5
- 5,0,0,0
- "B"
- 1,0,0,0
- "str"
- 1
- 1,0,0,0 |
- Element code
- Object ID (5)
- Class name
- Field count
- Field name
- Field type tag
- Assembly ID of this object |
-
- Reference objects queued for serialization are serialized after the root object.
- |
-
-
- String |
- 6
- 6,0,0,0
- "bye" |
- Element code
- Object ID (6)
- String value |
- A string |
-
-
- ArrayOfString |
- 17
- 7,0,0,0
- 2,0,0,0 |
- Element code
- Object ID (7)
- Element count |
- This could be also encoded using the binary element Array
- (7), but ArrayOfString is more specific and saves bytes. |
-
-
- ObjectReference |
- 9
- 4,0,0,0 |
- Element code
- ID of the referred object (4) |
- This string was already serialized. Use a backwards reference. |
-
-
- String |
- 6
- 8,0,0,0
- "world" |
- Element code
- Object ID (8)
- String value |
- Another string |
-
-
-
-
- Binary elements
- The following sections show the format of each binary element. The format is
- presented in a table with two columns. The first one shows the sequence of
- bytes and the second one a description of each element in the sequence.
- A special notation is used to represent the bytes. Here are some examples:
-
-
-
- Example of element |
- Description |
-
-
- (byte) 7 |
- A single byte |
-
-
- uint |
- Any uint value (4 bytes) |
-
-
- type-tag |
- Names in italic are described in the section "Other elements" |
-
-
- string * |
- * represents a sequence of elements |
-
-
- object |
- Full serialization of an object |
-
-
-
-
- 1 - RefTypeObject
-
- An object is serialized in two parts. The first one is type metadata, and the
- second one is the object data. When several objects of the same type are
- serialized, only the first one has the metadata part. The other objects are
- serialized using the RefTypeObject element, which instead of the metadata, it
- includes an ID of an object that is of the same type as the one being
- serialized.
-
-
-
- Element |
- Description |
-
-
- (byte) 1 |
- Element code |
-
-
- uint |
- Object ID |
-
-
- uint |
- ID of a previously serialized object from which to take type metadata. |
-
-
- value * |
- Values of the fields of the object |
-
-
-
-
- 4 - RuntimeObject
- This element is used to serialize objects of types that are implemented in the
- core library of the framework. The only difference from the format for other
- objects if that it does not include assembly information, which is not needed
- since the assembly will always be mscorlib.
-
-
-
- Element |
- Description |
-
-
- (byte) 4 |
- Element code |
-
-
- uint |
- Object ID |
-
-
- string |
- Class name, including namespace |
-
-
- uint |
- Number of serialized fields |
-
-
- string * |
- Names of the fields |
-
-
- type-tag * |
- type-tag of each field |
-
-
- type-spec * |
- type-spec of each field |
-
-
- value * |
- Values of the fields of the object |
-
-
-
-
- 5 - ExternalObject
- This element can be used to serialize any object from any assembly.
-
-
-
- Element |
- Description |
-
-
- (byte) 5 |
- Element code |
-
-
- uint |
- Object ID |
-
-
- string |
- Class name, including namespace |
-
-
- uint |
- Number of serialized fields |
-
-
- string * |
- Names of the fields |
-
-
- type-tag * |
- type-tag of each field |
-
-
- type-spec * |
- type-spec of each field |
-
-
- uint |
- ID of the assembly where the class is defined (the assembly must have been
- serialized before the class using the binary element 12) |
-
-
- value * |
- Values of the fields of the object |
-
-
-
-
- 6 - String
- A string value.
-
-
-
- Element |
- Description |
-
-
- (byte) 6 |
- Element code |
-
-
- uint |
- Object ID |
-
-
- string |
- Value of the string |
-
-
-
-
- 7 - GenericArray
- This element can be used to represent any array.
-
-
-
- Element |
- Description |
-
-
- (byte) 7 |
- Element code |
-
-
- uint |
- Object ID |
-
-
- byte |
- Array type: 0:single dimension, 1: jagged, 2: multi-dimensional |
-
-
- uint |
- Number of dimensions (rank) |
-
-
- uint * |
- Number of elements for each dimension |
-
-
- type-tag |
- type-tag of array's element type |
-
-
- type-spec |
- type-spec of array's element type |
-
-
- value * |
- Values of the elements, row by row |
-
-
-
-
- 8 - BoxedPrimitiveTypeValue
- This element represents a primitive type value boxed as an object.
-
-
-
- Element |
- Description |
-
-
- (byte) 8 |
- Element code |
-
-
- type-spec |
- type-spec of the primitive type |
-
-
- primitive-value |
- Raw value |
-
-
-
-
- 9 - ObjectReference
- This element represents a reference to an object already serialized (backwards
- reference) or that will be serialized later (forward reference).
-
-
-
-
- Element |
- Description |
-
-
- (byte) 9 |
- Element code |
-
-
- uint |
- ID of the referred object |
-
-
-
-
- 10 - NullValue
- A null value.
-
-
- Element |
- Description |
-
-
- (byte) 10 |
- Element code |
-
-
-
-
-
-
11 - End
-
- This element marks the end of the serialized object graph.
-
-
- Element |
- Description |
-
-
- (byte) 11 |
- Element code |
-
-
-
-
-
12 - Assembly
-
- Defines an assembly. Each assembly is defined only once and has an ID. This ID
- is used when serializing an object (element 5) to specify the assembly where
- object's type is implemented.
-
-
- Element |
- Description |
-
-
- (byte) 12 |
- Element code |
-
-
- uint |
- Assembly ID |
-
-
- string |
- Full name of the assembly |
-
-
-
-
-
13 - ArrayFiller8b
-
- This element can be used when serializing array data to specify multiple
- consecutive null values. It it only used in single dimension arrays of
- reference objects (not valid for value-type objects).
-
-
- Element |
- Description |
-
-
- (byte) 13 |
- Element code |
-
-
- byte |
- Number of consecutive null values |
-
-
-
-
-
-
14 - ArrayFiller32b
-
- The same as ArrayFiller8b, but it uses a uint to specify the length.
-
-
- Element |
- Description |
-
-
- (byte) 14 |
- Element code |
-
-
- uint |
- Number of consecutive null values |
-
-
-
-
-
-
15 - ArrayOfPrimitiveType
-
- This element can be used to represent a single dimension array of primitive type
- values.
-
-
-
- Element |
- Description |
-
-
- (byte) 15 |
- Element code |
-
-
- uint |
- Object ID |
-
-
- uint |
- Number of elements |
-
-
- type-spec |
- type-spec of array's element type |
-
-
- primitie-value * |
- Values of the elements |
-
-
-
-
- 16 - ArrayOfObject
- This element can be used to represent a single dimension array of Object (i.e.
- an object[] ).
-
-
-
- Element |
- Description |
-
-
- (byte) 16 |
- Element code |
-
-
- uint |
- Object ID |
-
-
- uint |
- Number of elements |
-
-
- object * |
- Values of the elements |
-
-
-
-
- 17 - ArrayOfString
- This element can be used to represent a single dimension array of String
- (i.e. an string[] ).
-
-
-
- Element |
- Description |
-
-
- (byte) 17 |
- Element code |
-
-
- uint |
- Object ID |
-
-
- uint |
- Number of elements |
-
-
- object * |
- Values of the elements |
-
-
-
-
- 21 Method call
- Represents a method call. The format of a method call can vary depending on the
- type of the parameters. The following table shows the common format:
-
-
-
- The following tables describe the format of the message content depending on the
- value of method-call-flags:
- method-call-flags & NoArguments
- Used for calls to methods without parameters.
-
-
-
- Element |
- Description |
-
-
- Header[] |
- Only if there are Headers and method-call-flags has the flag IncludeLogicalCallContext.
- Headers are serialized only if there is context info. This must be a bug
- in MS.NET. |
-
-
- object[] |
-
- Array with the following values:
-
- - Generic arguments if the method is generic and method-call-flags has the flag GenericArguments (NET_2_0).
- -
- Method signature, only if method-call-flags has the flag IncludesSignature. It
- is an array of Type.
-
-
- LogicalCallContext instance, only if method-call-flags has the flag
- IncludesLogicalCallContext.
- If the array is empty, it is not serialized.
- |
-
-
-
- method-call-flags & PrimitiveArguments
- Used for calls to methods in which all parameters are primitive types.
-
-
-
- Element |
- Description |
-
-
- uint |
- Number of parameters |
-
-
- ( type-spec
- primitive-value ) * |
- One value for each parameter |
-
-
- Header[] |
- Only if there are Headers and method-response-flags has the flag IncludeLogicalCallContext.
- Headers are serialized only if there is context info. This must be a bug
- in MS.NET. |
-
-
- object[] |
-
- Array with the following values:
-
- - Generic arguments if the method is generic and method-call-flags has the flag GenericArguments (NET_2_0).
- -
- Method signature, only if method-call-flags has the flag IncludesSignature. It
- is an array of Type.
-
-
- LogicalCallContext instance, only if method-call-flags has the flag
- IncludesLogicalCallContext.
- If the array is empty, it is not serialized.
- |
-
-
-
- method-call-flags & ArgumentsInSimpleArray
- Used for calls to methods in which at least one parameter is not a primitive
- type, and when no other info needs to be serialized (i.e. context or
- signature).
-
-
-
- Element |
- Description |
-
-
- Header[] |
- Only if there are Headers. |
-
-
- object[] |
-
- Array of parameters.
-
- |
-
-
- method-call-flags & ArgumentsInMultiArray
- Used for calls to methods in which at least one parameter is not a primitive
- type, and when other info needs to be serialized (i.e. context or signature).
-
-
-
- Element |
- Description |
-
-
- Header[] |
- Only if there are Headers. |
-
-
- object[] |
-
-
- Array with the following values:
-
- -
- Array of parameters.
-
- Generic arguments if the method is generic and method-call-flags has the flag GenericArguments (NET_2_0).
- -
- Method signature, only if method-call-flags has the flag IncludesSignature. It
- is an array of Type.
-
-
- LogicalCallContext instance, only if method-call-flags has the flag
- IncludesLogicalCallContext.
-
- If the array is empty, it is not serialized.
- |
-
-
-
-
- 22 Method Response
- Represents a method response. The format of a method response can vary depending
- on the type of the return value and parameters. The following table
- shows the common format:
-
-
-
- Element |
- Description |
-
-
- (byte) 22 |
- Element code |
-
-
- method-response-flags |
- Describes which information includes the method call |
-
-
- return-type-tag |
- Describes which kind of value is returned |
-
-
- (bytes) 0, 0 |
- ??? |
-
-
-
- The following tables describe the format of the message content depending on the
- value of method-response-flags:
- method-response-flags & NoArguments
- Used when the method has no out arguments.
-
-
-
- Element |
- Description |
-
-
- type-spec
- primitive-value |
-
- Only if return-type-tag was PrimitiveType.
- Return value.
- |
-
-
- Header[] |
- Only if there are Headers. |
-
-
- object[] |
-
- Array with the following values:
-
- -
- Return value, only if return-type-tag was ObjectType
-
-
- LogicalCallContext instance, only if method-response-flags has the flag
- IncludeLogicalCallContext
- If the array is empty, it is not serialized.
- |
-
-
-
- method-response-flags & PrimitiveArguments
- Used when all out arguments are primitive types.
-
-
-
- Element |
- Description |
-
-
- type-spec
- primitive-value |
-
- Only if return-type-tag was PrimitiveType.
- Return value.
- |
-
-
- uint |
- Number of out arguments |
-
-
- ( type-spec
-
- primitive-value ) * |
- One value for each argument |
-
-
- Header[] |
- Only if there are Headers. Empty otherwise. |
-
-
- object[] |
-
- Array with the following values:
-
- -
- Return value, only if return-type-tag was ObjectType
-
-
- LogicalCallContext instance, only if method-response-flags has the flag
- IncludeLogicalCallContext
- If the array is empty, it is not serialized.
- |
-
-
-
- method-response-flags & ArgumentsInSimpleArray
- Used when at least one out argument is not a primitive type, return type is
- primitive, and no other info needs to be serialized.
-
-
-
- Element |
- Description |
-
-
- type-spec
- primitive-value |
-
- Only if return-type-tag was PrimitiveType.
- Return value.
- |
-
-
- Header[] |
- Only if there are Headers. |
-
-
- object[] |
- Array that contains the out arguments |
-
-
-
- method-response-flags & ArgumentsInMultiArray
- Used when at least one out argument is not a primitive type, return type is not
- primitive, and no other info needs to be serialized.
-
-
-
- Element |
- Description |
-
-
- type-spec
- primitive-value |
-
- Only if return-type-tag was PrimitiveType.
- Return value.
- |
-
-
- Header[] |
- Only if there are Headers |
-
-
- object[] |
-
- Array with the following values:
-
- -
- Array of out arguments.
-
-
- Return value, only if return-type-tag was ObjectType
-
-
- LogicalCallContext instance, only if method-response-flags has the flag
- IncludeLogicalCallContext
- |
-
-
-
-
- Other elements
-
- string
- A string value, serialized using BinaryWriter. It serializes the length of the
- string, using a 7-bit encoded int, and then the string chars.
-
- primitive-value
- A primitive value. It can be serialized using BinaryWriter and deserialized
- using BinaryReader. DateTime is serialized as a long (using the Ticks
- property).
-
-
- value
- It can be a primitive-value or any of the
- following binary elements:
-
-
- type-tag
- Together with a type-spec value, identifies a type.
- Some types can be represented using several type-tags. In this case, the most
- specific type-tag is allways used (it will take less bytes).
- type-tag can be one of the following:
-
-
-
- Value |
- Label |
- Description |
- type-spec needed |
-
-
- 0 |
- PrimitiveType |
- A primitive type |
- The code of the primitive type |
-
-
- 1 |
- String |
- String class. type-spec is not needed. |
- Not needed |
-
-
- 2 |
- ObjectType |
- Object class. type-spec is not needed. |
- Not needed |
-
-
- 3 |
- RuntimeType |
- A type from the .NET runtime (including arrays of .NET types) |
- The name of the class |
-
-
- 4 |
- GenericType |
- Any other type (including arrays) |
- The name of the class and the id of the assembly |
-
-
- 5 |
- ArrayOfObject |
- Array of class Object |
- Not needed |
-
-
- 6 |
- ArrayOfString |
- Array of class String |
- Not needed |
-
-
- 7 |
- ArrayOfPrimitiveType |
- Array of primitive type |
- The code of the primitive type |
-
-
-
-
- type-spec
- It is the name or the code of a type. To decode it, a type-tag
- value is needed. The following tables shows the format of type-spec for each
- type-tag value:
- type-tag = PrimitiveType or ArrayOfPrimitiveType
-
-
-
- type-tag = RuntimeType
-
-
-
- Element |
- Description |
-
-
- string |
- The name of the class, including the namespace |
-
-
- type-tag = GenericType
-
-
-
- Element |
- Description |
-
-
- string |
- The name of the class, including the namespace |
-
-
- uint |
- Id of the assembly where the class is defined |
-
-
-
- Other type-tag
-
- For other type-tag values, no type-spec is needed.
-
- method-call-flags
-
-
-
- Value |
- Label |
- Description |
-
-
- 1 |
- NoArguments |
- No arguments included |
-
-
- 2 |
- PrimitiveArguments |
- Primitive type arguments |
-
-
- 4 |
- ArgumentsInSimpleArray |
- At least one out argument is not from a primitive type |
-
-
- 8 |
- ArgumentsInMultiArray |
- At least one out argument is not from a primitive type and other
- info is included in the message (context or signature) |
-
-
- 16 |
- ExcludeLogicalCallContext |
- LogicalContext not included |
-
-
- 32 |
- |
- ??? |
-
-
- 64 |
- IncludesLogicalCallContext |
- LogicalContext included |
-
-
- 128 |
- IncludesSignature |
- Signature is included in the message. It is only included when calling an
- overloaded method. |
-
-
-
- 32768 (0x8000) |
- GenericArguments |
- Generic arguments are included in the message (NET_2_0). |
-
-
-
-
- method-response-flags
-
-
-
- Value |
- Label |
- Description |
-
-
- 1 |
- NoArguments |
- Response with no out arguments |
-
-
- 2 |
- PrimitiveArguments |
-
- Response with primitive type out arguments |
-
-
- 4 |
- ArgumentsInSimpleArray |
- Response with primitive type return value, and with at least one out argument
- that is not a primitive type. |
-
-
- 8 |
- ArgumentsInMultiArray |
- Response with at least one out argument that is not a primitive type, and other
- info is included in the message (context or signature) |
-
-
- 16 |
- ExcludeLogicalCallContext |
- LogicalContext not included |
-
-
- 32 |
- |
- ??? |
-
-
- 64 |
- IncludesLogicalCallContext |
- LogicalContext included |
-
-
-
-
- return-type-tag
-
-
-
- Value |
- Label |
- Description |
-
-
- 2 |
- Null |
- Null return value |
-
-
- 8 |
- PrimitiveType |
- Primitive type return value |
-
-
- 16 |
- ObjectType |
- Object instance return value |
-
-
- 32 |
- Exception |
- Method response is an exception |
-
-
-
-
- primitive-type-code
-
-
-
- Value |
- Label |
-
-
- 1 |
- Boolean
- |
-
-
- 2 |
- Byte |
-
-
- 3 |
- Char |
-
-
- 5 |
- Decimal |
-
-
- 6 |
- Double |
-
-
- 7 |
- Int16 |
-
-
- 8 |
- Int32 |
-
-
- 9 |
- Int64 |
-
-
- 10 |
- SByte |
-
-
- 11 |
- Single |
-
-
- 13 |
- DateTime |
-
-
- 14 |
- UInt16 |
-
-
- 15 |
- UInt32 |
-
-
- 16 |
- UInt64 |
-
-
- 18 |
- String |
-
-
-
-
- 2003 (C) Lluis Sanchez Gual (
- lluis@ideary.com)
-
-
-
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/.gitattributes b/mcs/class/corlib/System.Runtime.Serialization.Formatters/.gitattributes
deleted file mode 100644
index d0aea070da4..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/.gitattributes
+++ /dev/null
@@ -1,5 +0,0 @@
-/IFieldInfo.cs -crlf
-/ISoapMessage.cs -crlf
-/ServerFault.cs -crlf
-/SoapFault.cs -crlf
-/SoapMessage.cs -crlf
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog
deleted file mode 100644
index 21123ca15b7..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog
+++ /dev/null
@@ -1,51 +0,0 @@
-2007-05-03 Dick Porter
-
- * IFieldInfo.cs:
- * ISoapMessage.cs:
- * InternalRM.cs:
- * InternalST.cs:
- * ServerFault.cs:
- * SoapFault.cs:
- * SoapMessage.cs:
- * FormatterAssemblyStyle.cs:
- * FormatterTypeStyle.cs:
- * TypeFilterLevel.cs: Update to 2.0 profile
-
-2004-06-15 Gert Driesen
-
- * SoapMessage.cs: fixed serialization compatibility with MS.NET
-
-2003-11-18 Andreas Nahr
-
- * ServerFault.cs: Added missing attribute
- * SoapFault.cs: Added missing attribute
- * InternalRM.cs: Added
- * InternalST.cs: Added
- * TypeFilterLevel.cs: Added (complete)
-
-2003-05-28 Jean-Marc Andre
-
- * SoapFault.cs: finishing implementation
- * ServerFault.cs: finishing implementation
- * SoapMessage.cs: finishing implementation
-
-2002-08-22 Nick Drochak
-
- * SoapFault.cs: Serialization ctr should be private
-
-2002-08-14 Cesar Octavio Lopez Nataren
-
- * SoapFault.cs: Added the ctr for ISerializable implementation and
- implemented GetObjectData.
-
-2002-07-30 Duncan Mak
-
- * ServerFault.cs:
- * SoapFault.cs:
- * SoapMessage.cs: Added missing classes.
-
-2002-01-21 David Dawkins
-
- * IFieldInfo.cs : New file
- * ISoapMessage.cs : New file
-
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
deleted file mode 100644
index 04ec6158732..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// FormatterAssemblyStyle.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:43:19 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization.Formatters {
-
-
- ///
- ///
- [ComVisible (true)]
- [Serializable]
- public enum FormatterAssemblyStyle {
-
- ///
- ///
- Simple = 0,
-
- ///
- ///
- Full = 1,
- } // FormatterAssemblyStyle
-
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
deleted file mode 100644
index 2a28f0897c6..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// FormatterTopObjectStyle.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:42:59 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-
-#if ECMA
-
- ///
- ///
- public enum FormatterTopObjectStyle {
-
- ///
- ///
- Object = 0,
-
- ///
- ///
- SoapMessage = 1,
- } // FormatterTopObjectStyle
-#endif
-
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
deleted file mode 100644
index af9706ee266..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// FormatterTypeStyle.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:43:09 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization.Formatters {
-
-
- ///
- ///
- [ComVisible (true)]
- [Serializable]
- public enum FormatterTypeStyle {
-
- ///
- ///
- TypesWhenNeeded = 0,
-
- ///
- ///
- TypesAlways = 1,
-
- ///
- ///
- XsdString = 2,
- } // FormatterTypeStyle
-
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs
deleted file mode 100644
index b8788e01669..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.IFieldInfo
-//
-// Author:
-// David Dawkins (david@dawkins.st)
-//
-// (C) David Dawkins
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization.Formatters {
-
- ///
- /// Interface for querying field information on serialized objects.
- [ComVisible (true)]
- public interface IFieldInfo {
-
- ///
- /// Get or set the field names for serialized objects.
- string[] FieldNames {
- get;
- set;
- }
-
- ///
- /// Get or set the field types for serialized objects.
- Type[] FieldTypes {
- get;
- set;
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs
deleted file mode 100644
index 5a2c71ef86f..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.ISoapMessage
-//
-// Author:
-// David Dawkins (david@dawkins.st)
-//
-// (C) David Dawkins
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Runtime.Remoting.Messaging;
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization.Formatters {
-
- ///
- /// Interface for making SOAP method calls
- [ComVisible (true)]
- public interface ISoapMessage {
-
- ///
- /// Get or set the headers ("out-of-band" data) for the method call
- Header[] Headers {
- get;
- set;
- }
-
- ///
- /// Get or set the method name
- string MethodName {
- get;
- set;
- }
-
- ///
- /// Get or set the method parameter names
- /// Get or set the method parameter types
- /// Get or set the method parameter values
- /// Get or set the XML namespace for the location of the called object
- ///
- public enum InternalArrayTypeE {
-
- ///
- ///
- Empty = 0,
-
- ///
- ///
- Single = 1,
-
- ///
- ///
- Jagged = 2,
-
- ///
- ///
- Rectangular = 3,
-
- ///
- ///
- Base64 = 4,
- } // InternalArrayTypeE
-#endif
-
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
deleted file mode 100644
index ff8462e6e6b..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// InternalElementTypeE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:43:49 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalElementTypeE {
-
- ///
- ///
- ObjectBegin = 0,
-
- ///
- ///
- ObjectEnd = 1,
-
- ///
- ///
- Member = 2,
- } // InternalElementTypeE
-#endif
-
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
deleted file mode 100644
index cf6f54a1357..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// InternalMemberTypeE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:44:09 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalMemberTypeE {
-
- ///
- ///
- Empty = 0,
-
- ///
- ///
- Header = 1,
-
- ///
- ///
- Field = 2,
-
- ///
- ///
- Item = 3,
- } // InternalMemberTypeE
-#endif
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
deleted file mode 100644
index 86454b865b1..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-// InternalMemberValueE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:44:18 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalMemberValueE {
-
- ///
- ///
- Empty = 0,
-
- ///
- ///
- InlineValue = 1,
-
- ///
- ///
- Nested = 2,
-
- ///
- ///
- Reference = 3,
-
- ///
- ///
- Null = 4,
- } // InternalMemberValueE
-#endif
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
deleted file mode 100644
index fe92a4af9bd..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-// InternalNameSpaceE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:44:28 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalNameSpaceE {
-
- ///
- ///
- None = 0,
-
- ///
- ///
- Soap = 1,
-
- ///
- ///
- XdrPrimitive = 2,
-
- ///
- ///
- XdrString = 3,
-
- ///
- ///
- UrtSystem = 4,
-
- ///
- ///
- UrtUser = 5,
-
- ///
- ///
- UserNameSpace = 6,
-
- ///
- ///
- MemberName = 7,
-
- ///
- ///
- Interop = 8,
-
- ///
- ///
- CallElement = 9,
- } // InternalNameSpaceE
-#endif
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
deleted file mode 100644
index 0d403796752..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// InternalObjectPositionE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:44:38 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalObjectPositionE {
-
- ///
- ///
- Empty = 0,
-
- ///
- ///
- Top = 1,
-
- ///
- ///
- Child = 2,
-
- ///
- ///
- Headers = 3,
- } // InternalObjectPositionE
-#endif
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
deleted file mode 100644
index e5c4d2f4433..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-// InternalObjectTypeE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:44:48 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalObjectTypeE {
-
- ///
- ///
- Empty = 0,
-
- ///
- ///
- Object = 1,
-
- ///
- ///
- Array = 2,
- } // InternalObjectTypeE
-#endif
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs
deleted file mode 100644
index c36cadbf827..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// InternalParseStateE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:44:58 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalParseStateE {
-
- ///
- ///
- Initial = 0,
-
- ///
- ///
- Object = 1,
-
- ///
- ///
- Member = 2,
-
- ///
- ///
- MemberChild = 3,
- } // InternalParseStateE
-#endif
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
deleted file mode 100644
index f9db354029a..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-// InternalParseTypeE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:45:08 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalParseTypeE {
-
- ///
- ///
- Empty = 0,
-
- ///
- ///
- SerializedStreamHeader = 1,
-
- ///
- ///
- Object = 2,
-
- ///
- ///
- Member = 3,
-
- ///
- ///
- ObjectEnd = 4,
-
- ///
- ///
- MemberEnd = 5,
-
- ///
- ///
- Headers = 6,
-
- ///
- ///
- HeadersEnd = 7,
-
- ///
- ///
- SerializedStreamHeaderEnd = 8,
-
- ///
- ///
- Envelope = 9,
-
- ///
- ///
- EnvelopeEnd = 10,
-
- ///
- ///
- Body = 11,
-
- ///
- ///
- BodyEnd = 12,
- } // InternalParseTypeE
-#endif
-
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
deleted file mode 100644
index 8635b7fedd3..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-// InternalPrimitiveTypeE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:43:39 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-#if ECMA
-
- ///
- ///
- public enum InternalPrimitiveTypeE {
-
- ///
- ///
- Invalid = 0,
-
- ///
- ///
- Boolean = 1,
-
- ///
- ///
- Byte = 2,
-
- ///
- ///
- Char = 3,
-
- ///
- ///
- Currency = 4,
-
- ///
- ///
- Decimal = 5,
-
- ///
- ///
- Double = 6,
-
- ///
- ///
- Int16 = 7,
-
- ///
- ///
- Int32 = 8,
-
- ///
- ///
- Int64 = 9,
-
- ///
- ///
- SByte = 10,
-
- ///
- ///
- Single = 11,
-
- ///
- ///
- TimeSpan = 12,
-
- ///
- ///
- DateTime = 13,
-
- ///
- ///
- UInt16 = 14,
-
- ///
- ///
- UInt32 = 15,
-
- ///
- ///
- UInt64 = 16,
- } // InternalPrimitiveTypeE
-#endif
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalRM.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalRM.cs
deleted file mode 100644
index 88ac0a141e2..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalRM.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.InternalRM.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Runtime.InteropServices;
-using System.Diagnostics;
-
-namespace System.Runtime.Serialization.Formatters
-{
- //LAMESPEC: Use of this class??
- [ComVisible (true)]
- public sealed class InternalRM
- {
- public InternalRM ()
- {
- }
-
- [Conditional ("_LOGGING")]
- public static void InfoSoap (params object[] messages)
- {
- throw new NotImplementedException ();
- }
-
- public static bool SoapCheckEnabled ()
- {
- throw new NotImplementedException ();
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalST.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalST.cs
deleted file mode 100644
index 62de2961329..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalST.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.InternalST.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Runtime.InteropServices;
-using System.Diagnostics;
-using System.Reflection;
-
-namespace System.Runtime.Serialization.Formatters
-{
- //LAMESPEC: Use of this class??
-
- [ComVisible (true)]
- public sealed class InternalST
- {
- private InternalST ()
- {
- }
-
- [Conditional ("_LOGGING")]
- public static void InfoSoap (params object[] messages)
- {
- throw new NotImplementedException ();
- }
-
- public static Assembly LoadAssemblyFromString (string assemblyString)
- {
- throw new NotImplementedException ();
- }
-
- public static void SerializationSetValue (FieldInfo fi,
- object target,
- object value)
- {
- throw new NotImplementedException ();
- }
-
- [Conditional ("SER_LOGGING")]
- public static void Soap (params object[] messages)
- {
- throw new NotImplementedException ();
- }
-
- [Conditional ("_DEBUG")]
- public static void SoapAssert (bool condition, string message)
- {
- throw new NotImplementedException ();
- }
-
- public static bool SoapCheckEnabled ()
- {
- throw new NotImplementedException ();
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
deleted file mode 100644
index d17d4aecdfc..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// InternalSerializerTypeE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:43:59 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization.Formatters {
-
-#if ECMA
- ///
- ///
- public enum InternalSerializerTypeE {
-
- ///
- ///
- Soap = 1,
-
- ///
- ///
- Binary = 2,
- } // InternalSerializerTypeE
-#endif
-
-} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs
deleted file mode 100644
index 313220bbd9f..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.ServerFault.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-// Jean-Marc Andre (jean-marc.andre@polymtl.ca)
-//
-// 2002 (C) Copyright, Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.Remoting.Metadata;
-using System.Runtime.Serialization;
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization.Formatters {
-
- [Serializable]
- [SoapType(Embedded=true)]
- [ComVisible (true)]
- public sealed class ServerFault
- {
- string exceptionType;
- string message;
- string stackTrace;
-
-#pragma warning disable 169
- // Used by some remoting magic
- Exception exception;
-#pragma warning restore 169
-
- public ServerFault (string exceptionType, string message,
- string stackTrace)
- {
- this.exceptionType = exceptionType;
- this.message = message;
- this.stackTrace = stackTrace;
- }
-
- public string ExceptionType {
- get { return exceptionType; }
- set { exceptionType = value; }
- }
-
- public string ExceptionMessage {
- get { return message; }
- set { message = value; }
- }
-
- public string StackTrace {
- get { return stackTrace; }
- set { stackTrace = value; }
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs
deleted file mode 100644
index ca80b285278..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.SoapFault.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-// Jean-Marc Andre (jean-marc.andre@polymtl.ca)
-//
-// 2002 (C) Copyright, Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.Remoting.Metadata;
-using System.Runtime.Serialization;
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization.Formatters {
-
- [Serializable]
- [SoapType(Embedded=true)]
- [ComVisible (true)]
- public sealed class SoapFault : ISerializable
- {
- string code;
- string actor;
- string faultString;
- object detail;
-
- public SoapFault ()
- {
-
- }
-
- private SoapFault (SerializationInfo info, StreamingContext context)
- {
- code = info.GetString ("faultcode");
- faultString = info.GetString ("faultstring");
- detail = info.GetValue ("detail", typeof (object));
- }
-
- public SoapFault (string faultCode, string faultString,
- string faultActor, ServerFault serverFault)
- {
- this.code = faultCode;
- this.actor = faultActor;
- this.faultString = faultString;
- this.detail = serverFault;
- }
-
-
- public object Detail {
- get { return detail; }
- set { detail = value; }
- }
-
- public string FaultActor {
- get { return actor; }
- set { actor = value; }
- }
-
- public string FaultCode {
- get { return code; }
- set { code = value; }
- }
-
- public string FaultString {
- get { return faultString; }
- set { faultString = value; }
- }
-
- public void GetObjectData (SerializationInfo info,
- StreamingContext context)
- {
- info.AddValue ("faultcode", code, typeof (string));
- info.AddValue ("faultstring", faultString, typeof (string));
- info.AddValue ("detail", detail, typeof (object));
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs
deleted file mode 100644
index dce5324f6ed..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.SoapMessage.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-// Jean-Marc Andre (jean-marc.andre@polymtl.ca)
-//
-// 2002 (C) Copyright, Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.Remoting.Messaging;
-using System.Runtime.Serialization.Formatters;
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization.Formatters {
-
- [Serializable]
- [ComVisible (true)]
- public class SoapMessage : ISoapMessage
- {
- private Header[] headers;
- private string methodName;
- private string[] paramNames;
- private Type[] paramTypes;
- private object[] paramValues;
- private string xmlNameSpace;
-
- public SoapMessage ()
- {
- }
-
- public Header[] Headers {
- get { return headers; }
- set { headers = value; }
- }
-
- public string MethodName {
- get { return methodName; }
- set { methodName = value; }
- }
-
- public string [] ParamNames {
- get { return paramNames; }
- set { paramNames = value; }
- }
-
- public Type [] ParamTypes {
- get { return paramTypes; }
- set { paramTypes = value; }
- }
-
- public object [] ParamValues {
- get { return paramValues; }
- set { paramValues = value; }
- }
-
- public string XmlNameSpace {
- get { return xmlNameSpace; }
- set { xmlNameSpace = value; }
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/TypeFilterLevel.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/TypeFilterLevel.cs
deleted file mode 100644
index b1883e01c03..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization.Formatters/TypeFilterLevel.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.TypeFilterLevel.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization.Formatters
-{
- [ComVisible (true)]
- public enum TypeFilterLevel
- {
- Low = 2,
- Full = 3
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ChangeLog b/mcs/class/corlib/System.Runtime.Serialization/ChangeLog
deleted file mode 100644
index c06b16fdd5f..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/ChangeLog
+++ /dev/null
@@ -1,347 +0,0 @@
-2010-06-03 Jb Evain
-
- * SafeSerializationEventArgs.cs: add new type in net_4_0.
-
-2010-06-03 Jb Evain
-
- * ISafeSerializationData.cs: add new interface in net_4_0.
-
-2008-05-22 Miguel de Icaza
-
- * SerializationCallbacks.cs: This lock has a high contention rate
- on ASP.NET web sites, with multiple cores we end up spending a lot
- of time on this check.
-
- Rewrite this code to have two code paths since we know that the
- cache is append-only.
-
-2008-04-02 Andreas Nahr
-
- * IFormatterConverter.cs
- * SerializationException.cs
- * StreamingContext.cs: Fix parameter names
-
-2006-12-18 Lluis Sanchez Gual
-
- * FormatterServices.cs: In GetFields, avoid creating a field
- clone in some cases where it's not really necessary.
-
-2006-11-13 Jensen Somers
-
- * Fixed the Serializable attribute in OnDeserializedAttribute,
- OnDeserializingAttribute, OnSerializedAttribute and
- OnSerializingAttribute.
-
-2006-11-13 Jensen Somers
-
- * Removed [Serializable] from OnDeserializedAttribute,
- OnDeserializingAttribute, OnSerializedAttribute,
- OnSerializingAttribute.
-
-2006-11-10 Jensen Somers
-
- * Added ComVisibleAttribute in the ISerializable,
- ISerializationSurrogate and ISurrogateSelector interface.
- * Added the sealed keyword to the OnDeserializedAttribute,
- OnDeserializingAttribute, OnSerializedAttribute,
- OnSerializingAttribute and OptionalFieldAttribute class.
-
-2006-10-30 Robert Jordan
-
- * Apply ComVisibleAttribute.
-
-2006-10-29 Robert Jordan
-
- * ObjectManager.cs: Add NET_2_0 serialization callbacks.
-
-2006-10-29 Robert Jordan
-
- * SerializationObjectManager.cs,
- SerializationCallbacks.cs: Add support for NET_2_0 serialization
- events. See bug #78594.
-
-2006-08-06 Lluis Sanchez Gual
-
- * ObjectManager.cs: Add support for nested IObjectReference.
- Fixes bug #78749.
-
-2006-07-31 Sebastien Pouliot
-
- * ObjectIDGenerator.cs: Fix ArgumentNullException parameter.
-
-2006-06-04 Miguel de Icaza
-
- * OptionalFieldAttribute.cs, OnSerializedAttribute.cs,
- OnSerializingAttribute.cs, OnDeserializedAttribute.cs,
- OnDeserializingAttribute.cs: Added a few attributes for the
- version tolerant serialization.
-
-2006-01-04 Raja R Harinath
-
- * ObjectManager.cs (ObjectRecord.IsInstanceReady): Fix regression
- introduced in previous patch. See the re-opened bug #76931.
-
-2005-12-15 Martin Baulig
-
- * ObjectManager.cs: When deserializing an object that has a
- surrogate, actually check the return value of
- ISerializationSurrogate.SetObjectData(); fixes #76931.
-
-2005-10-03 Lluis Sanchez Gual
-
- * ObjectIDGenerator.cs: Use custom comparer instead of an instance
- wrapper. Closes bug #76017.
-
-2005-06-13 Lluis Sanchez Gual
-
- * Formatter.cs: Properly initialize protected fields. Fixes bug #75233.
-
-2005-05-17 Lluis Sanchez Gual
-
- * SerializationInfo.cs: Use IsInstanceOfType instead of IsAssignableFrom
- since GetType() may not return the correct type if the object is
- a remoting proxy.
-
-2005-05-09 Lluis Sanchez Gual
-
- * FormatterServices.cs: In GetSerializableMembers, private fields
- from base classes must include the class name in the field name.
- In this case, it now creates a clone of the field with the
- modified name. This patch together with r44260 fixes bug #74760.
-
-2004-12-09 Lluis Sanchez Gual
-
- * ObjectManager.cs: When deserializing an object that implements
- ISerializable, check if a surrogate exists for that object, before
- trying to deserialize it as ISerializable. This fixes bug #70104.
-
-2004-06-15 Gert Driesen
-
- * ObjectIDGenerator.cs: added TODO for serialization
-
-2004-06-09 Duncan Mak
-
- * ObjectManager.cs (RegisterObject): Add checks for
- ArgumentNullException as well.
-
-2004-06-09 Duncan Mak
-
- * SerializationInfoEnumerator.cs: Instead of using
- IDictionaryEnumerator from a Hashtable, use a normal IEnumerator
- from the newly added ArrayList in SerializationInfo.
-
- * SerializationInfo.cs: Added an extra ArrayList so that we can
- keep the SerializationEntrys added in the order.
- (SerializationInfo, AddValue): Throw ArgumentNullException
- correctly.
-
-
-2004-06-08 Duncan Mak
-
- * ObjectManager.cs (RegisterObject): Throw
- ArgumentOutOfRangeException if the objectID parameter is less than
- or equal to zero. This check was missing from this particular
- overload.
-
-2004-05-14 Marek Safar
-
- * SerializationInfo.cs: Removed useless [CLSCompliant (false)]
-
-2003-11-21 Andreas Nahr
-
- * FormatterServices.cs: Added CheckTypeSecurity() and
- GetSafeUninitializedObject().
-
-2003-11-18 Andreas Nahr
-
- * ObjectManager.cs: Fixed header, internalized enum
- * Formatter.cs: Implemented
-
-2003-11-11 Lluis Sanchez Gual
-
- * FormatterServices.cs: Fixed some comments.
-
-2003-10-21 Lluis Sanchez Gual
-
- * SerializationInfo.cs: Fixed bug in GetValue. Use IsAssignableFrom instead
- of IsSubclass, since the type can be an interface.
-
-2003-10-18 Lluis Sanchez Gual
-
- * FormatterServices.cs: In GetUninitializedObject methdod, reuse
- ActivationServices.AllocateUninitializedClassInstance, it does the same.
-
-2003-07-28 Duncan Mak
-
- * Formatter.cs (WriteSByte): Added CLSCompliant attribute.
-
-2003-07-26 Gonzalo Paniagua Javier
-
- * FormatterServices.cs:
- (GetSerializableMembers): check that all base types are serializable
- when getting their fields. Fixes bug #46875.
-
-2003-07-17 Lluis Sanchez Gual
-
- * ObjectIDGenerator.cs: Optimized access to hashtable and reduced the
- number of calls to GetType(). (Patch by Paolo).
- Also added a NextId property that returns a new Id without registering
- an object.
-
-2003-06-26 Lluis Sanchez Gual
-
- * SerializationInfo.cs: Fixed bug #44955
-
-2003-05-11 Gonzalo Paniagua Javier
-
- * FormatterServices.cs: patch from Jean Marc that fixes bug #42742.
-
-2003-02-18 Lluis Sanchez Gual
-
- * ObjectManager.cs: Corrected a problem with arrays of structs. Elements where
- not correctly updated by the final fixup.
-
-2003-01-27 Lluis Sanchez Gual
-
- * ObjectManager.cs: Corrected a problem with IObjectReferece objects.
-
-2003-01-24 Martin Baulig
-
- * ObjectManager.cs (RaiseDeserializationEvent): Walk the object
- list in the correct order.
-
-2003-01-16 Lluis Sanchez Gual
-
- * ObjectManager.cs: Implemented and added file
- * SurrogateSelector.cs: completed implementation.
- * SerializationInfo.cs: corrected a bug in GetValue method.
- * ObjectIDGenerator.cs: corrected a bug. Now it does not give the same
- id for two different instances that return true when calling Equal.
-
-2002-12-06 Duncan Mak
-
- * Formatter.cs (WriteValueType): Remove the erroneous CLSCompliant attribute.
-
-2002-08-16 Gonzalo Paniagua Javier
-
- * FormatterServices.cs: implemented GetUninitializedObject.
- PopulateObjectMembers needs a working FieldInfo.SetValue (it's
- not implemented right now).
-
-2002-08-16 Gonzalo Paniagua Javier
-
- * FormatterServices.cs:a implemented GetSerializableMembers ().
-
-2002-08-16 Gonzalo Paniagua Javier
-
- * FormatterServices.cs: New file with some implementation.
-
-2002-08-16 Dietmar Maurer
-
- * SerializationInfo.cs: special case for null values.
- use the converter everywhere.
-
-2002-08-14 Dietmar Maurer
-
- * SerializationInfo.cs: added new function to support the runtime
-
-2002-07-16 Gonzalo Paniagua Javier
-
- * Formatter.cs: added namespace.
-
-2002-06-10 Duncan Mak
-
- * Formatter.cs: Addd to CVS.
-
- * FormatterConverter.cs: Added to CVS.
-
- * SerializationInfo.cs (AddValue): Removed extra CLSCompliant attribute.
-
-2002-04-12 Duncan Mak
-
- * SerializationException.cs: Added missing constructor for serialization.
-
-2002-03-12 Duncan Mak
-
- * IFormatter.cs: Fix the return type of the Serialize method.
-
-2002/03/07 Nick Drochak
-
- * StreamingContextStates.cs: Add missing value (CrossAppDomain) and
- adjust All value accordingly.
-
-2002-03-01 Duncan Mak
-
- * ObjectIDGenerator.cs: Implemented.
-
-2002-02-19 Duncan Mak
-
- * SurrogateSelector.cs: Implemented.
-
- * SerializationInfoEnumerator.cs: oh, and simplified the Current
- property too.
-
- * SerializationInfo.cs: Forgot to finish up GetEnumerator ().
-
-2002-02-18 Duncan Mak
-
- * SerializationInfo.cs: Converted Type.GetType calls to the faster
- typeof operator.
-
-2002-02-16 Duncan Mak
-
- * SurrogateSelector.cs: Stubbed out. Gonna be working on this
- tomorrow.
-
-2002-02-15 Duncan Mak
-
- * SerializationEntry.cs: Added internal constructor for writing
- bits in SerializationInfoEnumerator.
- * SerializationInfo.cs: Completed.
- * SerializationInfoEnumerator.cs: Implemented. Piggybacking on
- Hashtable's GetEnumerator method.
-
-2002-02-13 Dan Lewis
-
- * SerializationInfoEnumerator.cs: New file (stub)
-
-2002-02-12 Duncan Mak
-
- * SerializationBinder.cs: Implemented.
- * SerializationEntry.cs: Implemented.
- * SerializationInfo.cs: Fixed the get portion of the AssemblyName
- property. Implemented the FullTypename property.
-
-2002-01-06 David Dawkins
-
- * IFormatter.cs : New file
- * ISerializationSurrogate.cs : New file
- * ISurrogateSelector.cs : New file
-
-2002-05-01 Ravi Pratap
-
- * SerializationInfo.cs : Insert MonoTODO attribute.
-
-2001-08-24 Nick Drochak
-
- * IDeserializationCallback.cs: New File
-
-Wed Nov 14 17:03:30 CET 2001 Paolo Molaro
-
- * IFormatterConverter.cs, SerializationInfo.cs: CLSCompliant updates.
-
-Fri Nov 2 18:40:12 CET 2001 Paolo Molaro
-
- * SerializationException.cs: implemented.
-
-2001-08-24 Nick Drochak
-
- * SerializationInfo.cs: Added all the public methods so that the compile would not break
-
-2001-07-20 Miguel de Icaza
-
- * SerializationInfo.cs: New file.
-
- * IFormatterConverter.cs: New file.
-
- * ISerializable.cs: New file.
diff --git a/mcs/class/corlib/System.Runtime.Serialization/Formatter.cs b/mcs/class/corlib/System.Runtime.Serialization/Formatter.cs
deleted file mode 100644
index 4065e0a6a39..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/Formatter.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-// System.Runtime.Serialization.Formatter.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.IO;
-
-namespace System.Runtime.Serialization
-{
-[CLSCompliant (false)]
-[Serializable]
-[System.Runtime.InteropServices.ComVisibleAttribute (true)]
-public abstract class Formatter : IFormatter
-{
- protected Formatter ()
- {
- }
-
- protected ObjectIDGenerator m_idGenerator = new ObjectIDGenerator ();
- protected Queue m_objectQueue = new Queue ();
-
- public abstract SerializationBinder Binder {
- get;
- set;
- }
-
- public abstract StreamingContext Context {
- get;
- set;
- }
-
- public abstract ISurrogateSelector SurrogateSelector {
- get;
- set;
- }
-
- public abstract object Deserialize (Stream serializationStream);
-
- protected virtual object GetNext (out long objID)
- {
- if (m_objectQueue.Count == 0)
- {
- // set the out field to 0
- objID = 0L;
- return null;
- }
-
- Object o = m_objectQueue.Dequeue ();
- bool FirstTime;
- objID = m_idGenerator.HasId (o, out FirstTime);
-
- return o;
- }
-
- protected virtual long Schedule (object obj)
- {
- if (obj == null)
- return 0L;
-
- bool FirstTime;
- long ID = m_idGenerator.GetId (obj, out FirstTime);
- if (FirstTime)
- m_objectQueue.Enqueue (obj);
-
- return ID;
- }
-
- public abstract void Serialize (Stream serializationStream, object graph);
-
- protected abstract void WriteArray (object obj, string name, Type memberType);
-
- protected abstract void WriteBoolean (bool val, string name);
-
- protected abstract void WriteByte (byte val, string name);
-
- protected abstract void WriteChar (char val, string name);
-
- protected abstract void WriteDateTime (DateTime val, string name);
-
- protected abstract void WriteDecimal (Decimal val, string name);
-
- protected abstract void WriteDouble (double val, string name);
-
- protected abstract void WriteInt16 (short val, string name);
-
- protected abstract void WriteInt32 (int val, string name);
-
- protected abstract void WriteInt64 (long val, string name);
-
- protected virtual void WriteMember (string memberName, object data)
- {
- if (data == null)
- WriteObjectRef (data, memberName, typeof(Object));
-
- Type dataType = data.GetType ();
- if (dataType.IsArray)
- WriteArray (data, memberName, dataType);
- else if (dataType == typeof(bool))
- WriteBoolean ((bool)data, memberName);
- else if (dataType == typeof(byte))
- WriteByte ((byte)data, memberName);
- else if (dataType == typeof(char))
- WriteChar ((char)data, memberName);
- else if (dataType == typeof(DateTime))
- WriteDateTime ((DateTime)data, memberName);
- else if (dataType == typeof(decimal))
- WriteDecimal ((decimal)data, memberName);
- else if (dataType == typeof(double))
- WriteDouble ((double)data, memberName);
- else if (dataType == typeof(Int16))
- WriteInt16 ((Int16)data, memberName);
- else if (dataType == typeof(Int32))
- WriteInt32 ((Int32)data, memberName);
- else if (dataType == typeof(Int64))
- WriteInt64 ((Int64)data, memberName);
- else if (dataType == typeof(sbyte))
- WriteSByte ((sbyte)data, memberName);
- else if (dataType == typeof(float))
- WriteSingle ((float)data, memberName);
- else if (dataType == typeof(TimeSpan))
- WriteTimeSpan ((TimeSpan)data, memberName);
- else if (dataType == typeof(UInt16))
- WriteUInt16 ((UInt16)data, memberName);
- else if (dataType == typeof(UInt32))
- WriteUInt32 ((UInt32)data, memberName);
- else if (dataType == typeof(UInt64))
- WriteUInt64 ((UInt64)data, memberName);
- else if (dataType.IsValueType)
- WriteValueType (data, memberName, dataType);
-
- WriteObjectRef (data, memberName, dataType);
- }
-
- protected abstract void WriteObjectRef (object obj, string name, Type memberType);
-
-
- [CLSCompliant (false)]
- protected abstract void WriteSByte (sbyte val, string name);
-
-
- protected abstract void WriteSingle (float val, string name);
-
- protected abstract void WriteTimeSpan (TimeSpan val, string name);
-
- [CLSCompliant (false)]
- protected abstract void WriteUInt16 (ushort val, string name);
-
- [CLSCompliant (false)]
- protected abstract void WriteUInt32 (uint val, string name);
-
- [CLSCompliant (false)]
- protected abstract void WriteUInt64 (ulong val, string name);
-
- protected abstract void WriteValueType (object obj, string name, Type memberType);
-}
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs b/mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs
deleted file mode 100644
index 1c397d43b94..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-//
-// System.Runtime.Serialization.Formatter.cs
-//
-// Duncan Mak (duncan@ximian.com)
-//
-// (C) Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.Serialization;
-
-namespace System.Runtime.Serialization {
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public class FormatterConverter : IFormatterConverter {
-
- public FormatterConverter ()
- {
- }
-
- public object Convert (object value, Type type)
- {
- return System.Convert.ChangeType (value, type);
- }
-
- public object Convert (object value, TypeCode typeCode)
- {
- return System.Convert.ChangeType (value, typeCode);
- }
-
- public bool ToBoolean (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToBoolean (value);
- }
-
- public byte ToByte (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToByte (value);
- }
-
- public char ToChar (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToChar (value);
- }
-
- public DateTime ToDateTime (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToDateTime (value);
- }
-
- public decimal ToDecimal (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToDecimal (value);
- }
-
- public double ToDouble (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToDouble (value);
- }
-
- public short ToInt16 (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToInt16 (value);
- }
-
- public int ToInt32 (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToInt32 (value);
- }
-
- public long ToInt64 (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToInt64 (value);
- }
-
- public float ToSingle (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToSingle (value);
- }
-
- public string ToString (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToString (value);
- }
-
- [CLSCompliant (false)]
- public sbyte ToSByte (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToSByte (value);
- }
-
- [CLSCompliant (false)]
- public ushort ToUInt16 (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToUInt16 (value);
- }
-
- [CLSCompliant (false)]
- public uint ToUInt32 (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToUInt32 (value);
- }
-
- [CLSCompliant (false)]
- public ulong ToUInt64 (object value)
- {
- if (value == null)
- throw new ArgumentNullException ("value is null.");
-
- return System.Convert.ToUInt64 (value);
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs b/mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs
deleted file mode 100644
index e2a8702befa..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs
+++ /dev/null
@@ -1,218 +0,0 @@
-//
-// System.Runtime.Serialization.FormatterServices
-//
-// Authors:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//
-// (C) 2002 Ximian, Inc (http://www.ximian.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Serialization.Formatters;
-using System.Globalization;
-
-namespace System.Runtime.Serialization
-{
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- static
- public class FormatterServices
- {
- private const BindingFlags fieldFlags = BindingFlags.Public |
- BindingFlags.Instance |
- BindingFlags.NonPublic |
- BindingFlags.DeclaredOnly;
-
-
- public static object [] GetObjectData (object obj, MemberInfo [] members)
- {
- if (obj == null)
- throw new ArgumentNullException ("obj");
-
- if (members == null)
- throw new ArgumentNullException ("members");
-
- int n = members.Length;
- object [] result = new object [n];
- for (int i = 0; i < n; i++) {
- MemberInfo member = members [i];
- if (member == null)
- throw new ArgumentNullException (String.Format ("members[{0}]", i));
-
- if (member.MemberType != MemberTypes.Field)
- throw new SerializationException (
- String.Format ("members [{0}] is not a field.", i));
-
- FieldInfo fi = member as FieldInfo; // members must be fields
- result [i] = fi.GetValue (obj);
- }
-
- return result;
- }
-
- public static MemberInfo [] GetSerializableMembers (Type type)
- {
- StreamingContext st = new StreamingContext (StreamingContextStates.All);
- return GetSerializableMembers (type, st);
- }
-
- public static MemberInfo [] GetSerializableMembers (Type type, StreamingContext context)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
-
- //FIXME: context?
- ArrayList fields = new ArrayList ();
- Type t = type;
- while (t != null) {
- if (!t.IsSerializable) {
- string msg = String.Format ("Type {0} in assembly {1} is not " +
- "marked as serializable.",
- t, t.Assembly.FullName);
-
- throw new SerializationException (msg);
- }
-
- GetFields (type, t, fields);
- t = t.BaseType;
- }
-
- MemberInfo [] result = new MemberInfo [fields.Count];
- fields.CopyTo (result);
- return result;
- }
-
- private static void GetFields (Type reflectedType, Type type, ArrayList fields)
- {
- FieldInfo [] fs = type.GetFields (fieldFlags);
- foreach (FieldInfo field in fs)
- if (!(field.IsNotSerialized)) {
- MonoField mf = field as MonoField;
- if (mf != null && reflectedType != type && !mf.IsPublic) {
- string fname = type.Name + "+" + mf.Name;
- fields.Add (mf.Clone (fname));
- }
- else
- fields.Add (field);
- }
- }
-
- public static Type GetTypeFromAssembly (Assembly assem, string name)
- {
- if (assem == null)
- throw new ArgumentNullException ("assem");
-
- if (name == null)
- throw new ArgumentNullException ("name");
-
- return assem.GetType (name);
- }
-
- public static object GetUninitializedObject (Type type)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
-
- if (type == typeof (string))
- throw new ArgumentException ("Uninitialized Strings cannot be created.");
-
- return System.Runtime.Remoting.Activation.ActivationServices.AllocateUninitializedClassInstance (type);
- }
-
- public static object PopulateObjectMembers (object obj, MemberInfo [] members, object [] data)
- {
- if (obj == null)
- throw new ArgumentNullException ("obj");
-
- if (members == null)
- throw new ArgumentNullException ("members");
-
- if (data == null)
- throw new ArgumentNullException ("data");
-
- int length = members.Length;
- if (length != data.Length)
- throw new ArgumentException ("different length in members and data");
-
- for (int i = 0; i < length; i++) {
- MemberInfo member = members [i];
- if (member == null)
- throw new ArgumentNullException (String.Format ("members[{0}]", i));
-
- if (member.MemberType != MemberTypes.Field)
- throw new SerializationException (
- String.Format ("members [{0}] is not a field.", i));
-
- FieldInfo fi = member as FieldInfo; // members must be fields
- fi.SetValue (obj, data [i]);
- }
-
- return obj;
- }
-
-
- public static void CheckTypeSecurity (Type t, TypeFilterLevel securityLevel)
- {
- if (securityLevel == TypeFilterLevel.Full) return;
- CheckNotAssignable (typeof(System.DelegateSerializationHolder), t);
- CheckNotAssignable (typeof(System.Runtime.Remoting.Lifetime.ISponsor), t);
- CheckNotAssignable (typeof(System.Runtime.Remoting.IEnvoyInfo), t);
- CheckNotAssignable (typeof(System.Runtime.Remoting.ObjRef), t);
- }
-
- static void CheckNotAssignable (Type basetype, Type type)
- {
- if (basetype.IsAssignableFrom (type)) {
- string msg = "Type " + basetype + " and the types derived from it";
- msg += " (such as " + type + ") are not permitted to be deserialized at this security level";
- throw new System.Security.SecurityException (msg);
- }
- }
-
- public static object GetSafeUninitializedObject (Type type)
- {
- // FIXME: MS.NET uses code access permissions to check if the caller is
- // allowed to create an instance of this type. We can't support this
- // because it is not implemented in mono.
-
- // In concrete, the it will request a SecurityPermission of
- // type "Infrastructure".
-
- return GetUninitializedObject (type);
- }
-
- // This method was introduced in .Net due to a bug serializing objects with circular references
- // which we don't appear to have, so we just return the same object.
- // See http://support.microsoft.com/kb/927495/en-us/ in case of doubt.
- [ComVisible (false)]
- public static ISerializationSurrogate GetSurrogateForCyclicalReference (ISerializationSurrogate innerSurrogate)
- {
- return innerSurrogate;
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs b/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs
deleted file mode 100644
index 4895d52cc10..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// System.Runtime.Serialization.IDeserializationCallback.cs
-//
-// Author:
-// Nick Drochak(ndrochak@gol.com)
-//
-// (C) Nick Drochak
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Runtime.Serialization {
-
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public interface IDeserializationCallback {
- void OnDeserialization(object sender);
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs b/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs
deleted file mode 100644
index ee2835ab578..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// System.Runtime.Serialization.IFormatter
-//
-// Author:
-// David Dawkins (david@dawkins.st)
-//
-// (C) David Dawkins
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.IO;
-
-namespace System.Runtime.Serialization {
-
- ///
- /// Formatting for serialized objects
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public interface IFormatter {
-
- //
- // Properties
- //
-
- ///
- /// Get or set the SerializationBinder used
- /// for looking up types during deserialization
- SerializationBinder Binder
- {
- get;
- set;
- }
-
- ///
- /// Get or set the StreamingContext used for serialization
- /// and deserialization
- StreamingContext Context
- {
- get;
- set;
- }
-
- ///
- /// Get or set the SurrogateSelector used by the current
- /// formatter
- ISurrogateSelector SurrogateSelector
- {
- get;
- set;
- }
-
- ///
- /// Deserialize data from the specified stream, rebuilding
- /// the object hierarchy
- object Deserialize(
- Stream serializationStream
- );
-
- ///
- /// Serialize the specified object to the specified stream.
- /// Object may be the root of a graph of objects to be
- /// serialized
- void Serialize(
- Stream serializationStream,
- object graph
- );
- }
-
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs b/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs
deleted file mode 100644
index fb9ca480e11..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// System.Runtime.Serialization.IFormatterConverter.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Runtime.Serialization {
- [CLSCompliant(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public interface IFormatterConverter {
- object Convert (object value, Type type);
- object Convert (object value, TypeCode typeCode);
-
- bool ToBoolean (object value);
- byte ToByte (object value);
- char ToChar (object value);
- DateTime ToDateTime (object value);
- Decimal ToDecimal (object value);
- double ToDouble (object value);
- Int16 ToInt16 (object value);
- Int32 ToInt32 (object value);
- Int64 ToInt64 (object value);
- sbyte ToSByte (object value);
- float ToSingle (object value);
- string ToString (object value);
- UInt16 ToUInt16 (object value);
- UInt32 ToUInt32 (object value);
- UInt64 ToUInt64 (object value);
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs b/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs
deleted file mode 100644
index 5f4237fc9e4..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Runtime.Serialization.IObjectReference.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Runtime.Serialization {
-
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public interface IObjectReference {
- object GetRealObject (StreamingContext context);
- }
-}
-
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISafeSerializationData.cs b/mcs/class/corlib/System.Runtime.Serialization/ISafeSerializationData.cs
deleted file mode 100644
index d5e636fe40d..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/ISafeSerializationData.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// System.Runtime.Serialization.ISafeSerializationData
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization {
-
- public interface ISafeSerializationData {
- void CompleteDeserialization (object deserialized);
- }
-}
-
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs b/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs
deleted file mode 100644
index f553d3cb5d2..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Runtime.Serialization.ISerializable.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Runtime.Serialization {
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
-
- public interface ISerializable {
- void GetObjectData (SerializationInfo info, StreamingContext context);
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs b/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs
deleted file mode 100644
index 7dbdbc7ceb3..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// System.Runtime.Serialization.ISerializationSurrogate
-//
-// Author:
-// David Dawkins (david@dawkins.st)
-//
-// (C) David Dawkins
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Runtime.Serialization {
-
- ///
- /// Interface for serialization surrogates
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
-
- public interface ISerializationSurrogate {
-
- ///
- /// Get the SerializationInfo necessary to serialize
- /// the specified object
- /// Object to be serialized
- /// SerializationInfo to be populated
- /// Destination for serialization
- void GetObjectData(
- object obj,
- SerializationInfo info,
- StreamingContext context
- );
-
- ///
- /// Populate an object using the specified SerializationInfo
- /// Object to be populated
- /// Data used for populating object
- /// Source for deserialization of object
- ///
- /// Creation of serialization surrogate selectors
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
-
- public interface ISurrogateSelector {
-
- ///
- /// Insert specified selector into available surrogates
- void ChainSelector( ISurrogateSelector selector );
-
- ///
- /// Return next surrogate in the surrogate chain
- ISurrogateSelector GetNextSelector();
-
- ///
- /// Fetch the surrogate according the specified type, starting
- /// the search from the surrogate selector for the specified
- /// StreamingContext
- /// Type of the object to be serialized
- /// Context for the serialization/deserialization
- /// Upon return, contains a reference to the selector where the returned surrogate was found
- /// The surrogate for the specified type and context
- ISerializationSurrogate GetSurrogate(
- Type type,
- StreamingContext context,
- out ISurrogateSelector selector
- );
-
- }
-
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs b/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs
deleted file mode 100644
index 6e4f00ccfb3..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-// System.Runtime.Serialization.ObjectIDGenerator.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-// Lluis Sanchez (lsg@ctv.es)
-//
-// (C) Ximian, Inc.
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-
-namespace System.Runtime.Serialization
-{
- [Serializable]
- [MonoTODO ("Serialization format not compatible with.NET")]
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public class ObjectIDGenerator
- {
- // Private field
- Hashtable table;
- long current; // this is the current ID, starts at 1
- static InstanceComparer comparer = new InstanceComparer ();
-
-
- // ObjectIDGenerator must generate a new id for each object instance.
- // If two objects have the same state (i.e. the method Equals() returns true),
- // each one should have a different id.
- // Thus, the object instance cannot be directly used as key of the hashtable.
- // InstanceComparer compares object references instead of object content
- // (unless the object is inmutable, like strings).
-
- class InstanceComparer: IComparer, IHashCodeProvider
- {
- int IComparer.Compare (object o1, object o2)
- {
- if (o1 is string)
- return o1.Equals(o2) ? 0 : 1;
- else
- return (o1 == o2) ? 0 : 1;
- }
-
- int IHashCodeProvider.GetHashCode (object o)
- {
- return object.InternalGetHashCode (o);
- }
- }
-
- // constructor
- public ObjectIDGenerator ()
- : base ()
- {
- table = new Hashtable (comparer, comparer);
- current = 1;
- }
-
- // Methods
- public virtual long GetId (object obj, out bool firstTime)
- {
- if (obj == null)
- throw new ArgumentNullException ("obj");
-
- object val = table [obj];
-
- if (val != null) {
- firstTime = false;
- return (long) val;
-
- } else {
- firstTime = true;
- table.Add (obj, current);
- return current ++;
- }
- }
-
- public virtual long HasId (object obj, out bool firstTime)
- {
- if (obj == null)
- throw new ArgumentNullException ("obj");
-
- object val = table [obj];
-
- if (val != null) {
- firstTime = false;
- return (long) val;
-
- } else {
- firstTime = true;
- return 0L; // 0 is the null ID
- }
- }
-
- internal long NextId
- {
- get { return current ++; }
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs b/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs
deleted file mode 100644
index b895c50f420..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs
+++ /dev/null
@@ -1,638 +0,0 @@
-//
-// System.Runtime.Serialization.ObjectManager.cs
-//
-// Author: Lluis Sanchez Gual (lluis@ideary.com)
-//
-// (C) 2003 Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Reflection;
-
-namespace System.Runtime.Serialization
-{
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public class ObjectManager
- {
- // All objects are chained in the same order as they have been registered
- ObjectRecord _objectRecordChain = null;
- ObjectRecord _lastObjectRecord = null;
-
- ArrayList _deserializedRecords = new ArrayList();
- ArrayList _onDeserializedCallbackRecords = new ArrayList();
- Hashtable _objectRecords = new Hashtable();
- bool _finalFixup = false;
-
- ISurrogateSelector _selector;
- StreamingContext _context;
- int _registeredObjectsCount = 0;
-
- public ObjectManager(ISurrogateSelector selector, StreamingContext context)
- {
- _selector = selector;
- _context = context;
- }
-
- public virtual void DoFixups()
- {
- _finalFixup = true;
-
- try
- {
- if (_registeredObjectsCount < _objectRecords.Count)
- throw new SerializationException ("There are some fixups that refer to objects that have not been registered");
-
-
- ObjectRecord last = _lastObjectRecord;
-
- bool firstCycle = true;
- bool lastCycle = false;
- int unresolvedCount = 0; // Unresolved objects found in the current cycle
- int lastUnresolvedCount = 0; // Unresolved objects before the current cycle
-
- // Solve al pending fixups of all objects
-
- ObjectRecord record = _objectRecordChain;
- while (record != null)
- {
- // We ignore object references in the first cycle
- bool ready = !(record.IsUnsolvedObjectReference && firstCycle);
- if (ready) ready = record.DoFixups (true, this, true);
- if (ready) ready = record.LoadData(this, _selector, _context);
-
- ObjectRecord next;
-
- if (ready)
- {
- if (record.OriginalObject is IDeserializationCallback)
- _deserializedRecords.Add (record);
-
- SerializationCallbacks sc = SerializationCallbacks
- .GetSerializationCallbacks (record.OriginalObject.GetType ());
- if (sc.HasDeserializedCallbacks)
- _onDeserializedCallbackRecords.Add (record);
- next = record.Next;
- }
- else
- {
- // There must be an unresolved IObjectReference instance.
- // Chain the record at the end so it is solved later
-
- if ((record.ObjectInstance is IObjectReference) && !firstCycle)
- {
- if (record.IsUnsolvedObjectReference && lastCycle)
- // No more chances to resolve
- throw new SerializationException ("The object with ID " + record.ObjectID + " could not be resolved");
- else {
- unresolvedCount++;
- }
- }
-
- if (record != _lastObjectRecord) {
- next = record.Next;
- record.Next = null;
- _lastObjectRecord.Next = record;
- _lastObjectRecord = record;
- }
- else
- next = record;
- }
-
- if (record == last) {
- last = _lastObjectRecord;
- if (firstCycle)
- firstCycle = false;
- else {
- if (lastUnresolvedCount == unresolvedCount)
- lastCycle = true;
- }
- lastUnresolvedCount = unresolvedCount;
- unresolvedCount = 0;
- }
- record = next;
- }
- }
- finally
- {
- _finalFixup = false;
- }
- }
-
- internal ObjectRecord GetObjectRecord (long objectID)
- {
- ObjectRecord rec = (ObjectRecord)_objectRecords[objectID];
- if (rec == null)
- {
- if (_finalFixup) throw new SerializationException ("The object with Id " + objectID + " has not been registered");
- rec = new ObjectRecord();
- rec.ObjectID = objectID;
- _objectRecords[objectID] = rec;
- }
- if (!rec.IsRegistered && _finalFixup) throw new SerializationException ("The object with Id " + objectID + " has not been registered");
- return rec;
- }
-
- public virtual object GetObject (long objectID)
- {
- if (objectID <= 0) throw new ArgumentOutOfRangeException("objectID","The objectID parameter is less than or equal to zero");
- ObjectRecord rec = (ObjectRecord)_objectRecords[objectID];
- if (rec == null || !rec.IsRegistered) return null;
- else return rec.ObjectInstance;
- }
-
- public virtual void RaiseDeserializationEvent ()
- {
- for (int i = _onDeserializedCallbackRecords.Count-1; i >= 0; i--)
- {
- ObjectRecord record = (ObjectRecord) _onDeserializedCallbackRecords [i];
- RaiseOnDeserializedEvent (record.OriginalObject);
- }
- for (int i = _deserializedRecords.Count-1; i >= 0; i--)
- {
- ObjectRecord record = (ObjectRecord) _deserializedRecords [i];
- IDeserializationCallback obj = record.OriginalObject as IDeserializationCallback;
- if (obj != null) obj.OnDeserialization (this);
- }
-
- }
-
- public void RaiseOnDeserializingEvent (object obj)
- {
- SerializationCallbacks sc = SerializationCallbacks
- .GetSerializationCallbacks (obj.GetType ());
- sc.RaiseOnDeserializing (obj, _context);
- }
-
- void RaiseOnDeserializedEvent (object obj)
- {
- SerializationCallbacks sc = SerializationCallbacks
- .GetSerializationCallbacks (obj.GetType ());
- sc.RaiseOnDeserialized (obj, _context);
- }
-
- private void AddFixup (BaseFixupRecord record)
- {
- record.ObjectToBeFixed.ChainFixup (record, true);
- record.ObjectRequired.ChainFixup (record, false);
- }
-
- public virtual void RecordArrayElementFixup (long arrayToBeFixed, int index, long objectRequired)
- {
- if (arrayToBeFixed <= 0) throw new ArgumentOutOfRangeException("arrayToBeFixed","The arrayToBeFixed parameter is less than or equal to zero");
- if (objectRequired <= 0) throw new ArgumentOutOfRangeException("objectRequired","The objectRequired parameter is less than or equal to zero");
- ArrayFixupRecord record = new ArrayFixupRecord(GetObjectRecord(arrayToBeFixed), index, GetObjectRecord(objectRequired));
- AddFixup (record);
- }
-
- public virtual void RecordArrayElementFixup (long arrayToBeFixed, int[] indices, long objectRequired)
- {
- if (arrayToBeFixed <= 0) throw new ArgumentOutOfRangeException("arrayToBeFixed","The arrayToBeFixed parameter is less than or equal to zero");
- if (objectRequired <= 0) throw new ArgumentOutOfRangeException("objectRequired","The objectRequired parameter is less than or equal to zero");
- if (indices == null) throw new ArgumentNullException("indices");
- MultiArrayFixupRecord record = new MultiArrayFixupRecord (GetObjectRecord(arrayToBeFixed), indices, GetObjectRecord(objectRequired));
- AddFixup (record);
- }
-
- public virtual void RecordDelayedFixup (long objectToBeFixed, string memberName, long objectRequired)
- {
- if (objectToBeFixed <= 0) throw new ArgumentOutOfRangeException("objectToBeFixed","The objectToBeFixed parameter is less than or equal to zero");
- if (objectRequired <= 0) throw new ArgumentOutOfRangeException("objectRequired","The objectRequired parameter is less than or equal to zero");
- if (memberName == null) throw new ArgumentNullException("memberName");
- DelayedFixupRecord record = new DelayedFixupRecord (GetObjectRecord(objectToBeFixed), memberName, GetObjectRecord(objectRequired));
- AddFixup (record);
- }
-
- public virtual void RecordFixup (long objectToBeFixed, MemberInfo member, long objectRequired)
- {
- if (objectToBeFixed <= 0) throw new ArgumentOutOfRangeException("objectToBeFixed","The objectToBeFixed parameter is less than or equal to zero");
- if (objectRequired <= 0) throw new ArgumentOutOfRangeException("objectRequired","The objectRequired parameter is less than or equal to zero");
- if (member == null) throw new ArgumentNullException("member");
- FixupRecord record = new FixupRecord (GetObjectRecord(objectToBeFixed), member, GetObjectRecord(objectRequired));
- AddFixup (record);
- }
-
- private void RegisterObjectInternal (object obj, ObjectRecord record)
- {
- if (obj == null) throw new ArgumentNullException("obj");
-
- if (record.IsRegistered)
- {
- if (record.OriginalObject != obj) throw new SerializationException ("An object with Id " + record.ObjectID + " has already been registered");
- else return;
- }
-
- record.ObjectInstance = obj;
- record.OriginalObject = obj;
-
- if (obj is IObjectReference) record.Status = ObjectRecordStatus.ReferenceUnsolved;
- else record.Status = ObjectRecordStatus.ReferenceSolved;
-
- if (_selector != null) {
- record.Surrogate = _selector.GetSurrogate (
- obj.GetType(), _context, out record.SurrogateSelector);
- if (record.Surrogate != null)
- record.Status = ObjectRecordStatus.ReferenceUnsolved;
- }
-
- record.DoFixups (true, this, false);
- record.DoFixups (false, this, false);
- _registeredObjectsCount++;
-
- // Adds the object to the chain of registered objects. This chain
- // is needed to be able to to perform the final fixups in the right order
-
- if (_objectRecordChain == null)
- {
- _objectRecordChain = record;
- _lastObjectRecord = record;
- }
- else
- {
- _lastObjectRecord.Next = record;
- _lastObjectRecord = record;
- }
- }
-
-
- public virtual void RegisterObject (object obj, long objectID)
- {
- if (obj == null) throw new ArgumentNullException("obj", "The obj parameter is null.");
- if (objectID <= 0) throw new ArgumentOutOfRangeException("objectID","The objectID parameter is less than or equal to zero");
- RegisterObjectInternal (obj, GetObjectRecord (objectID));
- }
-
- public void RegisterObject (object obj, long objectID, SerializationInfo info)
- {
- if (obj == null) throw new ArgumentNullException("obj", "The obj parameter is null.");
- if (objectID <= 0) throw new ArgumentOutOfRangeException("objectID","The objectID parameter is less than or equal to zero");
-
- ObjectRecord record = GetObjectRecord (objectID);
- record.Info = info;
- RegisterObjectInternal (obj, record);
- }
-
- public void RegisterObject (object obj, long objectID, SerializationInfo info, long idOfContainingObj, MemberInfo member)
- {
- RegisterObject (obj, objectID, info, idOfContainingObj, member, null);
- }
-
- public void RegisterObject( object obj, long objectID, SerializationInfo info, long idOfContainingObj, MemberInfo member, int[] arrayIndex)
- {
- if (obj == null) throw new ArgumentNullException("obj", "The obj parameter is null.");
- if (objectID <= 0) throw new ArgumentOutOfRangeException("objectID","The objectID parameter is less than or equal to zero");
-
- ObjectRecord record = GetObjectRecord (objectID);
- record.Info = info;
- record.IdOfContainingObj = idOfContainingObj;
- record.Member = member;
- record.ArrayIndex = arrayIndex;
- RegisterObjectInternal (obj, record);
- }
- }
-
-
-
- // Fixup types. There is a fixup class for each fixup type.
-
- // BaseFixupRecord
- // Base class for all fixups
-
- internal abstract class BaseFixupRecord
- {
- public BaseFixupRecord(ObjectRecord objectToBeFixed, ObjectRecord objectRequired)
- {
- ObjectToBeFixed = objectToBeFixed;
- ObjectRequired = objectRequired;
- }
-
- public bool DoFixup (ObjectManager manager, bool strict)
- {
- if (ObjectToBeFixed.IsRegistered && ObjectRequired.IsInstanceReady)
- {
- FixupImpl (manager);
- return true;
- }
- else if (strict)
- {
- if (!ObjectToBeFixed.IsRegistered) throw new SerializationException ("An object with ID " + ObjectToBeFixed.ObjectID + " was included in a fixup, but it has not been registered");
- else if (!ObjectRequired.IsRegistered) throw new SerializationException ("An object with ID " + ObjectRequired.ObjectID + " was included in a fixup, but it has not been registered");
- else return false;
- }
- else
- return false;
- }
-
- protected abstract void FixupImpl (ObjectManager manager);
-
- internal protected ObjectRecord ObjectToBeFixed;
- internal protected ObjectRecord ObjectRequired;
-
- public BaseFixupRecord NextSameContainer;
- public BaseFixupRecord NextSameRequired;
- }
-
- // ArrayFixupRecord
- // Fixup for assigning a value to one position of an array
-
- internal class ArrayFixupRecord : BaseFixupRecord
- {
- int _index;
-
- public ArrayFixupRecord (ObjectRecord objectToBeFixed, int index, ObjectRecord objectRequired): base (objectToBeFixed, objectRequired) {
- _index = index;
- }
-
- protected override void FixupImpl (ObjectManager manager) {
- Array array = (Array)ObjectToBeFixed.ObjectInstance;
- array.SetValue (ObjectRequired.ObjectInstance, _index);
- }
- }
-
- // MultiArrayFixupRecord
- // Fixup for assigning a value to several positions of an array
-
- internal class MultiArrayFixupRecord : BaseFixupRecord
- {
- int[] _indices;
-
- public MultiArrayFixupRecord (ObjectRecord objectToBeFixed, int[] indices, ObjectRecord objectRequired): base (objectToBeFixed, objectRequired) {
- _indices = indices;
- }
-
- protected override void FixupImpl (ObjectManager manager) {
- ObjectToBeFixed.SetArrayValue (manager, ObjectRequired.ObjectInstance, _indices);
- }
- }
-
- // FixupRecord
- // Fixup for assigning a value to a member of an object
-
- internal class FixupRecord: BaseFixupRecord
- {
- public MemberInfo _member;
-
- public FixupRecord (ObjectRecord objectToBeFixed, MemberInfo member, ObjectRecord objectRequired): base (objectToBeFixed, objectRequired) {
- _member = member;
- }
-
- protected override void FixupImpl (ObjectManager manager) {
- ObjectToBeFixed.SetMemberValue (manager, _member, ObjectRequired.ObjectInstance);
- }
- }
-
- // DelayedFixupRecord
- // Fixup for assigning a value to a SerializationInfo of an object
-
- internal class DelayedFixupRecord: BaseFixupRecord
- {
- public string _memberName;
-
- public DelayedFixupRecord (ObjectRecord objectToBeFixed, string memberName, ObjectRecord objectRequired): base (objectToBeFixed, objectRequired) {
- _memberName = memberName;
- }
-
- protected override void FixupImpl (ObjectManager manager) {
- ObjectToBeFixed.SetMemberValue (manager, _memberName, ObjectRequired.ObjectInstance);
- }
- }
-
- // Object Record
-
- internal enum ObjectRecordStatus: byte { Unregistered, ReferenceUnsolved, ReferenceSolved }
-
- internal class ObjectRecord
- {
- public ObjectRecordStatus Status = ObjectRecordStatus.Unregistered;
- public object OriginalObject;
- public object ObjectInstance;
- public long ObjectID;
- public SerializationInfo Info;
- public long IdOfContainingObj;
- public ISerializationSurrogate Surrogate;
- public ISurrogateSelector SurrogateSelector;
- public MemberInfo Member;
- public int[] ArrayIndex;
- public BaseFixupRecord FixupChainAsContainer;
- public BaseFixupRecord FixupChainAsRequired;
- public ObjectRecord Next;
-
- public void SetMemberValue (ObjectManager manager, MemberInfo member, object value)
- {
- if (member is FieldInfo)
- ((FieldInfo)member).SetValue (ObjectInstance, value);
- else if (member is PropertyInfo)
- ((PropertyInfo)member).SetValue (ObjectInstance, value, null);
- else throw new SerializationException ("Cannot perform fixup");
-
- if (Member != null)
- {
- ObjectRecord containerRecord = manager.GetObjectRecord (IdOfContainingObj);
- if (containerRecord.IsRegistered)
- containerRecord.SetMemberValue (manager, Member, ObjectInstance);
- }
- else if (ArrayIndex != null)
- {
- ObjectRecord containerRecord = manager.GetObjectRecord (IdOfContainingObj);
- if (containerRecord.IsRegistered)
- containerRecord.SetArrayValue (manager, ObjectInstance, ArrayIndex);
- }
- }
- public void SetArrayValue (ObjectManager manager, object value, int[] indices)
- {
- ((Array)ObjectInstance).SetValue (value, indices);
- }
-
- public void SetMemberValue (ObjectManager manager, string memberName, object value)
- {
- if (Info == null) throw new SerializationException ("Cannot perform fixup");
- Info.AddValue (memberName, value, value.GetType());
- }
-
- public bool IsInstanceReady
- {
- // Returns true if this object is ready to be assigned to a parent object.
- get
- {
- if (!IsRegistered) return false;
- if (IsUnsolvedObjectReference) return false;
-
- // Embedded value objects cannot be assigned to their containers until fully completed
- if (ObjectInstance.GetType ().IsValueType && (HasPendingFixups || Info != null))
- return false;
-
- return true;
- }
- }
-
- public bool IsUnsolvedObjectReference
- {
- get {
- return Status != ObjectRecordStatus.ReferenceSolved;
- }
- }
-
- public bool IsRegistered
- {
- get {
- return Status != ObjectRecordStatus.Unregistered;
- }
- }
-
- public bool DoFixups (bool asContainer, ObjectManager manager, bool strict)
- {
- BaseFixupRecord prevFixup = null;
- BaseFixupRecord fixup = asContainer ? FixupChainAsContainer : FixupChainAsRequired;
- bool allFixed = true;
-
- while (fixup != null)
- {
- if (fixup.DoFixup (manager, strict))
- {
- UnchainFixup (fixup, prevFixup, asContainer);
- if (asContainer) fixup.ObjectRequired.RemoveFixup (fixup, false);
- else fixup.ObjectToBeFixed.RemoveFixup (fixup, true);
- }
- else
- {
- prevFixup = fixup;
- allFixed = false;
- }
-
- fixup = asContainer ? fixup.NextSameContainer : fixup.NextSameRequired;
- }
- return allFixed;
- }
-
- public void RemoveFixup (BaseFixupRecord fixupToRemove, bool asContainer)
- {
- BaseFixupRecord prevFixup = null;
- BaseFixupRecord fixup = asContainer ? FixupChainAsContainer : FixupChainAsRequired;
- while (fixup != null)
- {
- if (fixup == fixupToRemove)
- {
- UnchainFixup (fixup, prevFixup, asContainer);
- return;
- }
- prevFixup = fixup;
- fixup = asContainer ? fixup.NextSameContainer : fixup.NextSameRequired;
- }
- }
-
- private void UnchainFixup (BaseFixupRecord fixup, BaseFixupRecord prevFixup, bool asContainer)
- {
- if (prevFixup == null) {
- if (asContainer) FixupChainAsContainer = fixup.NextSameContainer;
- else FixupChainAsRequired = fixup.NextSameRequired;
- }
- else {
- if (asContainer) prevFixup.NextSameContainer = fixup.NextSameContainer;
- else prevFixup.NextSameRequired = fixup.NextSameRequired;
- }
- }
-
- public void ChainFixup (BaseFixupRecord fixup, bool asContainer)
- {
- if (asContainer)
- {
- fixup.NextSameContainer = FixupChainAsContainer;
- FixupChainAsContainer = fixup;
- }
- else
- {
- fixup.NextSameRequired = FixupChainAsRequired;
- FixupChainAsRequired = fixup;
- }
- }
-
- public bool LoadData (ObjectManager manager, ISurrogateSelector selector, StreamingContext context)
- {
- if (Info != null)
- {
- if (Surrogate != null) {
- object new_obj = Surrogate.SetObjectData (ObjectInstance, Info, context, SurrogateSelector);
- if (new_obj != null)
- ObjectInstance = new_obj;
- Status = ObjectRecordStatus.ReferenceSolved;
- } else if (ObjectInstance is ISerializable) {
- object[] pars = new object[] {Info, context};
- ConstructorInfo con = ObjectInstance.GetType().GetConstructor (BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof (SerializationInfo), typeof (StreamingContext) }, null );
- if (con == null) throw new SerializationException ("The constructor to deserialize an object of type " + ObjectInstance.GetType().FullName + " was not found.");
- con.Invoke (ObjectInstance, pars);
- } else {
- throw new SerializationException ("No surrogate selector was found for type " + ObjectInstance.GetType().FullName);
- }
-
- Info = null;
- }
-
- if (ObjectInstance is IObjectReference && Status != ObjectRecordStatus.ReferenceSolved)
- {
- try {
- ObjectInstance = ((IObjectReference)ObjectInstance).GetRealObject(context);
- int n = 100;
- while (ObjectInstance is IObjectReference && n > 0) {
- object ob = ((IObjectReference)ObjectInstance).GetRealObject (context);
- if (ob == ObjectInstance)
- break;
- ObjectInstance = ob;
- n--;
- }
- if (n == 0)
- throw new SerializationException ("The implementation of the IObjectReference interface returns too many nested references to other objects that implement IObjectReference.");
-
- Status = ObjectRecordStatus.ReferenceSolved;
- }
- catch (NullReferenceException) {
- // Give a second chance
- return false;
- }
- }
-
- if (Member != null)
- {
- // If this object is a value object embedded in another object, the parent
- // object must be updated
-
- ObjectRecord containerRecord = manager.GetObjectRecord (IdOfContainingObj);
- containerRecord.SetMemberValue (manager, Member, ObjectInstance);
- }
- else if (ArrayIndex != null)
- {
- ObjectRecord containerRecord = manager.GetObjectRecord (IdOfContainingObj);
- containerRecord.SetArrayValue (manager, ObjectInstance, ArrayIndex);
- }
-
- return true;
- }
-
- public bool HasPendingFixups
- {
- get { return FixupChainAsContainer != null; }
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/OnDeserializedAttribute.cs b/mcs/class/corlib/System.Runtime.Serialization/OnDeserializedAttribute.cs
deleted file mode 100644
index 91df3139e2c..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/OnDeserializedAttribute.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Runtime.Serialization.OnDeserializedAttribute.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization {
-
- [ComVisible(true)]
- [AttributeUsage (AttributeTargets.Method, Inherited=false)]
- public sealed class OnDeserializedAttribute : Attribute {
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/OnDeserializingAttribute.cs b/mcs/class/corlib/System.Runtime.Serialization/OnDeserializingAttribute.cs
deleted file mode 100644
index 0ee65d47be2..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/OnDeserializingAttribute.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Runtime.Serialization.OnDeserializingAttribute.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization {
-
- [ComVisible(true)]
- [AttributeUsage (AttributeTargets.Method, Inherited=false)]
- public sealed class OnDeserializingAttribute : Attribute {
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/OnSerializedAttribute.cs b/mcs/class/corlib/System.Runtime.Serialization/OnSerializedAttribute.cs
deleted file mode 100644
index 039abd6275a..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/OnSerializedAttribute.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Runtime.Serialization.OnSerializedAttribute.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization {
-
- [ComVisible(true)]
- [AttributeUsage (AttributeTargets.Method, Inherited=false)]
- public sealed class OnSerializedAttribute : Attribute {
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/OnSerializingAttribute.cs b/mcs/class/corlib/System.Runtime.Serialization/OnSerializingAttribute.cs
deleted file mode 100644
index fec122aed5a..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/OnSerializingAttribute.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Runtime.Serialization.OnSerializingAttribute.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization {
-
- [ComVisible(true)]
- [AttributeUsage (AttributeTargets.Method, Inherited=false)]
- public sealed class OnSerializingAttribute : Attribute {
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/OptionalFieldAttribute.cs b/mcs/class/corlib/System.Runtime.Serialization/OptionalFieldAttribute.cs
deleted file mode 100644
index b2fc956871c..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/OptionalFieldAttribute.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// System.Runtime.Serialization.OptionalFieldAttribute.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization {
-
- [ComVisible(true)]
- [AttributeUsage (AttributeTargets.Field, Inherited=false)]
- public sealed class OptionalFieldAttribute : Attribute {
- int version_added;
-
- public int VersionAdded {
- get {
- return version_added;
- }
-
- set {
- version_added = value;
- }
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SafeSerializationEventArgs.cs b/mcs/class/corlib/System.Runtime.Serialization/SafeSerializationEventArgs.cs
deleted file mode 100644
index 79d6679abe0..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SafeSerializationEventArgs.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// System.Runtime.Serialization.SafeSerializationEventArgs
-//
-// Author:
-// Jb Evain (jbevain@novell.com)
-//
-// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization {
-
- public sealed class SafeSerializationEventArgs : EventArgs {
-
- [MonoTODO]
- public StreamingContext StreamingContext {
- get { throw new NotImplementedException (); }
- }
-
- internal SafeSerializationEventArgs ()
- {
- }
-
- [MonoTODO]
- public void AddSerializedState (ISafeSerializationData serializedState)
- {
- throw new NotImplementedException ();
- }
- }
-}
-
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs
deleted file mode 100644
index a047d81a597..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationBinder.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-//
-// (C) Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Runtime.Serialization
-{
- [Serializable]
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public abstract class SerializationBinder
- {
- // Constructor
- protected SerializationBinder ()
- : base ()
- {
- }
-
- public abstract Type BindToType (string assemblyName, string typeName);
-
- public virtual void BindToName (Type serializedType, out string assemblyName, out string typeName)
- {
- assemblyName = null;
- typeName = null;
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs
deleted file mode 100644
index 49fbb1270a1..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationCallbacks.cs
-//
-// Author:
-// Robert Jordan (robertj@gmx.net)
-//
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Reflection;
-
-namespace System.Runtime.Serialization {
-
- internal sealed class SerializationCallbacks
- {
- public delegate void CallbackHandler (StreamingContext context);
-
- readonly ArrayList onSerializingList;
- readonly ArrayList onSerializedList;
- readonly ArrayList onDeserializingList;
- readonly ArrayList onDeserializedList;
-
- public bool HasSerializingCallbacks {
- get {return onSerializingList != null;}
- }
-
- public bool HasSerializedCallbacks {
- get {return onSerializedList != null;}
- }
-
- public bool HasDeserializingCallbacks {
- get {return onDeserializingList != null;}
- }
-
- public bool HasDeserializedCallbacks {
- get {return onDeserializedList != null;}
- }
-
- public SerializationCallbacks (Type type)
- {
- onSerializingList = GetMethodsByAttribute (type, typeof (OnSerializingAttribute));
- onSerializedList = GetMethodsByAttribute (type, typeof (OnSerializedAttribute));
- onDeserializingList = GetMethodsByAttribute (type, typeof (OnDeserializingAttribute));
- onDeserializedList = GetMethodsByAttribute (type, typeof (OnDeserializedAttribute));
- }
-
- const BindingFlags DefaultBindingFlags = BindingFlags.Public | BindingFlags.NonPublic |
- BindingFlags.Instance | BindingFlags.DeclaredOnly;
-
-
- static ArrayList GetMethodsByAttribute (Type type, Type attr)
- {
- ArrayList list = new ArrayList ();
-
- Type t = type;
- while (t != typeof (object)) {
- int count = 0;
-
- foreach (MethodInfo mi in t.GetMethods (DefaultBindingFlags)) {
- if (mi.IsDefined (attr, false)) {
- list.Add (mi);
- count++;
- }
- }
-
- // FIXME: MS.NET is checking for this with the verifier at assembly load time.
- if (count > 1)
- throw new TypeLoadException (
- String.Format ("Type '{0}' has more than one method with the following attribute: '{1}'.", type.AssemblyQualifiedName, attr.FullName));
-
- t = t.BaseType;
- }
-
- // optimize memory usage
- return list.Count == 0 ? null : list;
- }
-
- static void Invoke (ArrayList list, object target, StreamingContext context)
- {
- if (list == null)
- return;
-
- CallbackHandler handler = null;
-
- // construct a delegate from the specified list
- foreach (MethodInfo mi in list) {
- handler = (CallbackHandler)
- Delegate.Combine (
- Delegate.CreateDelegate (typeof (CallbackHandler), target, mi),
- handler);
- }
-
- handler (context);
- }
-
- public void RaiseOnSerializing (object target, StreamingContext contex)
- {
- Invoke (onSerializingList, target, contex);
- }
-
- public void RaiseOnSerialized (object target, StreamingContext contex)
- {
- Invoke (onSerializedList, target, contex);
- }
-
- public void RaiseOnDeserializing (object target, StreamingContext contex)
- {
- Invoke (onDeserializingList, target, contex);
- }
-
- public void RaiseOnDeserialized (object target, StreamingContext contex)
- {
- Invoke (onDeserializedList, target, contex);
- }
-
- static Hashtable cache = new Hashtable ();
- static object cache_lock = new object ();
-
- public static SerializationCallbacks GetSerializationCallbacks (Type t)
- {
- SerializationCallbacks sc = (SerializationCallbacks) cache [t];
- if (sc != null)
- return sc;
-
- // Slow path, new entry, we need to copy
- lock (cache_lock){
- sc = (SerializationCallbacks) cache [t];
- if (sc == null) {
- Hashtable copy = (Hashtable) cache.Clone ();
-
- sc = new SerializationCallbacks (t);
- copy [t] = sc;
- cache = copy;
- }
- return sc;
- }
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs
deleted file mode 100644
index 67d7237bf1c..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationEntry.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Runtime.Serialization
-{
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public struct SerializationEntry
- {
- string name;
- Type objectType;
- object value;
-
- // Properties
- public string Name
- {
- get { return name; }
- }
-
- public Type ObjectType
- {
- get { return objectType; }
- }
-
- public object Value
- {
- get { return value; }
- }
-
- internal SerializationEntry (string name, Type type, object value)
- {
- this.name = name;
- this.objectType = type;
- this.value = value;
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs
deleted file mode 100644
index 60c3a5c5ece..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// System.Runtime.Serialization/SerializationException.cs
-//
-// Author:
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.Serialization;
-
-namespace System.Runtime.Serialization {
-
- [Serializable]
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public class SerializationException : SystemException {
- // Constructors
- public SerializationException ()
- : base ("An error occurred during (de)serialization")
- {
- }
-
- public SerializationException (string message)
- : base (message)
- {
- }
-
- public SerializationException (string message, Exception innerException)
- : base (message, innerException)
- {
- }
-
- protected SerializationException (SerializationInfo info, StreamingContext context)
- : base (info, context)
- {
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs
deleted file mode 100644
index 0437329c1f4..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs
+++ /dev/null
@@ -1,390 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationInfo.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-// Duncan Mak (duncan@ximian.com)
-// Dietmar Maurer (dietmar@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections.Generic;
-
-namespace System.Runtime.Serialization
-{
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public sealed class SerializationInfo
- {
- Dictionary serialized = new Dictionary ();
- List values = new List ();
-
- string assemblyName; // the assembly being serialized
- string fullTypeName; // the type being serialized.
- Type objectType;
- bool isAssemblyNameSetExplicit;
- bool isFullTypeNameSetExplicit;
-
- IFormatterConverter converter;
-
- /* used by the runtime */
- private SerializationInfo (Type type)
- {
- assemblyName = type.Assembly.FullName;
- fullTypeName = type.FullName;
- converter = new FormatterConverter ();
- objectType = type;
- }
-
- /* used by the runtime */
- private SerializationInfo (Type type, SerializationEntry [] data)
- {
- int len = data.Length;
-
- assemblyName = type.Assembly.FullName;
- fullTypeName = type.FullName;
- converter = new FormatterConverter ();
- objectType = type;
-
- for (int i = 0; i < len; i++) {
- serialized.Add (data [i].Name, data [i]);
- values.Add (data [i]);
- }
- }
-
- // Constructor
- [CLSCompliant (false)]
- public SerializationInfo (Type type, IFormatterConverter converter)
- {
- if (type == null)
- throw new ArgumentNullException ("type", "Null argument");
-
- if (converter == null)
- throw new ArgumentNullException ("converter", "Null argument");
-
- this.converter = converter;
- assemblyName = type.Assembly.FullName;
- fullTypeName = type.FullName;
- objectType = type;
- }
-
- // Properties
- public string AssemblyName
- {
- get { return assemblyName; }
-
- set {
- if (value == null)
- throw new ArgumentNullException ("Argument is null.");
- assemblyName = value;
- isAssemblyNameSetExplicit = true;
- }
- }
-
- public string FullTypeName
- {
- get { return fullTypeName; }
-
- set {
- if ( value == null)
- throw new ArgumentNullException ("Argument is null.");
- fullTypeName = value;
- isFullTypeNameSetExplicit = true;
- }
- }
-
- public int MemberCount
- {
- get { return serialized.Count; }
- }
-
- public bool IsAssemblyNameSetExplicit {
- get {
- return isAssemblyNameSetExplicit;
- }
- }
-
- public bool IsFullTypeNameSetExplicit {
- get {
- return isFullTypeNameSetExplicit;
- }
- }
-
- public Type ObjectType {
- get {
- return objectType;
- }
- }
-
- // Methods
- public void AddValue (string name, object value, Type type)
- {
- if (name == null)
- throw new ArgumentNullException ("name is null");
- if (type == null)
- throw new ArgumentNullException ("type is null");
-
- if (serialized.ContainsKey (name))
- throw new SerializationException ("Value has been serialized already.");
-
- SerializationEntry entry = new SerializationEntry (name, type, value);
-
- serialized.Add (name, entry);
- values.Add (entry);
- }
-
- public object GetValue (string name, Type type)
- {
- if (name == null)
- throw new ArgumentNullException ("name is null.");
- if (type == null)
- throw new ArgumentNullException ("type");
- if (!serialized.ContainsKey (name))
- throw new SerializationException ("No element named " + name + " could be found.");
-
- SerializationEntry entry = serialized [name];
-
- if (entry.Value != null && !type.IsInstanceOfType (entry.Value))
- return converter.Convert (entry.Value, type);
- else
- return entry.Value;
- }
-
- internal bool HasKey (string name)
- {
- return serialized.ContainsKey (name);
- }
-
- public void SetType (Type type)
- {
- if (type == null)
- throw new ArgumentNullException ("type is null.");
-
- fullTypeName = type.FullName;
- assemblyName = type.Assembly.FullName;
- objectType = type;
- isAssemblyNameSetExplicit = false;
- isFullTypeNameSetExplicit = false;
- }
-
- public SerializationInfoEnumerator GetEnumerator ()
- {
- return new SerializationInfoEnumerator (values);
- }
-
- public void AddValue (string name, short value)
- {
- AddValue (name, value, typeof (System.Int16));
- }
-
- [CLSCompliant(false)]
- public void AddValue (string name, UInt16 value)
- {
- AddValue (name, value, typeof (System.UInt16));
- }
-
- public void AddValue (string name, int value)
- {
- AddValue (name, value, typeof (System.Int32));
- }
-
- public void AddValue (string name, byte value)
- {
- AddValue (name, value, typeof (System.Byte));
- }
-
- public void AddValue (string name, bool value)
- {
- AddValue (name, value, typeof (System.Boolean));
- }
-
- public void AddValue (string name, char value)
- {
- AddValue (name, value, typeof (System.Char));
- }
-
- [CLSCompliant(false)]
- public void AddValue (string name, SByte value)
- {
- AddValue (name, value, typeof (System.SByte));
- }
-
- public void AddValue (string name, double value)
- {
- AddValue (name, value, typeof (System.Double));
- }
-
- public void AddValue (string name, Decimal value)
- {
- AddValue (name, value, typeof (System.Decimal));
- }
-
- public void AddValue (string name, DateTime value)
- {
- AddValue (name, value, typeof (System.DateTime));
- }
-
- public void AddValue (string name, float value)
- {
- AddValue (name, value, typeof (System.Single));
- }
-
- [CLSCompliant(false)]
- public void AddValue (string name, UInt32 value)
- {
- AddValue (name, value, typeof (System.UInt32));
- }
-
- public void AddValue (string name, long value)
- {
- AddValue (name, value, typeof (System.Int64));
- }
-
- [CLSCompliant(false)]
- public void AddValue (string name, UInt64 value)
- {
- AddValue (name, value, typeof (System.UInt64));
- }
-
- public void AddValue (string name, object value)
- {
- if (value == null)
- AddValue (name, value, typeof (System.Object));
- else
- AddValue (name, value, value.GetType ());
- }
-
- public bool GetBoolean (string name)
- {
- object value = GetValue (name, typeof (System.Boolean));
- return converter.ToBoolean (value);
- }
-
- public byte GetByte (string name)
- {
- object value = GetValue (name, typeof (System.Byte));
- return converter.ToByte (value);
- }
-
- public char GetChar (string name)
- {
- object value = GetValue (name, typeof (System.Char));
- return converter.ToChar (value);
- }
-
- public DateTime GetDateTime (string name)
- {
- object value = GetValue (name, typeof (System.DateTime));
- return converter.ToDateTime (value);
- }
-
- public Decimal GetDecimal (string name)
- {
- object value = GetValue (name, typeof (System.Decimal));
- return converter.ToDecimal (value);
- }
-
- public double GetDouble (string name)
- {
- object value = GetValue (name, typeof (System.Double));
- return converter.ToDouble (value);
- }
-
- public short GetInt16 (string name)
- {
- object value = GetValue (name, typeof (System.Int16));
- return converter.ToInt16 (value);
- }
-
- public int GetInt32 (string name)
- {
- object value = GetValue (name, typeof (System.Int32));
- return converter.ToInt32 (value);
- }
-
- public long GetInt64 (string name)
- {
- object value = GetValue (name, typeof (System.Int64));
- return converter.ToInt64 (value);
- }
-
- [CLSCompliant(false)]
- public SByte GetSByte (string name)
- {
- object value = GetValue (name, typeof (System.SByte));
- return converter.ToSByte (value);
- }
-
- public float GetSingle (string name)
- {
- object value = GetValue (name, typeof (System.Single));
- return converter.ToSingle (value);
- }
-
- public string GetString (string name)
- {
- object value = GetValue (name, typeof (System.String));
- if (value == null) return null;
- return converter.ToString (value);
- }
-
- [CLSCompliant(false)]
- public UInt16 GetUInt16 (string name)
- {
- object value = GetValue (name, typeof (System.UInt16));
- return converter.ToUInt16 (value);
- }
-
- [CLSCompliant(false)]
- public UInt32 GetUInt32 (string name)
- {
- object value = GetValue (name, typeof (System.UInt32));
- return converter.ToUInt32 (value);
- }
- [CLSCompliant(false)]
- public UInt64 GetUInt64 (string name)
- {
- object value = GetValue (name, typeof (System.UInt64));
- return converter.ToUInt64 (value);
- }
-
- /* used by the runtime */
-#pragma warning disable 169
- private SerializationEntry [] get_entries ()
- {
- SerializationEntry [] res = new SerializationEntry [this.MemberCount];
- int i = 0;
-
- foreach (SerializationEntry e in this)
- res [i++] = e;
-
- return res;
- }
-#pragma warning restore 169
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs
deleted file mode 100644
index 9319baa3dc6..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationInfoEnumerator.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-//
-// (C) Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace System.Runtime.Serialization
-{
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public sealed class SerializationInfoEnumerator : IEnumerator
- {
- IEnumerator enumerator;
-
- // Constructor
- internal SerializationInfoEnumerator (IEnumerable list)
- {
- this.enumerator = list.GetEnumerator ();
- }
-
- // Properties
- public SerializationEntry Current
- {
- get { return (SerializationEntry) enumerator.Current; }
- }
-
- object IEnumerator.Current
- {
- get { return enumerator.Current; }
- }
-
- public string Name
- {
- get { return this.Current.Name; }
- }
-
- public Type ObjectType
- {
- get { return this.Current.ObjectType; }
- }
-
- public object Value
- {
- get { return this.Current.Value; }
- }
-
- // Methods
- public bool MoveNext ()
- {
- return enumerator.MoveNext ();
- }
-
- public void Reset ()
- {
- enumerator.Reset ();
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationObjectManager.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationObjectManager.cs
deleted file mode 100644
index 3997f94b4c4..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SerializationObjectManager.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationObjectManager.cs
-//
-// Author:
-// Robert Jordan (robertj@gmx.net)
-//
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace System.Runtime.Serialization {
-
- public sealed class SerializationObjectManager
- {
- readonly StreamingContext context;
- readonly Hashtable seen = new Hashtable (HashHelper.Instance, HashHelper.Instance);
-
- event SerializationCallbacks.CallbackHandler callbacks;
-
- public SerializationObjectManager (StreamingContext context)
- {
- this.context = context;
- }
-
- public void RegisterObject (object obj)
- {
- if (seen.Contains (obj))
- return;
-
- SerializationCallbacks sc = SerializationCallbacks
- .GetSerializationCallbacks (obj.GetType ());
-
- seen [obj] = HashHelper.NonNullObject;
- sc.RaiseOnSerializing (obj, context);
-
- if (sc.HasSerializedCallbacks) {
- // record for later invocation
- callbacks += delegate (StreamingContext ctx)
- {
- sc.RaiseOnSerialized (obj, ctx);
- };
- }
- }
-
- public void RaiseOnSerializedEvent ()
- {
- if (callbacks != null)
- callbacks (context);
- }
-
- class HashHelper : IHashCodeProvider, IComparer {
- public static object NonNullObject = new object ();
- public static HashHelper Instance = new HashHelper ();
-
- private HashHelper ()
- {
- }
-
- public int GetHashCode (object obj)
- {
- if (obj == null)
- return 0;
- return Object.InternalGetHashCode (obj);
- }
-
- public int Compare (object x, object y)
- {
- return Object.ReferenceEquals (x, y) ? 0 : 1;
- }
- }
- }
-}
-
diff --git a/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs b/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs
deleted file mode 100644
index 8dc4556f584..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// System.Runtime.Serialization.StreamingContext.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.Serialization {
-
- [Serializable]
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- [StructLayout (LayoutKind.Sequential)]
- public struct StreamingContext {
- StreamingContextStates state;
- object additional;
-
- public StreamingContext (StreamingContextStates state)
- {
- this.state = state;
- additional = null;
- }
-
- public StreamingContext (StreamingContextStates state, object additional)
- {
- this.state = state;
- this.additional = additional;
- }
-
- public object Context {
- get {
- return additional;
- }
- }
-
- public StreamingContextStates State {
- get {
- return state;
- }
- }
-
- override public bool Equals (Object obj)
- {
- StreamingContext other;
-
- if (!(obj is StreamingContext))
- return false;
-
- other = (StreamingContext) obj;
-
- return (other.state == this.state) && (other.additional == this.additional);
- }
-
- override public int GetHashCode ()
- {
- return (int) state;
- }
- }
-}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs b/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs
deleted file mode 100644
index 741cc183c36..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// StreamingContextStates.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
-// Created: Wed, 5 Sep 2001 06:45:18 UTC
-// Source file: all.xml
-// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Runtime.Serialization {
-
-
- ///
- ///
- [Flags]
- [Serializable]
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public enum StreamingContextStates {
-
- ///
- ///
- CrossProcess = 1,
-
- ///
- ///
- CrossMachine = 2,
-
- ///
- ///
- File = 4,
-
- ///
- ///
- Persistence = 8,
-
- ///
- ///
- Remoting = 16,
-
- ///
- ///
- Other = 32,
-
- ///
- ///
- Clone = 64,
-
- CrossAppDomain = 128,
-
- ///
- ///
- All = 255,
- } // StreamingContextStates
-
-} // System.Runtime.Serialization
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs b/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs
deleted file mode 100644
index 0cd9d1e01f2..00000000000
--- a/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// System.Runtime.Serialization.SurrogateSelector.cs
-//
-// Author: Duncan Mak (duncan@ximian.com)
-// Lluis Sanchez (lsg@ctv.es)
-//
-// (C) Ximian, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace System.Runtime.Serialization
-{
- [System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public class SurrogateSelector : ISurrogateSelector
- {
- // Fields
- Hashtable Surrogates = new Hashtable ();
- ISurrogateSelector nextSelector = null;
-
- // Constructor
- public SurrogateSelector()
- : base ()
- {
- }
-
- // Methods
- public virtual void AddSurrogate (Type type,
- StreamingContext context, ISerializationSurrogate surrogate)
- {
- if (type == null || surrogate == null)
- throw new ArgumentNullException ("Null reference.");
-
- string currentKey = type.FullName + "#" + context.ToString ();
-
- if (Surrogates.ContainsKey (currentKey))
- throw new ArgumentException ("A surrogate for " + type.FullName + " already exists.");
-
- Surrogates.Add (currentKey, surrogate);
- }
-
- public virtual void ChainSelector (ISurrogateSelector selector)
- {
- if (selector == null)
- throw new ArgumentNullException ("Selector is null.");
-
- // Chain the selector at the beggining of the chain
- // since "The last selector added to the list will be the first one checked"
- // (from MS docs)
-
- if (nextSelector != null)
- selector.ChainSelector (nextSelector);
-
- nextSelector = selector;
- }
-
- public virtual ISurrogateSelector GetNextSelector ()
- {
- return nextSelector;
- }
-
- public virtual ISerializationSurrogate GetSurrogate (Type type,
- StreamingContext context, out ISurrogateSelector selector)
- {
- if (type == null)
- throw new ArgumentNullException ("type is null.");
-
- // Check this selector, and if the surrogate is not found,
- // check the chained selectors
-
- string key = type.FullName + "#" + context.ToString ();
- ISerializationSurrogate surrogate = (ISerializationSurrogate) Surrogates [key];
-
- if (surrogate != null) {
- selector = this;
- return surrogate;
- }
-
- if (nextSelector != null)
- return nextSelector.GetSurrogate (type, context, out selector);
- else {
- selector = null;
- return null;
- }
- }
-
- public virtual void RemoveSurrogate (Type type, StreamingContext context)
- {
- if (type == null)
- throw new ArgumentNullException ("type is null.");
-
- string key = type.FullName + "#" + context.ToString ();
- Surrogates.Remove (key);
- }
- }
-}
diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs
index d6222065e29..b4afbe2eb84 100644
--- a/mcs/class/corlib/System/Array.cs
+++ b/mcs/class/corlib/System/Array.cs
@@ -653,6 +653,21 @@ namespace System
return CreateInstance (elementType, length);
}
+ internal static Array UnsafeCreateInstance(Type elementType, int[] lengths, int[] lowerBounds)
+ {
+ return CreateInstance(elementType, lengths, lowerBounds);
+ }
+
+ internal static Array UnsafeCreateInstance (Type elementType, int length1, int length2)
+ {
+ return CreateInstance (elementType, length1, length2);
+ }
+
+ internal static Array UnsafeCreateInstance (Type elementType, params int[] lengths)
+ {
+ return CreateInstance(elementType, lengths);
+ }
+
public static Array CreateInstance (Type elementType, int length)
{
int[] lengths = {length};
diff --git a/mcs/class/corlib/System/Delegate.cs b/mcs/class/corlib/System/Delegate.cs
index 26fff1d5c46..bd2835cae43 100644
--- a/mcs/class/corlib/System/Delegate.cs
+++ b/mcs/class/corlib/System/Delegate.cs
@@ -609,5 +609,10 @@ namespace System
return RemotingServices.IsTransparentProxy (m_target);
#endif
}
+
+ internal static Delegate CreateDelegateNoSecurityCheck (RuntimeType type, Object firstArgument, MethodInfo method)
+ {
+ return CreateDelegate_internal (type, firstArgument, method, true);
+ }
}
}
diff --git a/mcs/class/corlib/System/DelegateSerializationHolder.cs b/mcs/class/corlib/System/DelegateSerializationHolder.cs
index 74d704422d2..91cbb36e24f 100644
--- a/mcs/class/corlib/System/DelegateSerializationHolder.cs
+++ b/mcs/class/corlib/System/DelegateSerializationHolder.cs
@@ -71,7 +71,7 @@ namespace System
realTarget = info.GetValue (target.ToString(), typeof(object));
var key = "method" + index;
- var method = info.HasKey (key) ? (MethodInfo)info.GetValue (key, typeof (MethodInfo)) : null;
+ var method = (MethodInfo)info.GetValueNoThrow (key, typeof(MethodInfo));
Assembly dasm = Assembly.Load (assembly);
Type dt = dasm.GetType (type);
diff --git a/mcs/class/corlib/System/RuntimeFieldHandle.cs b/mcs/class/corlib/System/RuntimeFieldHandle.cs
index 1944ff8065b..c6cd9f006f3 100644
--- a/mcs/class/corlib/System/RuntimeFieldHandle.cs
+++ b/mcs/class/corlib/System/RuntimeFieldHandle.cs
@@ -35,6 +35,7 @@ using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Runtime.ConstrainedExecution;
+using System.Runtime.CompilerServices;
namespace System
{
@@ -106,5 +107,13 @@ namespace System
{
return !left.Equals (right);
}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern void SetValueInternal (FieldInfo fi, object obj, object value);
+
+ internal static void SetValue (RtFieldInfo field, Object obj, Object value, RuntimeType fieldType, FieldAttributes fieldAttr, RuntimeType declaringType, ref bool domainInitialized)
+ {
+ SetValueInternal (field, obj, value);
+ }
}
}
diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/BinaryFormatterTest.cs b/mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/BinaryFormatterTest.cs
index 7cf781c6531..37bff6f109f 100644
--- a/mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/BinaryFormatterTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/BinaryFormatterTest.cs
@@ -62,6 +62,45 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Binary
}
}
+ namespace NestedA
+ {
+ [Serializable]
+ public class QualifiedFieldTest
+ {
+ int value = 0;
+
+ public int ValueA {
+ get { return value; }
+ set { this.value = value; }
+ }
+ }
+ }
+
+ namespace NestedB
+ {
+ [Serializable]
+ public class QualifiedFieldTest : NestedA.QualifiedFieldTest
+ {
+ int value = 0;
+
+ public int ValueB {
+ get { return value; }
+ set { this.value = value; }
+ }
+ }
+ }
+
+ [Serializable]
+ public class QualifiedFieldTest : NestedB.QualifiedFieldTest
+ {
+ int value = 0;
+
+ public int Value {
+ get { return value; }
+ set { this.value = value; }
+ }
+ }
+
class SurrogateSelector: ISurrogateSelector
{
public void ChainSelector (ISurrogateSelector selector)
@@ -452,6 +491,23 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Binary
return ms;
}
+ [Test]
+ public void QualifiedField()
+ {
+ QualifiedFieldTest a = new QualifiedFieldTest ();
+ a.ValueA = 1;
+ a.ValueB = 2;
+ a.Value = 3;
+ Stream ms = new MemoryStream ();
+ BinaryFormatter bf = new BinaryFormatter ();
+ bf.Serialize(ms, a);
+ ms.Position = 0;
+ QualifiedFieldTest b = (QualifiedFieldTest)bf.Deserialize (ms);
+ Assert.AreEqual (a.ValueA, b.ValueA, "#1");
+ Assert.AreEqual (a.ValueB, b.ValueB, "#2");
+ Assert.AreEqual (a.Value, b.Value, "#3");
+ }
+
#if NET_4_0
[Test]
public void SerializationBindToName ()
diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources
index 3cc53262fa3..e9544e781b2 100644
--- a/mcs/class/corlib/corlib.dll.sources
+++ b/mcs/class/corlib/corlib.dll.sources
@@ -945,63 +945,6 @@ System.Runtime.Remoting.Proxies/ProxyAttribute.cs
System.Runtime.Remoting.Services/EnterpriseServicesHelper.cs
System.Runtime.Remoting.Services/ITrackingHandler.cs
System.Runtime.Remoting.Services/TrackingServices.cs
-System.Runtime.Serialization/Formatter.cs
-System.Runtime.Serialization/FormatterConverter.cs
-System.Runtime.Serialization/FormatterServices.cs
-System.Runtime.Serialization/IDeserializationCallback.cs
-System.Runtime.Serialization/IFormatter.cs
-System.Runtime.Serialization/IFormatterConverter.cs
-System.Runtime.Serialization/IObjectReference.cs
-System.Runtime.Serialization/ISafeSerializationData.cs
-System.Runtime.Serialization/ISerializable.cs
-System.Runtime.Serialization/ISerializationSurrogate.cs
-System.Runtime.Serialization/ISurrogateSelector.cs
-System.Runtime.Serialization/ObjectIDGenerator.cs
-System.Runtime.Serialization/ObjectManager.cs
-System.Runtime.Serialization/OnDeserializedAttribute.cs
-System.Runtime.Serialization/OnDeserializingAttribute.cs
-System.Runtime.Serialization/OnSerializedAttribute.cs
-System.Runtime.Serialization/OnSerializingAttribute.cs
-System.Runtime.Serialization/OptionalFieldAttribute.cs
-System.Runtime.Serialization/SafeSerializationEventArgs.cs
-System.Runtime.Serialization/SerializationBinder.cs
-System.Runtime.Serialization/SerializationCallbacks.cs
-System.Runtime.Serialization/SerializationEntry.cs
-System.Runtime.Serialization/SerializationException.cs
-System.Runtime.Serialization/SerializationInfo.cs
-System.Runtime.Serialization/SerializationInfoEnumerator.cs
-System.Runtime.Serialization/SerializationObjectManager.cs
-System.Runtime.Serialization/StreamingContext.cs
-System.Runtime.Serialization/StreamingContextStates.cs
-System.Runtime.Serialization/SurrogateSelector.cs
-System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
-System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
-System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
-System.Runtime.Serialization.Formatters/IFieldInfo.cs
-System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
-System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
-System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
-System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
-System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
-System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
-System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
-System.Runtime.Serialization.Formatters/InternalParseStateE.cs
-System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
-System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
-System.Runtime.Serialization.Formatters/InternalRM.cs
-System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
-System.Runtime.Serialization.Formatters/InternalST.cs
-System.Runtime.Serialization.Formatters/ISoapMessage.cs
-System.Runtime.Serialization.Formatters/ServerFault.cs
-System.Runtime.Serialization.Formatters/SoapFault.cs
-System.Runtime.Serialization.Formatters/SoapMessage.cs
-System.Runtime.Serialization.Formatters/TypeFilterLevel.cs
-System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs
-System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs
-System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
-System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
-System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
-System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs
System.Runtime.Versioning/CompatibilitySwitch.cs
System.Runtime.Versioning/ComponentGuaranteesAttribute.cs
System.Runtime.Versioning/ComponentGuaranteesOptions.cs
@@ -1396,6 +1339,8 @@ ReferenceSources/EncodingDataItem.cs
ReferenceSources/EncodingTable.cs
ReferenceSources/TypeNameParser.cs
ReferenceSources/RuntimeType.cs
+ReferenceSources/RemotingFieldCachedData.cs
+ReferenceSources/MessageDictionary.cs
../../../external/referencesource/mscorlib/system/__filters.cs
../../../external/referencesource/mscorlib/system/__hresults.cs
@@ -1644,6 +1589,51 @@ ReferenceSources/RuntimeType.cs
../../../external/referencesource/mscorlib/system/text/stringbuildercache.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/deserializationeventhandler.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatterconverter.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatterservices.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/ideserializationcallback.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/iformatter.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/iformatterconverter.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/iobjectreference.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/iserializable.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/iserializationsurrogate.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/isurrogateselector.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/memberholder.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/objectclonehelper.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/objectidgenerator.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/objectmanager.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/safeserializationmanager.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/serializationattributes.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/serializationbinder.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/serializationeventscache.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/serializationexception.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/serializationfieldinfo.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/serializationinfo.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/serializationinfoenumerator.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/serializationobjectmanager.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/streamingcontext.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/surrogateselector.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/valuetypefixupinfo.cs
+
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binarycommonclasses.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryconverter.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryenums.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatterwriter.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binarymethodmessage.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectinfo.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectreader.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectwriter.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryparser.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryutilclasses.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/commonenums.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/ifieldinfo.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/isoapmessage.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/sertrace.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/soapfault.cs
+../../../external/referencesource/mscorlib/system/runtime/serialization/formatters/soapmessage.cs
+
../../../external/referencesource/mscorlib/system/threading/abandonedmutexexception.cs
../../../external/referencesource/mscorlib/system/threading/apartmentstate.cs
../../../external/referencesource/mscorlib/system/threading/autoresetevent.cs
diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h
index fb595897837..3fb258a63e8 100644
--- a/mono/metadata/icall-def.h
+++ b/mono/metadata/icall-def.h
@@ -721,6 +721,9 @@ ICALL(REMSER_1, "InternalExecute", ves_icall_InternalExecute)
ICALL(REMSER_2, "IsTransparentProxy", ves_icall_IsTransparentProxy)
#endif
+ICALL_TYPE(RFH, "System.RuntimeFieldHandle", RFH_1)
+ICALL(RFH_1, "SetValueInternal", ves_icall_MonoField_SetValueInternal)
+
ICALL_TYPE(MHAN, "System.RuntimeMethodHandle", MHAN_1)
ICALL(MHAN_1, "GetFunctionPointer", ves_icall_RuntimeMethod_GetFunctionPointer)
--
2.25.1