Browse Source

[corlib] Serialization from reference sources

Marek Safar 10 năm trước cách đây
mục cha
commit
8d097349b3
88 tập tin đã thay đổi với 775 bổ sung10552 xóa
  1. 1 1
      external/referencesource
  2. 5 0
      mcs/class/corlib/ReferenceSources/BCLDebug.cs
  3. 412 0
      mcs/class/corlib/ReferenceSources/MessageDictionary.cs
  4. 21 0
      mcs/class/corlib/ReferenceSources/RemotingFieldCachedData.cs
  5. 19 1
      mcs/class/corlib/ReferenceSources/RuntimeType.cs
  6. 11 0
      mcs/class/corlib/System.Reflection/MonoAssembly.cs
  7. 35 0
      mcs/class/corlib/System.Reflection/MonoField.cs
  8. 5 0
      mcs/class/corlib/System.Reflection/MonoMethod.cs
  9. 6 1
      mcs/class/corlib/System.Reflection/MonoParameterInfo.cs
  10. 12 11
      mcs/class/corlib/System.Runtime.Remoting.Messaging/IInternalMessage.cs
  11. 6 0
      mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs
  12. 40 0
      mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
  13. 5 5
      mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodDictionary.cs
  14. 36 0
      mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
  15. 7 0
      mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
  16. 9 0
      mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
  17. 4 0
      mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
  18. 5 0
      mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
  19. 0 1
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/.gitattributes
  20. 0 235
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs
  21. 0 273
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs
  22. 0 371
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog
  23. 0 405
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs
  24. 0 504
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs
  25. 0 994
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
  26. 0 994
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
  27. 0 1552
      mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/binary_serialization_format.htm
  28. 0 5
      mcs/class/corlib/System.Runtime.Serialization.Formatters/.gitattributes
  29. 0 51
      mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog
  30. 0 55
      mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
  31. 0 55
      mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
  32. 0 59
      mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
  33. 0 56
      mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs
  34. 0 86
      mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs
  35. 0 66
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
  36. 0 57
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
  37. 0 60
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
  38. 0 64
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
  39. 0 84
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
  40. 0 60
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
  41. 0 56
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
  42. 0 60
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs
  43. 0 97
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
  44. 0 112
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
  45. 0 57
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalRM.cs
  46. 0 83
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalST.cs
  47. 0 53
      mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
  48. 0 78
      mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs
  49. 0 101
      mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs
  50. 0 86
      mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs
  51. 0 43
      mcs/class/corlib/System.Runtime.Serialization.Formatters/TypeFilterLevel.cs
  52. 0 347
      mcs/class/corlib/System.Runtime.Serialization/ChangeLog
  53. 0 186
      mcs/class/corlib/System.Runtime.Serialization/Formatter.cs
  54. 0 177
      mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs
  55. 0 218
      mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs
  56. 0 39
      mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs
  57. 0 90
      mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs
  58. 0 57
      mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs
  59. 0 40
      mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs
  60. 0 36
      mcs/class/corlib/System.Runtime.Serialization/ISafeSerializationData.cs
  61. 0 40
      mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs
  62. 0 68
      mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs
  63. 0 65
      mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs
  64. 0 117
      mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs
  65. 0 638
      mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs
  66. 0 38
      mcs/class/corlib/System.Runtime.Serialization/OnDeserializedAttribute.cs
  67. 0 38
      mcs/class/corlib/System.Runtime.Serialization/OnDeserializingAttribute.cs
  68. 0 38
      mcs/class/corlib/System.Runtime.Serialization/OnSerializedAttribute.cs
  69. 0 38
      mcs/class/corlib/System.Runtime.Serialization/OnSerializingAttribute.cs
  70. 0 49
      mcs/class/corlib/System.Runtime.Serialization/OptionalFieldAttribute.cs
  71. 0 50
      mcs/class/corlib/System.Runtime.Serialization/SafeSerializationEventArgs.cs
  72. 0 52
      mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs
  73. 0 160
      mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs
  74. 0 64
      mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs
  75. 0 62
      mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs
  76. 0 390
      mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs
  77. 0 85
      mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs
  78. 0 94
      mcs/class/corlib/System.Runtime.Serialization/SerializationObjectManager.cs
  79. 0 85
      mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs
  80. 0 81
      mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs
  81. 0 120
      mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs
  82. 15 0
      mcs/class/corlib/System/Array.cs
  83. 5 0
      mcs/class/corlib/System/Delegate.cs
  84. 1 1
      mcs/class/corlib/System/DelegateSerializationHolder.cs
  85. 9 0
      mcs/class/corlib/System/RuntimeFieldHandle.cs
  86. 56 0
      mcs/class/corlib/Test/System.Runtime.Serialization.Formatters.Binary/BinaryFormatterTest.cs
  87. 47 57
      mcs/class/corlib/corlib.dll.sources
  88. 3 0
      mono/metadata/icall-def.h

+ 1 - 1
external/referencesource

@@ -1 +1 @@
-Subproject commit fb151e4afeffea5753b84674c888eaa7b274b51e
+Subproject commit 8cbddd1eec236af973d4d9dcb623a4dccde91d52

+ 5 - 0
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;
+		}
 	}
 }

+ 412 - 0
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();
+            }
+        }
+    }
+}

+ 21 - 0
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)
+		{
+		}		
+	}
+}

+ 19 - 1
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; }
 		}		
 	}
-}
+}

+ 11 - 0
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)]

+ 35 - 0
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]

+ 5 - 0
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()]

+ 6 - 1
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) {

+ 12 - 11
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();
+	}
+}

+ 6 - 0
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]

+ 40 - 0
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)

+ 5 - 5
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()

+ 36 - 0
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);
+		}
+
 	}
 }

+ 7 - 0
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; }

+ 9 - 0
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;
+		}
 	}
 }

+ 4 - 0
mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs

@@ -260,5 +260,9 @@ namespace System.Runtime.Remoting {
 				return _serverType;
 			}
 		}
+
+		internal void SetDomainID (int id)
+		{
+		}
 	}
 }

+ 5 - 0
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 (

+ 0 - 1
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/.gitattributes

@@ -1 +0,0 @@
-/binary_serialization_format.htm -crlf

+ 0 - 235
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryCommon.cs

@@ -1,235 +0,0 @@
-// BinaryCommon.cs
-//
-// Author:
-//   Lluis Sanchez Gual ([email protected])
-//
-// (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<size; n+=8) {
-					b = byteArray [n]; byteArray [n] = byteArray [n + 7]; byteArray [n + 7] = b;
-					b = byteArray [n+1]; byteArray [n+1] = byteArray [n + 6]; byteArray [n + 6] = b;
-					b = byteArray [n+2]; byteArray [n+2] = byteArray [n + 5]; byteArray [n + 5] = b;
-					b = byteArray [n+3]; byteArray [n+3] = byteArray [n + 4]; byteArray [n + 4] = b;
-				}
-			} else if (dataSize == 4) {
-				for (int n=0; n<size; n+=4) {
-					b = byteArray [n]; byteArray [n] = byteArray [n + 3]; byteArray [n + 3] = b;
-					b = byteArray [n+1]; byteArray [n+1] = byteArray [n + 2]; byteArray [n + 2] = b;
-				}
-			} else if (dataSize == 2) {
-				for (int n=0; n<size; n+=2) {
-					b = byteArray [n]; byteArray [n] = byteArray [n + 1]; byteArray [n + 1] = b;
-				}
-			}
-		}
-	}
-
-	internal enum BinaryElement : byte
-	{
-		Header = 0,
-		RefTypeObject = 1,
-		UntypedRuntimeObject = 2,
-		UntypedExternalObject = 3,
-		RuntimeObject = 4,
-		ExternalObject = 5,
-		String = 6,
-		GenericArray = 7,
-		BoxedPrimitiveTypeValue = 8,
-		ObjectReference = 9,
-		NullValue = 10,
-		End = 11,
-		Assembly = 12,
-		ArrayFiller8b = 13,
-		ArrayFiller32b = 14,
-		ArrayOfPrimitiveType = 15,
-		ArrayOfObject = 16,
-		ArrayOfString = 17,
-		Method = 18,
-		_Unknown4 = 19,
-		_Unknown5 = 20,
-		MethodCall = 21,
-		MethodResponse = 22
-	}
-
-	internal enum TypeTag : byte
-	{
-		PrimitiveType = 0,
-		String = 1,
-		ObjectType = 2,
-		RuntimeType = 3,
-		GenericType = 4,
-		ArrayOfObject = 5,
-		ArrayOfString = 6,
-		ArrayOfPrimitiveType = 7
-	}
-
-	internal enum ArrayStructure : byte
-	{
-		SingleDimensional = 0,
-		Jagged = 1,
-		MultiDimensional = 2
-	}
-
-	internal enum MethodFlags
-	{
-		NoArguments = 1,
-		PrimitiveArguments = 2,
-		ArgumentsInSimpleArray = 4,
-		ArgumentsInMultiArray = 8,
-		ExcludeLogicalCallContext = 16,
-		IncludesLogicalCallContext = 64,
-		IncludesSignature = 128,
-
-		FormatMask = 15,
-
-		GenericArguments = 0x8000,
-		NeedsInfoArrayMask = 4 + 8 + 64 + 128 + 0x8000,
-	}
-
-	internal enum ReturnTypeTag : byte
-	{
-		Null = 2,
-		PrimitiveType = 8,
-		ObjectType = 16,
-		Exception = 32
-	}
-
-	enum BinaryTypeCode : byte
-	{
-		Boolean = 1,
-		Byte = 2,
-		Char = 3,
-		Decimal = 5,
-		Double = 6,
-		Int16 = 7,
-		Int32 = 8,
-		Int64 = 9,
-		SByte = 10,
-		Single = 11,
-		TimeSpan = 12,
-		DateTime = 13,
-		UInt16 = 14,
-		UInt32 = 15,
-		UInt64 = 16,
-		Null = 17,
-		String = 18
-	}
-
-}

+ 0 - 273
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs

@@ -1,273 +0,0 @@
-// BinaryFormatter.cs
-//
-// Author:
-//	Dick Porter ([email protected])
-//  Lluis Sanchez Gual ([email protected])
-//
-// (C) 2002 Ximian, Inc.  http://www.ximian.com
-// Copyright (C) 2004-2005 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;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Runtime.Remoting.Messaging;
-using System.Security.Permissions;
-
-namespace System.Runtime.Serialization.Formatters.Binary {
-
-	[ComVisible (true)]
-	public sealed class BinaryFormatter :
-#if !FULL_AOT_RUNTIME
-						IRemotingFormatter,
-#endif
-						IFormatter
-	{
-		private FormatterAssemblyStyle assembly_format = FormatterAssemblyStyle.Simple;
-		private SerializationBinder binder;
-		private StreamingContext context;
-		private ISurrogateSelector surrogate_selector;
-		private FormatterTypeStyle type_format = FormatterTypeStyle.TypesAlways;
-		private TypeFilterLevel filter_level = TypeFilterLevel.Full;
-		
-		public BinaryFormatter()
-		{
-			surrogate_selector=DefaultSurrogateSelector;
-			context=new StreamingContext(StreamingContextStates.All);
-		}
-		
-		public BinaryFormatter(ISurrogateSelector selector, StreamingContext context)
-		{
-			surrogate_selector=selector;
-			this.context=context;
-		}
-		
-
-		// Deserializing objects of type Dictionary<,> 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();
-		}
-	}
-}

+ 0 - 371
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog

@@ -1,371 +0,0 @@
-2010-03-16  Jb Evain  <[email protected]>
-
-	* BinaryCommon.cs: use MOONLIGHT symbol to disambiguate
-	MonoTouch and Moonlight code.
-
-2010-02-26  Robert Jordan  <[email protected]>
-
-	* ObjectReader.cs (ReadType, GetDeserializationType):
-	Add throwOnError parameter that specifies whether to throw an
- 	exception if the type/assembly is not found.
-
-	* ObjectReader.cs (ReadTypeMetadata): Ignore unresolvable
- 	types while reading the type info. Fixes #430583.
-
-	* ObjectReader.cs (GetDeserializationType): Rethrow caught
- 	exceptions as SerializationExceptions.
-
-2009-10-31  Sebastien Pouliot  <[email protected]>
-
-	* BinaryCommon.cs: Disable MONO_REFLECTION_SERIALIZER override 
-	for Moonlight plugin.
-
-2009-09-30 Gonzalo Paniagua Javier <[email protected]>
-
-	* BinaryFormatter.cs: NoCheckDeserialize() was using PeekChar() on a
-	reader when it should only read 1 byte. Also BinaryReader.PeekChar()
-	tries to set the position of hte stream back to where it was before
-	the read, which does not work well with broken Stream
-	implementations like BZip2InputStream (reports CanSeek is true when
-	it really can't seek). Now we do a Read() and then pass the value we
-	read on to the next methods.
-
-	* MessageFormatter.cs: 
-	* ObjectReader.cs: added overloads that take a BinaryElement instead
-	of reading it from the reader. Only for the methods used in
-	NoCheckDeserialize.
-
-	Fixes bug #503435.
-
-2009-03-29  Zoltan Varga  <[email protected]>
-
-	* CodeGenerator.cs: Add synchronization as SRE is not thread safe.
-
-2008-09-17  Robert Jordan  <[email protected]>>
-
-	* ObjectReader.cs (ReadTypeMetadata): Replace the check for
-	ISerializable with something less `reflective'.
-	Fixes #421664.
-
-2008-06-27  Andreas Nahr <[email protected]>
-
-	* BinaryFormatter.cs: Fix parameter name
-
-2008-04-26  Jb Evain  <[email protected]>
-
-	* CodeGenerator.cs: replace usage of new Type [0] by
-	Type.EmptyTypes. Found with Gendarme.
-
-2008-04-02  Andreas Nahr  <[email protected]>
-
-	* BinaryFormatter.cs: Fix parameter names
-
-2007-08-25  Robert Jordan  <[email protected]>
-
-	* ObjectReader.cs, ObjectWriter.cs, CodeGenerator.cs:
-	Use DateTime.From/ToBinary. Fixes #82400.
-
-2007-08-25  Alan McGovern  <[email protected]>
-
-	* ObjectReader.cs, ObjectWriter.cs, CodeGenerator.cs:
-	Reverted fix for #82400.
-
-2007-08-25  Robert Jordan  <[email protected]>
-
-	* ObjectReader.cs, ObjectWriter.cs, CodeGenerator.cs:
-	Use DateTime.From/ToBinary. Fixes #82400.
-
-2007-08-23  Robert Jordan  <[email protected]>
-
-	* ObjectReader.cs, ObjectReader.cs: Map between System.MonoType[] and
-	MS.NET's System.RuntimeType[].
-	
-	* ObjectReader.cs (ReadType): When a type couldn't be found, emit
-	a more useful exception.
-
-2007-05-03  Dick Porter  <[email protected]>
-
-	* BinaryFormatter.cs: Update to 2.0 profile
-
-2006-12-25  Robert Jordan  <[email protected]>
-
-	* binary_serialization_format.htm: Update the NET_2_0 format.
-	* BinaryCommon.cs: MethodFlags is actually an int32. Add NET_2_0 flags.
-	* MessageFormatter.cs: Add support for generic method arguments.
-	* ObjectWriter.cs, ObjectReader.cs: Map between System.MonoType and
-	MS.NET's System.RuntimeType.
-
-2006-12-01  Lluis Sanchez Gual <[email protected]> 
-
-	* 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  <[email protected]>
-
-	* ObjectWriter.cs, ObjectReader [NET_2_0]:
-	Use the SerializationObjectManager.
-
-2006-09-05  Raja R Harinath  <[email protected]>
-
-	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  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* ObjectReader.cs: Added null check in GetDeserializationType.
-	Patch by Ben Maurer. Fixes bug #69666.
-
-2005-12-01  Sebastien Pouliot  <[email protected]>
-
-	* BinaryFormatter.cs: Added a demand for SerializationFormatter on 
-	Serialize method (to make some CAS test work correctly).
-
-2005-05-26  Ben Maurer  <[email protected]>
-
-	* CodeGenerator.cs: Move module creation to cctor to kill double
-	checked locking and typeof locking.
-
-2005-05-17  Lluis Sanchez Gual  <[email protected]>
-
-	* CodeGenerator.cs: Don't generate debug info here.
-
-2005-05-09  Lluis Sanchez Gual  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* BinaryCommon.cs: Added helper method for swapping bytes.
-	* ObjectReader.cs:
-	* ObjectWriter.cs: Implemented serialization of arrays of primitive
-	types using Buffer.BlockCopy to create byffers of data that is written/
-	read in a single call. It's much faster now.
-
-2005-03-01  Lluis Sanchez Gual  <[email protected]>
-
-	* BinaryCommon.cs: Found the meaning of two unknown binary elements.
-	* CodeGenerator.cs: Derive generated classes from ClrTypeMetadata
-	instead of TypeMetadata. Added writeTypes parameter to WriteTypeData().
-	* ObjectWriter.cs: Use type and assembly names as keys for the type and
-	assembly caches. This is needed since ISerializable types can provide
-	fake type names (which are mapped to real types by a binder on
-	deserialization).
-	Implemented support for BinaryFormatter.TypeFormat.
-	* BinaryFormatter.cs, MessageFormatter.cs: Implemented support for
-	TypeFormat property.
-	* ObjectReader.cs: Added support for objects serialized without
-	member type information. This fixes bug #73114.
-	If a binder return null, use the default way of loading the type.
-
-2005-02-25  Lluis Sanchez Gual  <[email protected]>
-
-	* ObjectReader.cs: In ReadArrayOfPrimitiveType, added a specific
-	read loop for each type. It's much faster and avoids value boxings.
-
-2005-01-10  Lluis Sanchez Gual  <[email protected]>
-
-	* BinaryCommon.cs: IntPtr is not a primitive type in the serialization
-	world. This fixes bug #70757.
-
-2004-12-15  Lluis Sanchez Gual  <[email protected]>
-
-	* ObjectReader.cs: Use GetField instead of GetMembers. Properties can't
-	be serialized, so it makes no sense to use GetMembers.
-
-2004-12-08  Zoltan Varga  <[email protected]>
-
-	* CodeGenerator.cs: Call new DefineInternalDynamicAssembly method to prevent a race
-	condition in the setting of the CorlibInternal flag.
-
-2004-12-06  Zoltan Varga  <[email protected]>
-
-	* CodeGenerator.cs: Mark the created assembly builder as internal.
-
-2004-11-29  Lluis Sanchez Gual  <[email protected]>
-
-	* CodeGenerator.cs: Addded EnumToUnderlying method to get the underlying
-	type of an enum. This fixes bug #69753.
-
-2004-07-02  Lluis Sanchez Gual  <[email protected]>
-
-	* BinaryCommon.cs: Added CheckSerializable method.
-	* ObjectWriter.cs: Check for type serializability even for members with
-	  null values.
-	
-2004-05-29  Gonzalo Paniagua Javier <[email protected]>
-
-	* ObjectWriter.cs: reduce contention in GetObjectData.
-
-2004-05-14  Vladimir Vukicevic  <[email protected]>
-
-	* binary_serialization_format.htm: renamed filename from having
-	  spaces to _'s (checked with lluis)
-
-2004-05-13  Lluis Sanchez Gual  <[email protected]>
-
-	* ObjectWriter.cs: Fixed and Simplified WriteGenericArray and 
-	  WriteSingleDimensionArrayElements. This also fixes bug #58345.
-
-2004-05-03  Lluis Sanchez Gual  <[email protected]>
-
-	* MessageFormatter.cs: In the all-are-primitive case, serialize Args, 
-	  not OutArgs.
-
-2004-04-28  Lluis Sanchez Gual <[email protected]>
-
-	* MessageFormatter.cs: Serialize Args, not OutArgs, like in MS.NET.
-
-2004-04-26  Lluis Sanchez Gual <[email protected]>
-
-	* ObjectReader.cs, ObjectWriter.cs: FIXME cleaning.
-
-2004-04-20  Lluis Sanchez Gual <[email protected]>
-
-	* CodeGenerator.cs, ObjectReader.cs, ObjectWriter.cs: Serialize decimals
-	  as strings, like in MS.NET. This fixes bug #57186.
-
-2004-02-23  Lluis Sanchez Gual <[email protected]>
-
-	* 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 <[email protected]>
-
-	* 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 <[email protected]>
-
-	* 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 <[email protected]>
-
-	* 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 <[email protected]>
-
-	* BinaryFormatter.cs: Added missing methods.
-
-2003-11-20  Lluis Sanchez Gual <[email protected]>
-
-	* BinaryFormatter.cs, MessageFormatter.cs, ObjectReader.cs: Added support
-	  for TypeFilter property.
-
-2003-11-16  Lluis Sanchez Gual <[email protected]>
-
-	* BinaryFormatter.cs, MessageFormatter.cs, ObjectWriter.cs: 
-	  Implemented support for AssemblyFormat property.
-
-2003-11-12  Lluis Sanchez Gual <[email protected]>
-
-	* ObjectReader.cs, ObjectWriter.cs: Changed some GetType calls to "is" checks.
-
-2003-07-28  Duncan Mak  <[email protected]>
-
-	* BinaryFormatter.cs (WriteBinaryHeader): changed from public to
-	private.
-
-2003-07-25  Lluis Sanchez Gual <[email protected]>
-
-    * MessageFormatter.cs: WriteMethodCall(): It must write all parameters,
-      including ref and out.
-
-2003-07-24  Lluis Sanchez Gual <[email protected]>
-
-    * ObjectReader.cs, ObjectWriter.cs, BinaryCommon.cs: Fixed bug #45970.
-
-2003-07-17  Lluis Sanchez Gual <[email protected]>
-
-    * 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 <[email protected]>
-
-    * 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 <[email protected]>
-
-	* BinaryFormatter.cs: Implemented support for binders.
-    * MessageFormatter.cs: Implemented support for binders.
-    * ObjectReader.cs: Implemented support for binders.
-
-2003-02-04  Lluis Sanchez Gual <[email protected]>
-
-    * 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 <[email protected]>
-
-    * MessageFormatter.cs: Corrected some bugs that affected serialization of exceptions
-
-2003-02-04  Lluis Sanchez Gual <[email protected]>
-
-    * MessageFormatter.cs: Implemented serialization of message properties.
-
-2003-01-24  Martin Baulig  <[email protected]>
-
-	* ObjectReader.cs (ReadNextObject): Call
-	RaiseDeserializationEvent() on the ObjectManager when we're done
-	reading the whole graph.
-
-2003-01-24  Lluis Sanchez Gual <[email protected]>
-
-    * 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 <[email protected]>
-
-	* ObjectWriter.cs: make the exception message more useful.
-
-2003-01-16  Lluis Sanchez Gual <[email protected]>
-
-    * BinaryFormatter.cs: implemented Serialize and Deserialize methods.
-    * ObjectReader.cs: added.
-    * ObjectWriter.cs: added.
-    * BinaryCommon.cs. added.
-
-2002-08-22  Nick Drochak  <[email protected]>
-
-	* BinaryArrayTypeEnum.cs: Removed Non-existent enum (must have been
-	from beta days)
-
-2002-08-18  Dick Porter  <[email protected]>
-
-	* BinaryFormatter.cs: Stubbed out

+ 0 - 405
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/CodeGenerator.cs

@@ -1,405 +0,0 @@
-// CodeGenerator.cs
-//
-// Author:
-//   Lluis Sanchez Gual ([email protected])
-//
-// (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

+ 0 - 504
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs

@@ -1,504 +0,0 @@
-//
-// System.Runtime.Remoting.MessageFormatter.cs
-//
-// Author: Lluis Sanchez Gual ([email protected])
-//
-// (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<call.ArgCount; n++)
-				{
-					object arg = call.GetArg(n);
-					if (arg != null) {
-						writer.Write (BinaryCommon.GetTypeCode (arg.GetType()));
-						ObjectWriter.WritePrimitiveValue (writer, arg);
-					}
-					else
-						writer.Write ((byte)BinaryTypeCode.Null);
-				}
-			}
-
-			if ( infoArraySize > 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<resp.ArgCount; n++)
-				{
-					object val = resp.GetArg(n);
-					if (val != null) {
-						writer.Write (BinaryCommon.GetTypeCode (val.GetType()));
-						ObjectWriter.WritePrimitiveValue (writer, val);
-					}
-					else
-						writer.Write ((byte)BinaryTypeCode.Null);
-				}
-			}
-
-			if (infoArrayLength > 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<count; n++)
-				{
-					Type type = BinaryCommon.GetTypeFromCode (reader.ReadByte());
-					arguments[n] = ObjectReader.ReadPrimitiveTypeValue (reader, type);
-				}
-			}
-
-			if ((flags & MethodFlags.NeedsInfoArrayMask) > 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<count; n++) {
-					Type type = BinaryCommon.GetTypeFromCode (reader.ReadByte());
-					outArgs[n] = ObjectReader.ReadPrimitiveTypeValue (reader, type);
-				}
-			}
-
-			if (hasContextInfo || (typeTag & ReturnTypeTag.ObjectType) > 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;
-		}
-
-	}
-}

+ 0 - 994
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs

@@ -1,994 +0,0 @@
-// ObjectReader.cs
-//
-// Author:
-//   Lluis Sanchez Gual ([email protected])
-//   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<metadata.FieldCount; n++)
-					ReadValue (reader, objectInstance, objectId, info, metadata.MemberTypes[n], metadata.MemberNames[n], null, null);
-			} else
-				for (int n=0; n<metadata.FieldCount; n++) {
-					if (metadata.MemberInfos [n] != null)
-						ReadValue (reader, objectInstance, objectId, info, metadata.MemberTypes[n], metadata.MemberInfos[n].Name, metadata.MemberInfos[n], null);
-					else if (BinaryCommon.IsPrimitive(metadata.MemberTypes[n])) {
-						// Since the member info is null, the type in this
-						// domain does not have this type. Even though we
-						// are not going to store the value, we will read
-						// it from the stream so that we can advance to the
-						// next block.
-						ReadPrimitiveTypeValue (reader,	metadata.MemberTypes[n]);
-					}
-				}
-		}
-
-		private void RegisterObject (long objectId, object objectInstance, SerializationInfo info, long parentObjectId, MemberInfo parentObjectMemeber, int[] indices)
-		{
-			if (parentObjectId == 0) indices = null;
-
-			if (!objectInstance.GetType().IsValueType || parentObjectId == 0)
-				_manager.RegisterObject (objectInstance, objectId, info, 0, null, null);
-			else
-			{
-				if (indices != null) indices = (int[])indices.Clone();
-				_manager.RegisterObject (objectInstance, objectId, info, parentObjectId, parentObjectMemeber, indices);
-			}
-		}
-
-		private void ReadStringIntance (BinaryReader reader, out long objectId, out object value)
-		{
-			objectId = (long) reader.ReadUInt32 ();
-			value = reader.ReadString ();
-		}
-
-		private void ReadGenericArray (BinaryReader reader, out long objectId, out object val)
-		{
-			objectId = (long) reader.ReadUInt32 ();
-			// Array structure
-			reader.ReadByte();
-
-			int rank = reader.ReadInt32();
-
-			bool emptyDim = false;
-			int[] lengths = new int[rank];
-			for (int n=0; n<rank; n++)
-			{
-				lengths[n] = reader.ReadInt32();
-				if (lengths[n] == 0) emptyDim = true;
-			}
-
-			TypeTag code = (TypeTag) reader.ReadByte ();
-			Type elementType = ReadType (reader, code);
-
-			Array array = Array.CreateInstance (elementType, lengths);
-
-			if (emptyDim) 
-			{ 
-				val = array;
-				return;
-			}
-
-			int[] indices = new int[rank];
-
-			// Initialize indexes
-			for (int dim = rank-1; dim >= 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<fieldCount; n++)
-				names [n] = reader.ReadString ();
-
-			if (hasTypeInfo)
-			{
-				TypeTag[] codes = new TypeTag[fieldCount];
-
-				for (int n=0; n<fieldCount; n++)
-					codes [n] = (TypeTag) reader.ReadByte ();
-	
-				for (int n=0; n<fieldCount; n++) {
-					Type t = ReadType (reader, codes[n], false);
-					// The field's type could not be resolved: assume it is an object.
-					if (t == null)
-						t = typeof (object);
-					types [n] = t;
-				}
-			}
-			
-			// Gets the type
-
-			if (!isRuntimeObject) 
-			{
-				long assemblyId = (long)reader.ReadUInt32();
-				metadata.Type = GetDeserializationType (assemblyId, className);
-			}
-			else
-				metadata.Type = Type.GetType (className, true);
-
-			metadata.MemberTypes = types;
-			metadata.MemberNames = names;
-			metadata.FieldCount = names.Length;
-
-			// Now check if this objects needs a SerializationInfo struct for deserialziation.
-			// SerializationInfo is needed if the object has to be deserialized using
-			// a serialization surrogate, or if it implements ISerializable.
-
-			if (_surrogateSelector != null)
-			{
-				// check if the surrogate selector handles objects of the given type. 
-				ISurrogateSelector selector;
-				ISerializationSurrogate surrogate = _surrogateSelector.GetSurrogate (metadata.Type, _context, out selector);
-				metadata.NeedsSerializationInfo = (surrogate != null);
-			}
-
-			if (!metadata.NeedsSerializationInfo)
-			{
-				// Check if the object is marked with the Serializable attribute
-
-				if (!metadata.Type.IsSerializable)
-					throw new SerializationException("Serializable objects must be marked with the Serializable attribute");
-
-				metadata.NeedsSerializationInfo = typeof (ISerializable).IsAssignableFrom (metadata.Type);
-				if (!metadata.NeedsSerializationInfo)
-				{
-					metadata.MemberInfos = new MemberInfo [fieldCount];
-					for (int n=0; n<fieldCount; n++)
-					{
-						FieldInfo field = null;
-						string memberName = names[n];
-						
-						int i = memberName.IndexOf ('+');
-						if (i != -1) {
-							string baseTypeName = names[n].Substring (0,i);
-							memberName = names[n].Substring (i+1);
-							Type t = metadata.Type.BaseType;
-							while (t != null) {
-								if (t.Name == baseTypeName) {
-									field = t.GetField (memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
-									break;
-								}
-								else
-									t = t.BaseType;
-							}
-						}
-						else
-							field = metadata.Type.GetField (memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
-							
-						if (field != null)
-							metadata.MemberInfos [n] = field;
-						
-						if (!hasTypeInfo) {
-							types [n] = field.FieldType;
-						}
-					}
-					metadata.MemberNames = null;	// Info now in MemberInfos
-				}
-			}
-
-			// Registers the type's metadata so it can be reused later if
-			// a RefTypeObject element is found
-
-			if (!_typeMetadataCache.ContainsKey (metadata.Type))
-				_typeMetadataCache [metadata.Type] = metadata;
-
-			return metadata;
-		}
-
-		// Called for primitive types
-		static bool IsGeneric (MemberInfo minfo)
-		{
-			if (minfo == null)
-				return false;
-
-			Type mtype = null;
-			switch (minfo.MemberType) {
-			case MemberTypes.Field:
-				mtype = ((FieldInfo) minfo).FieldType;
-				break;
-			default:
-				throw new NotSupportedException ("Not supported: " + minfo.MemberType);
-			}
-			return (mtype != null && mtype.IsGenericType);
-		}
-
-		private void ReadValue (BinaryReader reader, object parentObject, long parentObjectId, SerializationInfo info, Type valueType, string fieldName, MemberInfo memberInfo, int[] indices)
-		{
-			// Reads a value from the stream and assigns it to the member of an object
-
-			object val;
-
-			if (BinaryCommon.IsPrimitive (valueType) && !IsGeneric (memberInfo))
-			{
-				val = ReadPrimitiveTypeValue (reader, valueType);
-				SetObjectValue (parentObject, fieldName, memberInfo, info, val, valueType, indices);
-				return;
-			}
-
-			// Gets the object
-
-			BinaryElement element = (BinaryElement)reader.ReadByte ();
-
-			if (element == BinaryElement.ObjectReference)
-			{
-				// Just read the id of the referred object and record a fixup
-				long childObjectId = (long) reader.ReadUInt32();
-				RecordFixup (parentObjectId, childObjectId, parentObject, info, fieldName, memberInfo, indices);
-				return;
-			}
-
-			long objectId;
-			SerializationInfo objectInfo;
-
-			ReadObject (element, reader, out objectId, out val, out objectInfo);
-
-			// There are two cases where the object cannot be assigned to the parent
-			// and a fixup must be used:
-			//  1) When what has been read is not an object, but an id of an object that
-			//     has not been read yet (an object reference). This is managed in the
-			//     previous block of code.
-			//  2) When the read object is a value type object. Value type fields hold
-			//     copies of objects, not references. Thus, if the value object that
-			//     has been read has pending fixups, those fixups would be made to the
-			//     boxed copy in the ObjectManager, and not in the required object instance
-
-			// First of all register the fixup, and then the object. ObjectManager is more
-			// efficient if done in this order
-
-			bool hasFixup = false;
-			if (objectId != 0)
-			{
-				if (val.GetType().IsValueType)
-				{
-					RecordFixup (parentObjectId, objectId, parentObject, info, fieldName, memberInfo, indices);
-					hasFixup = true;
-				}
-
-				// Register the value
-
-				if (info == null && !(parentObject is Array))
-					RegisterObject (objectId, val, objectInfo, parentObjectId, memberInfo, null);
-				else
-					RegisterObject (objectId, val, objectInfo, parentObjectId, null, indices);
-			}
-			// Assign the value to the parent object, unless there is a fixup
-			
-			if (!hasFixup) 
-				SetObjectValue (parentObject, fieldName, memberInfo, info, val, valueType, indices);
-		}
-
-		private void SetObjectValue (object parentObject, string fieldName, MemberInfo memberInfo, SerializationInfo info, object value, Type valueType, int[] indices)
-		{
-			if (value is IObjectReference)
-				value = ((IObjectReference)value).GetRealObject (_context);
-
-			if (parentObject is Array) 
-			{
-				if (value is ArrayNullFiller) 
-				{
-					// It must be a single dimension array of objects.
-					// Just increase the index. Elements are null by default.
-					int count = ((ArrayNullFiller)value).NullCount;
-					indices[0] += count - 1;
-				}
-				else
-					((Array)parentObject).SetValue (value, indices);
-			}
-			else if (info != null) {
-				info.AddValue (fieldName, value, valueType);
-			}
-			else {
-				if (memberInfo is FieldInfo)
-					((FieldInfo)memberInfo).SetValue (parentObject, value);
-				else
-					((PropertyInfo)memberInfo).SetValue (parentObject, value, null);
-			}
-		}
-
-		private void RecordFixup (long parentObjectId, long childObjectId, object parentObject, SerializationInfo info, string fieldName, MemberInfo memberInfo, int[] indices)
-		{
-			if (info != null) {
-				_manager.RecordDelayedFixup (parentObjectId, fieldName, childObjectId);
-			}
-			else if (parentObject is Array) {
-				if (indices.Length == 1)
-					_manager.RecordArrayElementFixup (parentObjectId, indices[0], childObjectId);
-				else
-					_manager.RecordArrayElementFixup (parentObjectId, (int[])indices.Clone(), childObjectId);
-			}
-			else {
-				_manager.RecordFixup (parentObjectId, memberInfo, childObjectId);
-			}
-		}
-
-		private Type GetDeserializationType (long assemblyId, string className)
-		{
-			return GetDeserializationType (assemblyId, className, true);
-		}
-		
-		private Type GetDeserializationType (long assemblyId, string className, bool throwOnError)
-		{
-			Type t;
-			string assemblyName = (string)_registeredAssemblies[assemblyId];
-
-			if (_binder != null) {
-				t = _binder.BindToType (assemblyName, className);
-				if (t != null)
-					return t;
-			}
-
-			Assembly assembly;
-			try {
-				assembly = Assembly.Load (assemblyName);
-			} catch	(Exception ex) {
-				if (!throwOnError)
-					return null;
-				throw new SerializationException (String.Format ("Couldn't find assembly '{0}'", assemblyName), ex);
-			}
-
-			t = assembly.GetType (className);
-			if (t != null)
-				return t;
-
-			if (!throwOnError)
-				return null;
-
-			throw new SerializationException (String.Format ("Couldn't find type '{0}' in assembly '{1}'", className, assemblyName));
-		}
-
-		public Type ReadType (BinaryReader reader, TypeTag code)
-		{
-			return ReadType (reader, code, true);
-		}
-		
-		public Type ReadType (BinaryReader reader, TypeTag code, bool throwOnError)
-		{
-			switch (code)
-			{
-				case TypeTag.PrimitiveType:
-					return BinaryCommon.GetTypeFromCode (reader.ReadByte());
-
-				case TypeTag.String:
-					return typeof(string);
-
-				case TypeTag.ObjectType:
-					return typeof(object);
-
-				case TypeTag.RuntimeType:
-				{
-					string name = reader.ReadString ();
-					// map MS.NET's System.RuntimeType to System.MonoType
-					if (_context.State == StreamingContextStates.Remoting)
-						if (name == "System.RuntimeType")
-							return typeof (MonoType);
-						else if (name == "System.RuntimeType[]")
-							return typeof (MonoType[]);
-					Type t = Type.GetType (name);
-					if (t != null)
-						return t;
-
-					throw new SerializationException (String.Format ("Could not find type '{0}'.", name));
-				}
-
-				case TypeTag.GenericType:
-				{
-					string name = reader.ReadString ();
-					long asmid = (long) reader.ReadUInt32();
-					return GetDeserializationType (asmid, name, throwOnError);
-				}
-
-				case TypeTag.ArrayOfObject:
-					return typeof(object[]);
-
-				case TypeTag.ArrayOfString:
-					return typeof(string[]);
-
-				case TypeTag.ArrayOfPrimitiveType:
-					Type elementType = BinaryCommon.GetTypeFromCode (reader.ReadByte());
-					return Type.GetType(elementType.FullName + "[]");
-
-				default:
-					throw new NotSupportedException ("Unknow type tag");
-			}
-		}
-		
-		public static object ReadPrimitiveTypeValue (BinaryReader reader, Type type)
-		{
-			if (type == null) return null;
-
-			switch (Type.GetTypeCode (type))
-			{
-				case TypeCode.Boolean:
-					return reader.ReadBoolean();
-
-				case TypeCode.Byte:
-					return reader.ReadByte();
-
-				case TypeCode.Char:
-					return reader.ReadChar();
-
-				case TypeCode.DateTime: 
-					return DateTime.FromBinary (reader.ReadInt64());
-
-				case TypeCode.Decimal:
-					return Decimal.Parse (reader.ReadString(), CultureInfo.InvariantCulture);
-
-				case TypeCode.Double:
-					return reader.ReadDouble();
-
-				case TypeCode.Int16:
-					return reader.ReadInt16();
-
-				case TypeCode.Int32:
-					return reader.ReadInt32();
-
-				case TypeCode.Int64:
-					return reader.ReadInt64();
-
-				case TypeCode.SByte:
-					return reader.ReadSByte();
-
-				case TypeCode.Single:
-					return reader.ReadSingle();
-
-				case TypeCode.UInt16:
-					return reader.ReadUInt16();
-
-				case TypeCode.UInt32:
-					return reader.ReadUInt32();
-
-				case TypeCode.UInt64:
-					return reader.ReadUInt64();
-
-				case TypeCode.String:
-					return reader.ReadString();
-
-				default:
-					if (type == typeof(TimeSpan))
-						return new TimeSpan (reader.ReadInt64 ());
-					else
-						throw new NotSupportedException ("Unsupported primitive type: " + type.FullName);
-			}
-		}
-	}
-}

+ 0 - 994
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs

@@ -1,994 +0,0 @@
-// ObjectWriter.cs
-//
-// Author:
-//   Lluis Sanchez Gual ([email protected])
-//
-// (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.Collections;
-using System.Runtime.Serialization;
-using System.Runtime.Remoting.Messaging;
-using System.Reflection;
-using System.Globalization;
-
-namespace System.Runtime.Serialization.Formatters.Binary
-{
-	abstract class TypeMetadata
-	{
-		public string TypeAssemblyName;
-		public string InstanceTypeName;
-		
-		public abstract void WriteAssemblies (ObjectWriter ow, BinaryWriter writer);
-		public abstract void WriteTypeData (ObjectWriter ow, BinaryWriter writer, bool writeTypes);
-		public abstract void WriteObjectData (ObjectWriter ow, BinaryWriter writer, object data);
-		
-		public virtual bool IsCompatible (TypeMetadata other)
-		{
-			return true;
-		}
-
-		public void BindToName (string assemblyName, string typeName)
-		{
-			if (assemblyName != null)
-				TypeAssemblyName = assemblyName;
-			if (typeName != null)
-				InstanceTypeName = typeName;
-		}
-		
-		public abstract bool RequiresTypes { get; }
-	}
-	
-	abstract class ClrTypeMetadata: TypeMetadata
-	{
-		public Type InstanceType;
-
-		public ClrTypeMetadata (Type instanceType)
-		{
-			InstanceType = instanceType;
-			InstanceTypeName = instanceType.FullName;
-			TypeAssemblyName = instanceType.Assembly.FullName;
-		}
-		
-		public override bool RequiresTypes {
-			get { return false; }
-		}
-	}
-	
-	class SerializableTypeMetadata: TypeMetadata
-	{
-		Type[] types;
-		string[] names;
-		
-		public SerializableTypeMetadata (Type itype, SerializationInfo info)
-		{
-			types = new Type [info.MemberCount];
-			names = new string [info.MemberCount];
-
-			SerializationInfoEnumerator e = info.GetEnumerator ();
-
-			int n = 0;
-			while (e.MoveNext ())
-			{
-				types[n] = e.ObjectType;
-				names[n] = e.Name;
-				n++;
-			}
-
-			TypeAssemblyName = info.AssemblyName;
-			InstanceTypeName = info.FullTypeName;
-		}
-		
-		public override bool IsCompatible (TypeMetadata other)
-		{
-			if (!(other is SerializableTypeMetadata)) return false;
-			
-			SerializableTypeMetadata tm = (SerializableTypeMetadata)other;
-			if (types.Length != tm.types.Length) return false;
-			if (TypeAssemblyName != tm.TypeAssemblyName) return false;
-			if (InstanceTypeName != tm.InstanceTypeName) return false;
-			for (int n=0; n<types.Length; n++)
-			{
-				if (types[n] != tm.types[n]) return false;
-				if (names[n] != tm.names[n]) return false;
-			}
-			return true;
-		}
-		
-		public override void WriteAssemblies (ObjectWriter ow, BinaryWriter writer)
-		{
-			foreach (Type mtype in types)
-			{
-				Type type = mtype;
-				while (type.IsArray) 
-					type = type.GetElementType();
-					
-				ow.WriteAssembly (writer, type.Assembly);
-			}
-		}
-		
-		public override void WriteTypeData (ObjectWriter ow, BinaryWriter writer, bool writeTypes)
-		{
-			writer.Write (types.Length);
-
-			// Names of fields
-			foreach (string name in names)
-				writer.Write (name);
-
-			// Types of fields
-			foreach (Type type in types)
-				ObjectWriter.WriteTypeCode (writer, type);
-
-			// Type specs of fields
-			foreach (Type type in types)
-				ow.WriteTypeSpec (writer, type);
-		}
-		
-		public override void WriteObjectData (ObjectWriter ow, BinaryWriter writer, object data)
-		{
-			SerializationInfo info = (SerializationInfo) data;
-			SerializationInfoEnumerator e = info.GetEnumerator ();
-
-			while (e.MoveNext ())
-				ow.WriteValue (writer, e.ObjectType, e.Value);
-		}
-		
-		public override bool RequiresTypes {
-			get { return true; }
-		}
-	}
-	
-	class MemberTypeMetadata: ClrTypeMetadata
-	{
-		MemberInfo[] members;
-		
-		public MemberTypeMetadata (Type type, StreamingContext context): base (type)
-		{
-			members = FormatterServices.GetSerializableMembers (type, context);
-		}
-
-		public override void WriteAssemblies (ObjectWriter ow, BinaryWriter writer)
-		{
-			foreach (FieldInfo field in members)
-			{
-				Type type = field.FieldType;
-				while (type.IsArray) 
-					type = type.GetElementType();
-					
-				ow.WriteAssembly (writer, type.Assembly);
-			}
-		}
-		
-		public override void WriteTypeData (ObjectWriter ow, BinaryWriter writer, bool writeTypes)
-		{
-			writer.Write (members.Length);
-
-			// Names of fields
-			foreach (FieldInfo field in members)
-				writer.Write (field.Name);
-
-			if (writeTypes) {
-				// Types of fields
-				foreach (FieldInfo field in members)
-					ObjectWriter.WriteTypeCode (writer, field.FieldType);
-	
-				// Type specs of fields
-				foreach (FieldInfo field in members)
-					ow.WriteTypeSpec (writer, field.FieldType);
-			}
-		}
-		
-		public override void WriteObjectData (ObjectWriter ow, BinaryWriter writer, object data)
-		{
-			object[] values = FormatterServices.GetObjectData (data, members);
-			for (int n=0; n<values.Length; n++)
-				ow.WriteValue (writer, ((FieldInfo)members[n]).FieldType, values[n]);
-		}
-	}
-	
-	internal class ObjectWriter
-	{
-		ObjectIDGenerator _idGenerator = new ObjectIDGenerator();
-		Hashtable _cachedMetadata = new Hashtable();
-		Queue _pendingObjects = new Queue();
-		Hashtable _assemblyCache = new Hashtable();
-		
-		// Type metadata that can be shared with all serializers
-		static Hashtable _cachedTypes = new Hashtable();
-
-		internal static Assembly CorlibAssembly = typeof(string).Assembly;
-		internal static string CorlibAssemblyName = typeof(string).Assembly.FullName;
-
-		ISurrogateSelector _surrogateSelector;
-		StreamingContext _context;
-		FormatterAssemblyStyle _assemblyFormat;
-		FormatterTypeStyle _typeFormat;
-		SerializationBinder _binder;
-		byte[] arrayBuffer;
-		int ArrayBufferLength = 4096;
-		SerializationObjectManager _manager;
-		
-		class MetadataReference
-		{
-			public TypeMetadata Metadata;
-			public long ObjectID;
-			
-			public MetadataReference (TypeMetadata metadata, long id)
-			{
-				Metadata = metadata;
-				ObjectID = id;
-			}
-		}
-		
-		public ObjectWriter (BinaryFormatter formatter)
-		{
-			_surrogateSelector = formatter.SurrogateSelector;
-			_context = formatter.Context;
-			_assemblyFormat = formatter.AssemblyFormat;
-			_typeFormat = formatter.TypeFormat;
-			_manager = new SerializationObjectManager (formatter.Context);
-			_binder = formatter.Binder;
-		}
-
-		public void WriteObjectGraph (BinaryWriter writer, object obj, Header[] headers)
-		{
-			_pendingObjects.Clear();
-			if (headers != null) QueueObject (headers);
-			QueueObject (obj);
-			WriteQueuedObjects (writer);
-			WriteSerializationEnd (writer);
-			_manager.RaiseOnSerializedEvent ();
-		}
-
-		public void QueueObject (object obj)
-		{
-			_pendingObjects.Enqueue (obj);
-		}
-
-		public void WriteQueuedObjects (BinaryWriter writer)
-		{
-			while (_pendingObjects.Count > 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<array.Rank; n++)
-				writer.Write (array.GetUpperBound (n) + 1);
-
-			// Writes the type
-			WriteTypeCode (writer, elementType);
-			WriteTypeSpec (writer, elementType);
-
-			// Writes the values. For single-dimension array, a special tag is used
-			// to represent multiple consecutive null values. I don't know why this
-			// optimization is not used for multidimensional arrays.
-
-			if (array.Rank == 1 && !elementType.IsValueType)
-			{
-				WriteSingleDimensionArrayElements (writer, array, elementType);
-			}
-			else
-			{
-				foreach (object item in array)
-					WriteValue (writer, elementType, item);
-			}
-		}
-
-		private void WriteObjectArray (BinaryWriter writer, long id, Array array)
-		{
-			writer.Write ((byte) BinaryElement.ArrayOfObject);
-			writer.Write ((int)id);
-			writer.Write (array.Length);	// Single dimension. Just write the length
-			WriteSingleDimensionArrayElements (writer, array, typeof (object));
-		}
-
-		private void WriteStringArray (BinaryWriter writer, long id, Array array)
-		{
-			writer.Write ((byte) BinaryElement.ArrayOfString);
-			writer.Write ((int)id);
-			writer.Write (array.Length);	// Single dimension. Just write the length
-			WriteSingleDimensionArrayElements (writer, array, typeof (string));
-		}
-
-		private void WritePrimitiveTypeArray (BinaryWriter writer, long id, Array array)
-		{
-			writer.Write ((byte) BinaryElement.ArrayOfPrimitiveType);
-			writer.Write ((int)id);
-			writer.Write (array.Length);	// Single dimension. Just write the length
-
-			Type elementType = array.GetType().GetElementType();
-			WriteTypeSpec (writer, elementType);
-
-			switch (Type.GetTypeCode (elementType))
-			{
-				case TypeCode.Boolean:
-					foreach (bool item in (bool[]) array)
-						writer.Write (item);
-					break;
-
-				case TypeCode.Byte:
-					writer.Write ((byte[]) array);
-					break;
-
-				case TypeCode.Char:
-					writer.Write ((char[]) array);
-					break;
-
-				case TypeCode.DateTime: 
-					foreach (DateTime item in (DateTime[]) array)
-						writer.Write (item.ToBinary ());
-					break;
-
-				case TypeCode.Decimal:
-					foreach (decimal item in (decimal[]) array)
-						writer.Write (item);
-					break;
-
-				case TypeCode.Double:
-					if (array.Length > 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;
-			}
-		}
-	}
-}

+ 0 - 1552
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/binary_serialization_format.htm

@@ -1,1552 +0,0 @@
-<html>
-	<head>
-		<title>Binary Serialization Format</title>
-		<style> body { FONT-SIZE: x-small; FONT-FAMILY: arial }
-	table { FONT-SIZE: x-small; FONT-FAMILY: arial }
-	</style>
-	</head>
-	<body>
-		<H1>Binary Serialization Format</H1>
-		<P>by Lluis Sanchez Gual&nbsp;(<A href="mailto:[email protected]">[email protected]</A>)</P>
-		<UL>
-			<LI>
-				<A href="#intro">Introduction</A>
-			<LI>
-				<A href="#format">Format description</A>
-				<UL>
-					<LI>
-						<A href="#example">An example</A></LI></UL>
-			<LI>
-				<A href="#elements">Binary elements</A>
-				<UL>
-					<LI>
-						<A href="#elem1">1 - RefTypeObject</A>
-					<LI>
-						<A href="#elem4">4 - RuntimeObject</A>
-					<LI>
-						<A href="#elem5">5 - ExternalObject</A>
-					<LI>
-						<A href="#elem6">6 - String</A>
-					<LI>
-						<A href="#elem7">7 - GenericArray</A>
-					<LI>
-						<A href="#elem8">8 - BoxedPrimitiveTypeValue</A>
-					<LI>
-						<A href="#elem9">9 - ObjectReference</A>
-					<LI>
-						<A href="#elem10">10 - NullValue</A>
-					<LI>
-						<A href="#elem11">11 - End</A>
-					<LI>
-						<A href="#elem12">12 - Assembly</A>
-					<LI>
-						<A href="#elem13">13 - ArrayFiller8b</A>
-					<LI>
-						<A href="#elem14">14 - ArrayFiller32b</A>
-					<LI>
-						<A href="#elem15">15 - ArrayOfPrimitiveType</A>
-					<LI>
-						<A href="#elem16">16 - ArrayOfObject</A>
-					<LI>
-						<A href="#elem17">17 - ArrayOfString</A>
-					<LI>
-						<A href="#elem21">21 - MethodCall</A>
-					<LI>
-						<A href="#elem22">22 - MethodResponse</A></LI></UL>
-			<LI>
-				<A href="#other">Other Elements</A>
-			</LI>
-			<UL>
-				<LI>
-					<A href="#string">string</A>
-				<LI>
-					<A href="#primitive-value">primitive-value</A>
-				<LI>
-					<A href="#value">value</A>
-				<LI>
-					<A href="#type-tag">type-tag</A>
-				<LI>
-					<A href="#type-spec">type-spec</A>
-				<LI>
-					<A href="#method-call-flags">method-call-flags</A>
-				<LI>
-					<A href="#method-response-flags">method-response-flags</A>
-				<LI>
-					<A href="#return-type-tag">return-type-tag</A>
-				<LI>
-					<A href="#primitive-type-code">primitive-type-code</A></LI></UL>
-		</UL>
-		<a name="intro"></a>
-		<H2>Introduction</H2>
-		<P>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&nbsp;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.</P>
-		<a name="format"></a>
-		<H2>Format description</H2>
-		<P>An object serialization is a sequence of binary elements.&nbsp;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.</P>
-		<P>This table shows the available binary elements:</P>
-		<P>
-			<TABLE id="Table1" style="WIDTH: 560px; HEIGHT: 94px" cellSpacing="1" cellPadding="1" width="560" border="1">
-				<TR>
-					<TD width="40"><STRONG>Code</STRONG></TD>
-					<TD><STRONG>Label</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="40">0</TD>
-					<TD>Header</TD>
-					<TD>Allways written at the beggining of a serialization</TD>
-				</TR>
-				<TR>
-					<TD width="40">1</TD>
-					<TD><A href="#elem1">RefTypeObject</A></TD>
-					<TD>Object with no type metadata</TD>
-				</TR>
-				<TR>
-					<TD width="40">4</TD>
-					<TD><A href="#elem4">RuntimeObject</A></TD>
-					<TD>Corlib object</TD>
-				</TR>
-				<TR>
-					<TD width="40">5</TD>
-					<TD><A href="#elem5">ExternalObject</A></TD>
-					<TD>Object</TD>
-				</TR>
-				<TR>
-					<TD width="40">6</TD>
-					<TD><A href="#elem6">String</A></TD>
-					<TD>String</TD>
-				</TR>
-				<TR>
-					<TD width="40">7</TD>
-					<TD><A href="#elem7">GenericArray</A></TD>
-					<TD>Array</TD>
-				</TR>
-				<TR>
-					<TD width="40">8</TD>
-					<TD><A href="#elem8">BoxedPrimitiveTypeValue</A></TD>
-					<TD>Primitive type value</TD>
-				</TR>
-				<TR>
-					<TD width="40">9</TD>
-					<TD><A href="#elem9">ObjectReference</A></TD>
-					<TD>Object reference</TD>
-				</TR>
-				<TR>
-					<TD width="40">10</TD>
-					<TD><A href="#elem10">NullValue</A></TD>
-					<TD>Null value</TD>
-				</TR>
-				<TR>
-					<TD width="40">11</TD>
-					<TD><A href="#elem11">End</A></TD>
-					<TD>End of stream</TD>
-				</TR>
-				<TR>
-					<TD width="40">12</TD>
-					<TD><A href="#elem12">Assembly</A></TD>
-					<TD>Assembly declaration</TD>
-				</TR>
-				<TR>
-					<TD width="40">13</TD>
-					<TD><A href="#elem13">ArrayFiller8b</A></TD>
-					<TD>Null filler (8 bit length)</TD>
-				</TR>
-				<TR>
-					<TD width="40">14</TD>
-					<TD><A href="#elem14">ArrayFiller32b</A></TD>
-					<TD>Null filler (16 bit length)</TD>
-				</TR>
-				<TR>
-					<TD width="40">15</TD>
-					<TD><A href="#elem15">ArrayOfPrimitiveType</A></TD>
-					<TD>Array of primitive type</TD>
-				</TR>
-				<TR>
-					<TD width="40">16</TD>
-					<TD><A href="#elem16">ArrayOfObject</A></TD>
-					<TD>Array of Object</TD>
-				</TR>
-				<TR>
-					<TD width="40">17</TD>
-					<TD><A href="#elem17">ArrayOfString</A></TD>
-					<TD>Array of string</TD>
-				</TR>
-				<TR>
-					<TD width="40">21</TD>
-					<TD><A href="#elem21">MethodCall</A></TD>
-					<TD>Method call</TD>
-				</TR>
-				<TR>
-					<TD width="40">22</TD>
-					<TD><A href="#elem22">MethodResponse</A></TD>
-					<TD>Method response</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<P>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.</P>
-		<a name="example"></a>
-		<H3>An example</H3>
-		<P>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:</P>
-		<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
-			<P><FONT face="Courier New">class A<BR>
-					{<BR>
-					&nbsp;&nbsp;&nbsp;&nbsp; B bval = new B();<BR>
-					&nbsp;&nbsp;&nbsp;&nbsp; C cval = new C();<BR>
-					&nbsp;&nbsp;&nbsp;&nbsp; string msg = "hello";<BR>
-					}<BR>
-					<BR>
-					class B<BR>
-					{<BR>
-					&nbsp;&nbsp;&nbsp;&nbsp; string str = "bye";<BR>
-					}<BR>
-					<BR>
-					struct C<BR>
-					{<BR>
-					&nbsp;&nbsp;&nbsp;&nbsp; string[] info = new string[] {"hello","world"}<BR>
-					}</FONT></P>
-		</BLOCKQUOTE>
-		<P>The serialization of an instance of class A would result in a sequence of binary 
-			elements like the following:</P>
-		<P>
-			<TABLE id="Table35" cellSpacing="1" cellPadding="1" width="100%" border="1">
-				<TR>
-					<TD vAlign="top" width="169"><STRONG>Element</STRONG></TD>
-					<TD vAlign="top" width="40"><STRONG>Bytes</STRONG></TD>
-					<TD vAlign="top" width="186"><STRONG>Data</STRONG></TD>
-					<TD vAlign="top"><STRONG>Comments</STRONG></TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169">Header</TD>
-					<TD vAlign="top" width="40">0<BR>
-						1,0,0,0,<BR>
-						255,255,255,255,<BR>
-						1,0,0,0,0,0,0,0</TD>
-					<TD vAlign="top" width="186">Element code ?</TD>
-					<TD vAlign="top">This sequence of bytes is serialized at the beginning. I'm sure it 
-						has a meaning, but I don't know it.</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169"><A href="#elem12">Assembly</A></TD>
-					<TD vAlign="top" width="40">1<BR>
-						1,0,0,0<BR>
-						"MyAssembly"</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						ID of the assembly (1)<BR>
-						Full name of the assembly</TD>
-					<TD vAlign="top">
-						<P>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.</P>
-					</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169"><A href="#elem5">ExternalObject</A></TD>
-					<TD vAlign="top" width="40">5<BR>
-						2,0,0,0<BR>
-						"A"<BR>
-						3,0,0,0<BR>
-						"bval","cval","msg"<BR>
-						4,4,1<BR>
-						"B"<BR>
-						1,0,0,0<BR>
-						"C"<BR>
-						1,0,0,0<BR>
-						1,0,0,0</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						Object ID (2)<BR>
-						Class name<BR>
-						Field count<BR>
-						Field names<BR>
-						Field type tags<BR>
-						Class name of field "bval"<BR>
-						Assembly ID of field "bval"<BR>
-						Class name of field "cval"<BR>
-						Assembly ID of field "cval"<BR>
-						Assembly ID of this object</TD>
-					<TD vAlign="top">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.</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem9">ObjectReference</A></TD>
-					<TD vAlign="top" width="40">9<BR>
-						5,0,0,0</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						ID of the referred object (5)</TD>
-					<TD vAlign="top">Reference objects are not serialized inside the container element. 
-						Instead, an ObjectReference is serialized, and the object itself queued for 
-						later serialization.</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem5">ExternalObject</A></TD>
-					<TD vAlign="top" width="40">5<BR>
-						3,0,0,0<BR>
-						C<BR>
-						1,0,0,0<BR>
-						"info"<BR>
-						6<BR>
-						1,0,0,0</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						Object ID (3)<BR>
-						Class name<BR>
-						Field count<BR>
-						Field name<BR>
-						Field type tag<BR>
-						Assembly ID of this object</TD>
-					<TD vAlign="top">On the other hand, value type objects are serialized inside the 
-						container element.</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-						<A href="#elem9">ObjectReference</A></TD>
-					<TD vAlign="top" width="40">9<BR>
-						7,0,0,0</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						ID of the referred object (7)</TD>
-					<TD vAlign="top">This is again a reference object, so it is serialized later.</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem6">String</A></TD>
-					<TD vAlign="top" width="40">6<BR>
-						4,0,0,0<BR>
-						"hello"</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						Object ID (4)<BR>
-						String value</TD>
-					<TD vAlign="top">Strings are serialized like value objects</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169"><A href="#elem5">ExternalObject</A></TD>
-					<TD vAlign="top" width="40">5<BR>
-						5,0,0,0<BR>
-						"B"<BR>
-						1,0,0,0<BR>
-						"str"<BR>
-						1<BR>
-						1,0,0,0</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						Object ID (5)<BR>
-						Class name<BR>
-						Field count<BR>
-						Field name<BR>
-						Field type tag<BR>
-						Assembly ID of this object</TD>
-					<TD vAlign="top">
-						<P>Reference objects queued for serialization are serialized after the root object.</P>
-					</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href="#elem6">String</A></TD>
-					<TD vAlign="top" width="40">6<BR>
-						6,0,0,0<BR>
-						"bye"</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						Object ID (6)<BR>
-						String value</TD>
-					<TD vAlign="top">A string</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169"><A href="#elem17">ArrayOfString</A></TD>
-					<TD vAlign="top" width="40">17<BR>
-						7,0,0,0<BR>
-						2,0,0,0</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						Object ID (7)<BR>
-						Element count</TD>
-					<TD vAlign="top">This could be also encoded using the binary&nbsp;element Array 
-						(7), but ArrayOfString is more specific and saves bytes.</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem9">ObjectReference</A></TD>
-					<TD vAlign="top" width="40">9<BR>
-						4,0,0,0</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						ID of the referred object (4)</TD>
-					<TD vAlign="top">This string was already serialized. Use a backwards reference.</TD>
-				</TR>
-				<TR>
-					<TD vAlign="top" width="169">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="#elem6">String</A></TD>
-					<TD vAlign="top" width="40">6<BR>
-						8,0,0,0<BR>
-						"world"</TD>
-					<TD vAlign="top" width="186">Element code<BR>
-						Object ID (8)<BR>
-						String value</TD>
-					<TD vAlign="top">Another string</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elements"></a>
-		<H2>Binary elements</H2>
-		<P>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.</P>
-		<P>A special notation is used to represent the bytes. Here are some examples:</P>
-		<P>
-			<TABLE id="Table36" style="WIDTH: 448px; HEIGHT: 129px" cellSpacing="1" cellPadding="1" width="448" border="1">
-				<TR>
-					<TD width="193"><STRONG>Example of element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="193">(byte) 7</TD>
-					<TD>A single byte</TD>
-				</TR>
-				<TR>
-					<TD width="193">uint</TD>
-					<TD>Any uint value (4 bytes)</TD>
-				</TR>
-				<TR>
-					<TD width="193"><EM><A href="#type-tag">type-tag</A></EM></TD>
-					<TD>Names&nbsp;in italic are described in the section "Other elements"</TD>
-				</TR>
-				<TR>
-					<TD width="193"><EM><A href="#string">string</A></EM>&nbsp;*</TD>
-					<TD>* represents a sequence of elements</TD>
-				</TR>
-				<TR>
-					<TD width="193">object</TD>
-					<TD>Full serialization of an object</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem1"></a>
-		<H3>1 - RefTypeObject
-		</H3>
-		<P>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.</P>
-		<P>
-			<TABLE id="Table2" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 1</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Object ID</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>ID of a previously serialized object from which to take type metadata.</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#value">value</A> </EM>*</TD>
-					<TD>Values of the fields of the object</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem4"></a>
-		<H3>4 - RuntimeObject</H3>
-		<P>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.</P>
-		<P>
-			<TABLE id="Table21" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 4</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Object ID</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#string">string</A></EM></TD>
-					<TD>Class name, including namespace</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Number of serialized fields</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#string">string</A> </EM>*</TD>
-					<TD>Names of the fields</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#type-tag">type-tag</A> *</EM></TD>
-					<TD>type-tag of each field</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#type-spec">type-spec</A> *</EM></TD>
-					<TD>type-spec of each field</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#value">value</A> *</EM></TD>
-					<TD>Values of the fields of the object</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem5"></a>
-		<H3>5 - ExternalObject</H3>
-		<P>This element can be used to serialize any object from any assembly.</P>
-		<H3>
-			<TABLE id="Table22" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 5</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Object ID</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#string">string</A></EM></TD>
-					<TD>Class name, including namespace</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Number of serialized fields</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#string">string</A> </EM>*</TD>
-					<TD>Names of the fields</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#type-tag">type-tag</A> </EM>*</TD>
-					<TD>type-tag of each field</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#type-spec">type-spec</A> </EM>*</TD>
-					<TD>type-spec of each field</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>ID of the assembly where the class is defined (the assembly must have been 
-						serialized before the class using the binary element 12)</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#value">value</A> </EM>*</TD>
-					<TD>Values of the fields of the object</TD>
-				</TR>
-			</TABLE>
-		</H3>
-		<a name="elem6"></a>
-		<H3>6 - String</H3>
-		<P>A string value.</P>
-		<P>
-			<TABLE id="Table23" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 6</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Object ID</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#string">string</A></EM></TD>
-					<TD>Value of the string</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem7"></a>
-		<H3>7 - GenericArray</H3>
-		<P>This element can be used to represent any array.</P>
-		<H3>
-			<TABLE id="Table24" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 7</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Object ID</TD>
-				</TR>
-				<TR>
-					<TD width="142">byte</TD>
-					<TD>Array type: 0:single dimension, 1: jagged, 2: multi-dimensional</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Number of dimensions (rank)</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint *</TD>
-					<TD>Number of&nbsp;elements for each dimension</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#type-tag">type-tag</A></EM></TD>
-					<TD>type-tag of array's&nbsp;element type</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#type-spec">type-spec</A></EM></TD>
-					<TD>type-spec of array's&nbsp;element type</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#value">value</A> *</EM></TD>
-					<TD>Values of the elements, row by row</TD>
-				</TR>
-			</TABLE>
-		</H3>
-		<a name="elem8"></a>
-		<H3>8 - BoxedPrimitiveTypeValue</H3>
-		<P>This element represents a primitive type value boxed as an object.</P>
-		<P>
-			<TABLE id="Table25" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 8</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#type-spec">type-spec</A></EM></TD>
-					<TD>type-spec of the primitive type</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#primitive-value">primitive-value</A></EM></TD>
-					<TD>Raw value</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem9"></a>
-		<H3>9 - ObjectReference</H3>
-		<P>This element represents a reference to an object already serialized (backwards 
-			reference) or that will be serialized later (forward reference).
-		</P>
-		<P>
-			<TABLE id="Table26" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 9</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>ID of the referred object</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem10"></a>
-		<H3>10 - NullValue</H3>
-		<P>A&nbsp;null value.</P>
-		<TABLE id="Table27" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
-			<TR>
-				<TD width="142"><STRONG>Element</STRONG></TD>
-				<TD><STRONG>Description</STRONG></TD>
-			</TR>
-			<TR>
-				<TD width="142">(byte) 10</TD>
-				<TD>Element code</TD>
-			</TR>
-		</TABLE>
-		<P></P>
-		<a name="elem11"></a>
-		<H3>
-			<P>11 - End</P>
-		</H3>
-		<P>This element marks the end of the serialized object graph.</P>
-		<TABLE id="Table28" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
-			<TR>
-				<TD width="142"><STRONG>Element</STRONG></TD>
-				<TD><STRONG>Description</STRONG></TD>
-			</TR>
-			<TR>
-				<TD width="142">(byte) 11</TD>
-				<TD>Element code</TD>
-			</TR>
-		</TABLE>
-		<a name="elem12"></a>
-		<H3>
-			<P>12 - Assembly</P>
-		</H3>
-		<P>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.</P>
-		<TABLE id="Table29" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
-			<TR>
-				<TD width="142"><STRONG>Element</STRONG></TD>
-				<TD><STRONG>Description</STRONG></TD>
-			</TR>
-			<TR>
-				<TD width="142">(byte) 12</TD>
-				<TD>Element code</TD>
-			</TR>
-			<TR>
-				<TD width="142">uint</TD>
-				<TD>Assembly ID</TD>
-			</TR>
-			<TR>
-				<TD width="142"><EM><A href="#string">string</A></EM></TD>
-				<TD>Full name of the assembly</TD>
-			</TR>
-		</TABLE>
-		<a name="elem13"></a>
-		<H3>
-			<P>13 - ArrayFiller8b</P>
-		</H3>
-		<P>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).</P>
-		<TABLE id="Table30" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
-			<TR>
-				<TD width="142"><STRONG>Element</STRONG></TD>
-				<TD><STRONG>Description</STRONG></TD>
-			</TR>
-			<TR>
-				<TD width="142">(byte) 13</TD>
-				<TD>Element code</TD>
-			</TR>
-			<TR>
-				<TD width="142">byte</TD>
-				<TD>Number of consecutive null values</TD>
-			</TR>
-		</TABLE>
-		<P></P>
-		<a name="elem14"></a>
-		<H3>
-			<P>14 - ArrayFiller32b</P>
-		</H3>
-		<P>The same as ArrayFiller8b, but it uses a uint to specify the length.</P>
-		<TABLE id="Table31" style="WIDTH: 568px; HEIGHT: 16px" cellSpacing="1" cellPadding="1" width="568" border="1">
-			<TR>
-				<TD width="142"><STRONG>Element</STRONG></TD>
-				<TD><STRONG>Description</STRONG></TD>
-			</TR>
-			<TR>
-				<TD width="142">(byte) 14</TD>
-				<TD>Element code</TD>
-			</TR>
-			<TR>
-				<TD width="142">uint</TD>
-				<TD>Number of consecutive null values</TD>
-			</TR>
-		</TABLE>
-		<P></P>
-		<a name="elem15"></a>
-		<H3>
-			<P>15 - ArrayOfPrimitiveType</P>
-		</H3>
-		<P>This element can be used to represent a single dimension array of primitive type 
-			values.</P>
-		<P>
-			<TABLE id="Table32" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 15</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Object ID</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Number of&nbsp;elements</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#type-spec">type-spec</A></EM></TD>
-					<TD>type-spec of array's&nbsp;element type</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#primitive-value">primitie-value</A> *</EM></TD>
-					<TD>Values of the elements</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem16"></a>
-		<H3>16&nbsp;- ArrayOfObject</H3>
-		<P>This element can be used to represent a single dimension array of Object (i.e. 
-			an object[] ).</P>
-		<P>
-			<TABLE id="Table33" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 16</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Object ID</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Number of&nbsp;elements</TD>
-				</TR>
-				<TR>
-					<TD width="142">object *</TD>
-					<TD>Values of the elements</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem17"></a>
-		<H3>17 - ArrayOfString</H3>
-		<P>This element can be used to represent a single dimension array of&nbsp;String 
-			(i.e. an string[] ).</P>
-		<P>
-			<TABLE id="Table34" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 17</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Object ID</TD>
-				</TR>
-				<TR>
-					<TD width="142">uint</TD>
-					<TD>Number of&nbsp;elements</TD>
-				</TR>
-				<TR>
-					<TD width="142">object *</TD>
-					<TD>Values of the elements</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="elem21"></a>
-		<H3>21 Method call</H3>
-		<P>Represents a method call. The format of a method call can vary depending on the 
-			type of the parameters.&nbsp;The following&nbsp;table shows the common format:</P>
-		<P>
-			<TABLE id="Table20" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142">(byte) 21</TD>
-					<TD>Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#method-call-flags">method-call-flags (int32)</A></EM></TD>
-					<TD>Describes wich information includes the method call</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><EM><A href="#type-spec">type-spec</A><BR>
-								<EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></TD>
-					<TD>Method name</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
-									<EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
-					<TD>Class name (including namespace and assembly)</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<P>The following tables describe the format of the message content depending on the 
-			value of method-call-flags:</P>
-		<H4>method-call-flags &amp; NoArguments</H4>
-		<P>Used for calls to methods without parameters.</P>
-		<H4>
-			<TABLE id="Table8" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="119"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="119">Header[]</TD>
-					<TD>Only if there are Headers and method-call-flags has the flag <EM>IncludeLogicalCallContext.
-						</EM>Headers are serialized only if there is context info. This must be a bug 
-						in MS.NET.</TD>
-				</TR>
-				<TR>
-					<TD width="119">object[]</TD>
-					<TD>
-						<P>Array with the following values:</P>
-						<UL>
-						    <li>Generic arguments if the method is generic and method-call-flags has the flag GenericArguments (NET_2_0).</li>
-							<LI>
-							Method signature, only if method-call-flags has the flag IncludesSignature. It 
-							is an array of Type.
-							<LI>
-								LogicalCallContext instance, only if method-call-flags has the flag 
-								IncludesLogicalCallContext.</LI></UL>
-						<P>If the array is empty, it is not serialized.</P>
-					</TD>
-				</TR>
-			</TABLE>
-		</H4>
-		<H4>method-call-flags &amp; PrimitiveArguments</H4>
-		<P>Used for calls to methods in which all parameters are primitive types.</P>
-		<P>
-			<TABLE id="Table5" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="119"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="119">uint</TD>
-					<TD>Number of parameters</TD>
-				</TR>
-				<TR>
-					<TD width="119"><EM><EM><EM><EM>( <A href="#type-spec">type-spec</A></EM></EM></EM><BR>
-							<A href="#primitive-value">primitive-value</A> ) *</EM></TD>
-					<TD>One value for each parameter</TD>
-				</TR>
-				<TR>
-					<TD width="119">Header[]</TD>
-					<TD>Only if there are Headers and method-response-flags has the flag <EM>IncludeLogicalCallContext.
-						</EM>Headers are serialized only if there is context info. This must be a bug 
-						in MS.NET.</TD>
-				</TR>
-				<TR>
-					<TD width="119">object[]</TD>
-					<TD>
-						<P>Array with the following values:</P>
-						<UL>
-						    <li>Generic arguments if the method is generic and method-call-flags has the flag GenericArguments (NET_2_0).</li>
-							<LI>
-							Method signature, only if method-call-flags has the flag IncludesSignature. It 
-							is an array of Type.
-							<LI>
-								LogicalCallContext instance, only if method-call-flags has the flag 
-								IncludesLogicalCallContext.</LI></UL>
-						<P>If the array is empty, it is not serialized.</P>
-					</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<H4>method-call-flags &amp; ArgumentsInSimpleArray</H4>
-		<P>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).</P>
-		<P>
-			<TABLE id="Table6" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="119"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="119">Header[]</TD>
-					<TD>Only if there are Headers.</TD>
-				</TR>
-				<TR>
-					<TD width="119">object[]</TD>
-					<TD>
-						<P>Array of parameters.
-						</P>
-					</TD>
-				</TR>
-			</TABLE>
-			<H4>method-call-flags&nbsp;&amp; ArgumentsInMultiArray</H4>
-		<P>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).</P>
-		<P>
-			<TABLE id="Table7" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="119"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="119">Header[]</TD>
-					<TD>Only if there are Headers.</TD>
-				</TR>
-				<TR>
-					<TD width="119">object[]</TD>
-					<TD>
-						<P>
-							Array with the following values:</P>
-						<UL>
-							<LI>
-							Array of parameters.
-						    <li>Generic arguments if the method is generic and method-call-flags has the flag GenericArguments (NET_2_0).</li>
-							<LI>
-							Method signature, only if method-call-flags has the flag IncludesSignature. It 
-							is an array of Type.
-							<LI>
-								LogicalCallContext instance, only if method-call-flags has the flag 
-								IncludesLogicalCallContext.</LI></UL>
-						<P>
-							If the array is empty, it is not serialized.</P>
-					</TD>
-				</TR>
-			</TABLE>
-		</P>
-		</TD></TR></TBODY></TABLE> <a name="elem22"></a>
-		<H3>22 Method Response</H3>
-		<P>Represents a method response. The format of a method response can vary depending 
-			on the type of the return value and parameters.&nbsp;The following&nbsp;table 
-			shows the common format:</P>
-		<P>
-			<TABLE id="Table9" style="WIDTH: 568px; HEIGHT: 140px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="142"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="142" height="25">(byte) 22</TD>
-					<TD height="25">Element code</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#method-response-flags">method-response-flags</A></EM></TD>
-					<TD>Describes which information includes the method call</TD>
-				</TR>
-				<TR>
-					<TD width="142"><EM><A href="#return-type-tag">return-type-tag</A></EM></TD>
-					<TD>Describes which kind of value is returned</TD>
-				</TR>
-				<TR>
-					<TD width="142">(bytes) 0, 0</TD>
-					<TD>???</TD>
-				</TR>
-			</TABLE>
-		<P></P>
-		<P>The following tables describe the format of the message content depending on the 
-			value of method-response-flags:</P>
-		<H4>method-response-flags &amp; NoArguments</H4>
-		<P>Used when the method has no out arguments.</P>
-		<P>
-			<TABLE id="Table10" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="139"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="139"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
-									<EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
-					<TD>
-						<P><EM>Only if return-type-tag was PrimitiveType.<BR>
-							</EM>Return value.</P>
-					</TD>
-				</TR>
-				<TR>
-					<TD width="139">Header[]</TD>
-					<TD>Only if there are Headers.</TD>
-				</TR>
-				<TR>
-					<TD width="139">object[]</TD>
-					<TD>
-						<P>Array with the following values:</P>
-						<UL>
-							<LI>
-								Return value, only&nbsp;if <EM>return-type-tag</EM> was <EM>ObjectType</EM>
-							<LI>
-								LogicalCallContext instance, only&nbsp;if method-response-flags has the flag 
-								IncludeLogicalCallContext</LI></UL>
-						<P>If the array is empty, it is not serialized.</P>
-					</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<H4>method-response-flags &amp; PrimitiveArguments</H4>
-		<P>Used when all out arguments are primitive types.</P>
-		<H2>
-			<TABLE id="Table12" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="139"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="139"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
-									<EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
-					<TD>
-						<P><EM>Only if return-type-tag was PrimitiveType.<BR>
-							</EM>Return value.</P>
-					</TD>
-				</TR>
-				<TR>
-					<TD width="139">uint</TD>
-					<TD>Number of out arguments</TD>
-				</TR>
-				<TR>
-					<TD width="139"><EM><EM><EM>( <A href="#type-spec">type-spec</A>
-									<BR>
-									<EM><A href="#primitive-value">primitive-value</A> )</EM></EM></EM>&nbsp;*</EM></TD>
-					<TD>One value for each argument</TD>
-				</TR>
-				<TR>
-					<TD width="139">Header[]</TD>
-					<TD>Only if there are Headers. Empty otherwise.</TD>
-				</TR>
-				<TR>
-					<TD width="139">object[]</TD>
-					<TD>
-						<P>Array with the following values:</P>
-						<UL>
-							<LI>
-								Return value, only&nbsp;if <EM>return-type-tag</EM> was <EM>ObjectType</EM>
-							<LI>
-								LogicalCallContext instance, only&nbsp;if method-response-flags has the flag 
-								IncludeLogicalCallContext</LI></UL>
-						<P>If the array is empty, it is not serialized.</P>
-					</TD>
-				</TR>
-			</TABLE>
-		</H2>
-		<H4>method-response-flags &amp; ArgumentsInSimpleArray</H4>
-		<P>Used when at least one out argument is not a primitive type, return type is 
-			primitive, and no other info needs to be serialized.</P>
-		<H2>
-			<TABLE id="Table13" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="140"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="140"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
-									<EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
-					<TD>
-						<P><EM>Only if return-type-tag was PrimitiveType.<BR>
-							</EM>Return value.</P>
-					</TD>
-				</TR>
-				<TR>
-					<TD width="140">Header[]</TD>
-					<TD>Only if there are Headers.</TD>
-				</TR>
-				<TR>
-					<TD width="140">object[]</TD>
-					<TD>Array that contains the out arguments</TD>
-				</TR>
-			</TABLE>
-		</H2>
-		<H4>method-response-flags &amp; ArgumentsInMultiArray</H4>
-		<P>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.</P>
-		<H2>
-			<TABLE id="Table14" style="WIDTH: 568px; HEIGHT: 75px" cellSpacing="1" cellPadding="1" width="568" border="1">
-				<TR>
-					<TD width="141"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="141"><EM><EM><EM><A href="#type-spec">type-spec</A><BR>
-									<EM><A href="#primitive-value">primitive-value</A></EM></EM></EM></EM></TD>
-					<TD>
-						<P>Only if <EM>return-type-tag </EM>was <EM>PrimitiveType.<BR>
-							</EM>Return value.</P>
-					</TD>
-				</TR>
-				<TR>
-					<TD width="141">Header[]</TD>
-					<TD>Only if there are Headers</TD>
-				</TR>
-				<TR>
-					<TD width="141">object[]</TD>
-					<TD>
-						<P>Array with the following values:</P>
-						<UL>
-							<LI>
-							Array of out arguments.
-							<LI>
-								Return value, only&nbsp;if <EM>return-type-tag</EM> was <EM>ObjectType</EM>
-							<LI>
-								LogicalCallContext instance, only&nbsp;if method-response-flags has the flag 
-								IncludeLogicalCallContext</LI></UL>
-					</TD>
-				</TR>
-			</TABLE>
-		</H2>
-		<a name="other"></a>
-		<H2>Other elements</H2>
-		<a name="string"></a>
-		<H3>string</H3>
-		<P>A string value, serialized using BinaryWriter. It serializes the length of the 
-			string,&nbsp;using a&nbsp;7-bit encoded int, and then the string chars.</P>
-		<a name="primitive-value"></a>
-		<H3>primitive-value</H3>
-		<P>A primitive value. It can be serialized using BinaryWriter and deserialized 
-			using BinaryReader. DateTime is serialized as a long (using the Ticks 
-			property).
-		</P>
-		<a name="value"></a>
-		<H3>value</H3>
-		<P>It can be a <A href="#primitive-value">primitive-value</A> or any of the 
-			following binary elements:</P>
-		<UL>
-			<LI>
-				<A href="#elem1">1 - RefTypeObject</A>
-			(only for value types)
-			<LI>
-				<A href="#elem4">4 - RuntimeObject</A>
-			(only for value types)
-			<LI>
-				<A href="#elem5">5 - ExternalObject</A>&nbsp;(only for value types)
-			<LI>
-				<A href="#elem6">6 - String</A>
-			<LI>
-				<A href="#elem8">8 - BoxedPrimitiveTypeValue</A>
-			<LI>
-				<A href="#elem9">9 - ObjectReference</A>
-			<LI>
-				<A href="#elem10">10 - NullValue</A>
-			<LI>
-				<A href="#elem13">13 - ArrayFiller8b</A>&nbsp;(only inside 
-			single-dimensional object arrays)
-			<LI>
-				<A href="#elem14">14 - ArrayFiller32b</A> (only inside single-dimensional 
-				object arrays)</LI></UL>
-		<a name="type-tag"></a>
-		<H3>type-tag</H3>
-		<P>Together with a <A href="#type-spec">type-spec</A> 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&nbsp;take less bytes).</P>
-		<P>type-tag can be one of the following:</P>
-		<P>
-			<TABLE id="Table18" cellSpacing="1" cellPadding="1" width="600" border="1">
-				<TR>
-					<TD><STRONG>Value</STRONG></TD>
-					<TD><STRONG>Label</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-					<TD><STRONG>type-spec needed</STRONG></TD>
-				</TR>
-				<TR>
-					<TD>0</TD>
-					<TD>PrimitiveType</TD>
-					<TD>A primitive type</TD>
-					<TD>The code of the primitive type</TD>
-				</TR>
-				<TR>
-					<TD>1</TD>
-					<TD>String</TD>
-					<TD>String class. type-spec is not needed.</TD>
-					<TD>Not needed</TD>
-				</TR>
-				<TR>
-					<TD>2</TD>
-					<TD>ObjectType</TD>
-					<TD>Object class. type-spec is not needed.</TD>
-					<TD>Not needed</TD>
-				</TR>
-				<TR>
-					<TD height="20">3</TD>
-					<TD height="20">RuntimeType</TD>
-					<TD height="20">A type from the .NET runtime (including arrays of .NET types)</TD>
-					<TD height="20">The name of the class</TD>
-				</TR>
-				<TR>
-					<TD>4</TD>
-					<TD>GenericType</TD>
-					<TD>Any other&nbsp;type (including arrays)</TD>
-					<TD>The name of the class and the id of the assembly</TD>
-				</TR>
-				<TR>
-					<TD>5</TD>
-					<TD>ArrayOfObject</TD>
-					<TD>Array of class Object</TD>
-					<TD>Not needed</TD>
-				</TR>
-				<TR>
-					<TD>6</TD>
-					<TD>ArrayOfString</TD>
-					<TD>Array of class String</TD>
-					<TD>Not needed</TD>
-				</TR>
-				<TR>
-					<TD>7</TD>
-					<TD>ArrayOfPrimitiveType</TD>
-					<TD>Array of primitive type</TD>
-					<TD>The code of the primitive type</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="type-spec"></a>
-		<H3>type-spec</H3>
-		<P>It is the name or the code of a type. To decode it, a <A href="#type-tag">type-tag</A>
-			value is needed. The following tables shows the format of type-spec for each 
-			type-tag value:</P>
-		<H4>type-tag = PrimitiveType or ArrayOfPrimitiveType</H4>
-		<P>
-			<TABLE id="Table16" style="WIDTH: 560px; HEIGHT: 14px" cellSpacing="1" cellPadding="1" width="560" border="1">
-				<TR>
-					<TD width="119"><STRONG>Element</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="119"><A href="#primitive-type-code">primitive-type-code</A></TD>
-					<TD>
-						The code of the primitive type</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<H4>type-tag = RuntimeType</H4>
-		<P>
-			<TABLE id="Table15" style="WIDTH: 560px; HEIGHT: 14px" cellSpacing="1" cellPadding="1" width="560" border="1">
-				<TR>
-					<TD><STRONG><STRONG>Element</STRONG></STRONG></TD>
-					<TD><STRONG><STRONG>Description</STRONG></STRONG></TD>
-				</TR>
-				<TR>
-					<TD><EM><A href="#string">string</A></EM></TD>
-					<TD>The name of the class, including the namespace</TD>
-				</TR>
-			</TABLE>
-			<H4>type-tag = GenericType</H4>
-		<P>
-			<TABLE id="Table17" style="WIDTH: 560px; HEIGHT: 14px" cellSpacing="1" cellPadding="1" width="560" border="1">
-				<TR>
-					<TD><STRONG>Element</STRONG></TD>
-					<TD><STRONG><STRONG>Description</STRONG></STRONG></TD>
-				</TR>
-				<TR>
-					<TD><EM><A href="#string">string</A></EM></TD>
-					<TD>The name of the class, including the namespace</TD>
-				</TR>
-				<TR>
-					<TD>uint</TD>
-					<TD>Id of the assembly where the class is defined</TD>
-				</TR>
-			</TABLE>
-			<H3>
-				<H4>Other type-tag</H4>
-			</H3>
-		<P>For other type-tag values, no type-spec is needed.</P>
-		<a name="method-call-flags"></a>
-		<H3>method-call-flags</H3>
-		<P>
-			<TABLE id="Table3" cellSpacing="1" cellPadding="1" width="600" border="1">
-				<TR>
-					<TD><STRONG>Value</STRONG></TD>
-					<TD><STRONG>Label</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD>1</TD>
-					<TD>NoArguments</TD>
-					<TD>No arguments included</TD>
-				</TR>
-				<TR>
-					<TD>2</TD>
-					<TD>PrimitiveArguments</TD>
-					<TD>Primitive type arguments</TD>
-				</TR>
-				<TR>
-					<TD>4</TD>
-					<TD>ArgumentsInSimpleArray</TD>
-					<TD>At least one out argument is not from a primitive type</TD>
-				</TR>
-				<TR>
-					<TD height="20">8</TD>
-					<TD height="20">ArgumentsInMultiArray</TD>
-					<TD height="20">At least one out argument is not from a primitive type and other 
-						info is included in the message (context or signature)</TD>
-				</TR>
-				<TR>
-					<TD>16</TD>
-					<TD>ExcludeLogicalCallContext</TD>
-					<TD>LogicalContext not included</TD>
-				</TR>
-				<TR>
-					<TD>32</TD>
-					<TD></TD>
-					<TD>???</TD>
-				</TR>
-				<TR>
-					<TD>64</TD>
-					<TD>IncludesLogicalCallContext</TD>
-					<TD>LogicalContext included</TD>
-				</TR>
-				<TR>
-					<TD>128</TD>
-					<TD>IncludesSignature</TD>
-					<TD>Signature is included in the message. It is only included when calling an 
-						overloaded method.</TD>
-				</TR>
-				
-				<TR>
-					<TD>32768 (0x8000)</TD>
-					<TD>GenericArguments</TD>
-					<TD>Generic arguments are included in the message (NET_2_0).</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="method-response-flags"></a>
-		<H3>method-response-flags</H3>
-		<P>
-			<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="600" border="1">
-				<TR>
-					<TD><STRONG>Value</STRONG></TD>
-					<TD width="190"><STRONG>Label</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD>1</TD>
-					<TD width="190">NoArguments</TD>
-					<TD>Response with no out arguments</TD>
-				</TR>
-				<TR>
-					<TD>2</TD>
-					<TD width="190">PrimitiveArguments</TD>
-					<TD>
-						Response with primitive type out arguments</TD>
-				</TR>
-				<TR>
-					<TD>4</TD>
-					<TD width="190">ArgumentsInSimpleArray</TD>
-					<TD>Response with primitive type return value, and with at least one out argument 
-						that is not a primitive type.</TD>
-				</TR>
-				<TR>
-					<TD>8</TD>
-					<TD width="190">ArgumentsInMultiArray</TD>
-					<TD>Response with at least one out argument that is not a primitive type, and other 
-						info is included in the message (context or signature)</TD>
-				</TR>
-				<TR>
-					<TD>16</TD>
-					<TD width="190">ExcludeLogicalCallContext</TD>
-					<TD>LogicalContext not included</TD>
-				</TR>
-				<TR>
-					<TD>32</TD>
-					<TD width="190"></TD>
-					<TD>???</TD>
-				</TR>
-				<TR>
-					<TD>64</TD>
-					<TD width="190">IncludesLogicalCallContext</TD>
-					<TD>LogicalContext included</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="return-type-tag"></a>
-		<H3>return-type-tag</H3>
-		<P>
-			<TABLE id="Table11" cellSpacing="1" cellPadding="1" width="600" border="1">
-				<TR>
-					<TD><STRONG>Value</STRONG></TD>
-					<TD><STRONG>Label</STRONG></TD>
-					<TD><STRONG>Description</STRONG></TD>
-				</TR>
-				<TR>
-					<TD>2</TD>
-					<TD>Null</TD>
-					<TD>Null return value</TD>
-				</TR>
-				<TR>
-					<TD>8</TD>
-					<TD>PrimitiveType</TD>
-					<TD>Primitive type return value</TD>
-				</TR>
-				<TR>
-					<TD>16</TD>
-					<TD>ObjectType</TD>
-					<TD>Object instance return value</TD>
-				</TR>
-				<TR>
-					<TD>32</TD>
-					<TD>Exception</TD>
-					<TD>Method response is an exception</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<a name="primitive-type-code"></a>
-		<H3>primitive-type-code</H3>
-		<P>
-			<TABLE id="Table19" height="171" cellSpacing="1" cellPadding="1" width="320" border="1">
-				<TR>
-					<TD width="45"><STRONG>Value</STRONG></TD>
-					<TD width="190"><STRONG>Label</STRONG></TD>
-				</TR>
-				<TR>
-					<TD width="45">1</TD>
-					<TD width="190">Boolean
-					</TD>
-				</TR>
-				<TR>
-					<TD width="45">2</TD>
-					<TD width="190">Byte</TD>
-				</TR>
-				<TR>
-					<TD width="45">3</TD>
-					<TD width="190">Char</TD>
-				</TR>
-				<TR>
-					<TD width="45">5</TD>
-					<TD width="190">Decimal</TD>
-				</TR>
-				<TR>
-					<TD width="45">6</TD>
-					<TD width="190">Double</TD>
-				</TR>
-				<TR>
-					<TD width="45">7</TD>
-					<TD width="190">Int16</TD>
-				</TR>
-				<TR>
-					<TD width="45">8</TD>
-					<TD width="190">Int32</TD>
-				</TR>
-				<TR>
-					<TD width="45">9</TD>
-					<TD width="190">Int64</TD>
-				</TR>
-				<TR>
-					<TD width="45">10</TD>
-					<TD width="190">SByte</TD>
-				</TR>
-				<TR>
-					<TD width="45">11</TD>
-					<TD width="190">Single</TD>
-				</TR>
-				<TR>
-					<TD width="45">13</TD>
-					<TD width="190">DateTime</TD>
-				</TR>
-				<TR>
-					<TD width="45">14</TD>
-					<TD width="190">UInt16</TD>
-				</TR>
-				<TR>
-					<TD width="45">15</TD>
-					<TD width="190">UInt32</TD>
-				</TR>
-				<TR>
-					<TD width="45">16</TD>
-					<TD width="190">UInt64</TD>
-				</TR>
-				<TR>
-					<TD width="45">18</TD>
-					<TD width="190">String</TD>
-				</TR>
-			</TABLE>
-		</P>
-		<HR width="100%" SIZE="1">
-		<FONT size="1">2003 (C) Lluis Sanchez Gual&nbsp; (</FONT> <A href="mailto:[email protected]">
-			<FONT size="1">[email protected]</FONT></A><FONT size="1">)</FONT>
-		<P>&nbsp;</P>
-	</body>
-</html>

+ 0 - 5
mcs/class/corlib/System.Runtime.Serialization.Formatters/.gitattributes

@@ -1,5 +0,0 @@
-/IFieldInfo.cs -crlf
-/ISoapMessage.cs -crlf
-/ServerFault.cs -crlf
-/SoapFault.cs -crlf
-/SoapMessage.cs -crlf

+ 0 - 51
mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog

@@ -1,51 +0,0 @@
-2007-05-03  Dick Porter  <[email protected]>
-
-	* 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 <[email protected]>
-
-	* SoapMessage.cs: fixed serialization compatibility with MS.NET
-
-2003-11-18  Andreas Nahr <[email protected]>
-
-	* 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 <[email protected]>
-
-	* SoapFault.cs: finishing implementation
-	* ServerFault.cs: finishing implementation
-	* SoapMessage.cs: finishing implementation
-
-2002-08-22  Nick Drochak  <[email protected]>
-
-	* SoapFault.cs: Serialization ctr should be private
-
-2002-08-14  Cesar Octavio Lopez Nataren <[email protected]>
-
-	* SoapFault.cs: Added the ctr for ISerializable implementation and
-	implemented GetObjectData.
-
-2002-07-30  Duncan Mak  <[email protected]>
-
-	* ServerFault.cs: 
-	* SoapFault.cs: 
-	* SoapMessage.cs: Added missing classes.
-
-2002-01-21  David Dawkins <[email protected]>
-
-	* IFieldInfo.cs : New file
-	* ISoapMessage.cs : New file
-

+ 0 - 55
mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs

@@ -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 ([email protected])]
-// 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 {
-
-
-	/// <summary>
-	/// </summary>
-	[ComVisible (true)]
-	[Serializable]
-	public enum FormatterAssemblyStyle {
-
-		/// <summary>
-		/// </summary>
-		Simple = 0,
-
-		/// <summary>
-		/// </summary>
-		Full = 1,
-	} // FormatterAssemblyStyle
-
-} // System.Runtime.Serialization.Formatters

+ 0 - 55
mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs

@@ -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 ([email protected])]
-// 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
-	
-	/// <summary>
-	/// </summary>
-	public enum FormatterTopObjectStyle {
-
-		/// <summary>
-		/// </summary>
-		Object = 0,
-
-		/// <summary>
-		/// </summary>
-		SoapMessage = 1,
-	} // FormatterTopObjectStyle
-#endif
-	
-} // System.Runtime.Serialization.Formatters

+ 0 - 59
mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs

@@ -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 ([email protected])]
-// 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 {
-
-
-	/// <summary>
-	/// </summary>
-	[ComVisible (true)]
-	[Serializable]
-	public enum FormatterTypeStyle {
-
-		/// <summary>
-		/// </summary>
-		TypesWhenNeeded = 0,
-
-		/// <summary>
-		/// </summary>
-		TypesAlways = 1,
-
-		/// <summary>
-		/// </summary>
-		XsdString = 2,
-	} // FormatterTypeStyle
-
-} // System.Runtime.Serialization.Formatters

+ 0 - 56
mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs

@@ -1,56 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.IFieldInfo
-//
-// Author:
-//   David Dawkins ([email protected])
-//
-// (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 {
-
-	/// <summary>
-	/// Interface for querying field information on serialized objects.</summary>
-	[ComVisible (true)]
-	public interface IFieldInfo {
-
-		/// <summary>
-		/// Get or set the field names for serialized objects.</summary>
-		string[] FieldNames {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// Get or set the field types for serialized objects.</summary>
-		Type[] FieldTypes {
-			get;
-			set;
-		}
-	}
-}

+ 0 - 86
mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs

@@ -1,86 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.ISoapMessage
-//
-// Author:
-//   David Dawkins ([email protected])
-//
-// (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 {
-
-	/// <summary>
-	/// Interface for making SOAP method calls</summary>
-	[ComVisible (true)]
-	public interface ISoapMessage {
-
-		/// <summary>
-		/// Get or set the headers ("out-of-band" data) for the method call</summary>
-		Header[] Headers {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// Get or set the method name</summary>
-		string MethodName {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// Get or set the method parameter names</summary
-		string[] ParamNames {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// Get or set the method parameter types</summary
-		Type[] ParamTypes {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// Get or set the method parameter values</summary
-		object[]  ParamValues {
-			get;
-			set;
-		}
-
-		/// <summary>
-		/// Get or set the XML namespace for the location of the called object</summary
-		string XmlNameSpace {
-			get;
-			set;
-		}
-	}
-}

+ 0 - 66
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs

@@ -1,66 +0,0 @@
-// InternalArrayTypeE.cs
-//
-// This code was automatically generated from
-// ECMA CLI XML Library Specification.
-// Generator: libgen.xsl [1.0; (C) Sergey Chaban ([email protected])]
-// Created: Wed, 5 Sep 2001 06:43:29 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
-	
-	/// <summary>
-	/// </summary>
-	public enum InternalArrayTypeE {
-
-		/// <summary>
-		/// </summary>
-		Empty = 0,
-
-		/// <summary>
-		/// </summary>
-		Single = 1,
-
-		/// <summary>
-		/// </summary>
-		Jagged = 2,
-
-		/// <summary>
-		/// </summary>
-		Rectangular = 3,
-
-		/// <summary>
-		/// </summary>
-		Base64 = 4,
-	} // InternalArrayTypeE
-#endif
-	
-} // System.Runtime.Serialization.Formatters

+ 0 - 57
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalElementTypeE {
-
-		/// <summary>
-		/// </summary>
-		ObjectBegin = 0,
-
-		/// <summary>
-		/// </summary>
-		ObjectEnd = 1,
-
-		/// <summary>
-		/// </summary>
-		Member = 2,
-	} // InternalElementTypeE
-#endif
-	
-} // System.Runtime.Serialization.Formatters

+ 0 - 60
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalMemberTypeE {
-
-		/// <summary>
-		/// </summary>
-		Empty = 0,
-
-		/// <summary>
-		/// </summary>
-		Header = 1,
-
-		/// <summary>
-		/// </summary>
-		Field = 2,
-
-		/// <summary>
-		/// </summary>
-		Item = 3,
-	} // InternalMemberTypeE
-#endif
-} // System.Runtime.Serialization.Formatters

+ 0 - 64
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalMemberValueE {
-
-		/// <summary>
-		/// </summary>
-		Empty = 0,
-
-		/// <summary>
-		/// </summary>
-		InlineValue = 1,
-
-		/// <summary>
-		/// </summary>
-		Nested = 2,
-
-		/// <summary>
-		/// </summary>
-		Reference = 3,
-
-		/// <summary>
-		/// </summary>
-		Null = 4,
-	} // InternalMemberValueE
-#endif
-} // System.Runtime.Serialization.Formatters

+ 0 - 84
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalNameSpaceE {
-
-		/// <summary>
-		/// </summary>
-		None = 0,
-
-		/// <summary>
-		/// </summary>
-		Soap = 1,
-
-		/// <summary>
-		/// </summary>
-		XdrPrimitive = 2,
-
-		/// <summary>
-		/// </summary>
-		XdrString = 3,
-
-		/// <summary>
-		/// </summary>
-		UrtSystem = 4,
-
-		/// <summary>
-		/// </summary>
-		UrtUser = 5,
-
-		/// <summary>
-		/// </summary>
-		UserNameSpace = 6,
-
-		/// <summary>
-		/// </summary>
-		MemberName = 7,
-
-		/// <summary>
-		/// </summary>
-		Interop = 8,
-
-		/// <summary>
-		/// </summary>
-		CallElement = 9,
-	} // InternalNameSpaceE
-#endif
-} // System.Runtime.Serialization.Formatters

+ 0 - 60
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalObjectPositionE {
-
-		/// <summary>
-		/// </summary>
-		Empty = 0,
-
-		/// <summary>
-		/// </summary>
-		Top = 1,
-
-		/// <summary>
-		/// </summary>
-		Child = 2,
-
-		/// <summary>
-		/// </summary>
-		Headers = 3,
-	} // InternalObjectPositionE
-#endif
-} // System.Runtime.Serialization.Formatters

+ 0 - 56
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalObjectTypeE {
-
-		/// <summary>
-		/// </summary>
-		Empty = 0,
-
-		/// <summary>
-		/// </summary>
-		Object = 1,
-
-		/// <summary>
-		/// </summary>
-		Array = 2,
-	} // InternalObjectTypeE
-#endif
-} // System.Runtime.Serialization.Formatters

+ 0 - 60
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalParseStateE {
-
-		/// <summary>
-		/// </summary>
-		Initial = 0,
-
-		/// <summary>
-		/// </summary>
-		Object = 1,
-
-		/// <summary>
-		/// </summary>
-		Member = 2,
-
-		/// <summary>
-		/// </summary>
-		MemberChild = 3,
-	} // InternalParseStateE
-#endif
-} // System.Runtime.Serialization.Formatters

+ 0 - 97
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalParseTypeE {
-
-		/// <summary>
-		/// </summary>
-		Empty = 0,
-
-		/// <summary>
-		/// </summary>
-		SerializedStreamHeader = 1,
-
-		/// <summary>
-		/// </summary>
-		Object = 2,
-
-		/// <summary>
-		/// </summary>
-		Member = 3,
-
-		/// <summary>
-		/// </summary>
-		ObjectEnd = 4,
-
-		/// <summary>
-		/// </summary>
-		MemberEnd = 5,
-
-		/// <summary>
-		/// </summary>
-		Headers = 6,
-
-		/// <summary>
-		/// </summary>
-		HeadersEnd = 7,
-
-		/// <summary>
-		/// </summary>
-		SerializedStreamHeaderEnd = 8,
-
-		/// <summary>
-		/// </summary>
-		Envelope = 9,
-
-		/// <summary>
-		/// </summary>
-		EnvelopeEnd = 10,
-
-		/// <summary>
-		/// </summary>
-		Body = 11,
-
-		/// <summary>
-		/// </summary>
-		BodyEnd = 12,
-	} // InternalParseTypeE
-#endif
-	
-} // System.Runtime.Serialization.Formatters

+ 0 - 112
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs

@@ -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 ([email protected])]
-// 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
-
-	/// <summary>
-	/// </summary>
-	public enum InternalPrimitiveTypeE {
-
-		/// <summary>
-		/// </summary>
-		Invalid = 0,
-
-		/// <summary>
-		/// </summary>
-		Boolean = 1,
-
-		/// <summary>
-		/// </summary>
-		Byte = 2,
-
-		/// <summary>
-		/// </summary>
-		Char = 3,
-
-		/// <summary>
-		/// </summary>
-		Currency = 4,
-
-		/// <summary>
-		/// </summary>
-		Decimal = 5,
-
-		/// <summary>
-		/// </summary>
-		Double = 6,
-
-		/// <summary>
-		/// </summary>
-		Int16 = 7,
-
-		/// <summary>
-		/// </summary>
-		Int32 = 8,
-
-		/// <summary>
-		/// </summary>
-		Int64 = 9,
-
-		/// <summary>
-		/// </summary>
-		SByte = 10,
-
-		/// <summary>
-		/// </summary>
-		Single = 11,
-
-		/// <summary>
-		/// </summary>
-		TimeSpan = 12,
-
-		/// <summary>
-		/// </summary>
-		DateTime = 13,
-
-		/// <summary>
-		/// </summary>
-		UInt16 = 14,
-
-		/// <summary>
-		/// </summary>
-		UInt32 = 15,
-
-		/// <summary>
-		/// </summary>
-		UInt64 = 16,
-	} // InternalPrimitiveTypeE
-#endif
-} // System.Runtime.Serialization.Formatters

+ 0 - 57
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalRM.cs

@@ -1,57 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.InternalRM.cs
-//
-// Author:
-//   Andreas Nahr ([email protected])
-//
-// (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 ();
-		}
-	}
-}

+ 0 - 83
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalST.cs

@@ -1,83 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.InternalST.cs
-//
-// Author:
-//   Andreas Nahr ([email protected])
-//
-// (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 ();
-		}
-	}
-}

+ 0 - 53
mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs

@@ -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 ([email protected])]
-// 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
-	/// <summary>
-	/// </summary>
-	public enum InternalSerializerTypeE {
-
-		/// <summary>
-		/// </summary>
-		Soap = 1,
-
-		/// <summary>
-		/// </summary>
-		Binary = 2,
-	} // InternalSerializerTypeE
-#endif
-	
-} // System.Runtime.Serialization.Formatters

+ 0 - 78
mcs/class/corlib/System.Runtime.Serialization.Formatters/ServerFault.cs

@@ -1,78 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.ServerFault.cs
-//
-// Author: Duncan Mak  ([email protected])
-// 	   Jean-Marc Andre ([email protected])
-//
-// 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; }
-		}
-	}
-}

+ 0 - 101
mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapFault.cs

@@ -1,101 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.SoapFault.cs
-//
-// Author: Duncan Mak  ([email protected])
-//         Jean-Marc Andre ([email protected])
-//
-// 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));
-		}
-	}
-}

+ 0 - 86
mcs/class/corlib/System.Runtime.Serialization.Formatters/SoapMessage.cs

@@ -1,86 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.SoapMessage.cs
-//
-// Author: Duncan Mak  ([email protected])
-// 	   Jean-Marc Andre ([email protected])	
-//
-// 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; }
-		}
-	}
-}

+ 0 - 43
mcs/class/corlib/System.Runtime.Serialization.Formatters/TypeFilterLevel.cs

@@ -1,43 +0,0 @@
-//
-// System.Runtime.Serialization.Formatters.TypeFilterLevel.cs
-//
-// Author:
-//   Andreas Nahr ([email protected])
-//
-// (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
-	}
-}

+ 0 - 347
mcs/class/corlib/System.Runtime.Serialization/ChangeLog

@@ -1,347 +0,0 @@
-2010-06-03  Jb Evain  <[email protected]>
-
-	* SafeSerializationEventArgs.cs: add new type in net_4_0.
-
-2010-06-03  Jb Evain  <[email protected]>
-
-	* ISafeSerializationData.cs: add new interface in net_4_0.
-
-2008-05-22  Miguel de Icaza  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* IFormatterConverter.cs
-	* SerializationException.cs
-	* StreamingContext.cs: Fix parameter names
-
-2006-12-18  Lluis Sanchez Gual  <[email protected]>
-
-	* FormatterServices.cs: In GetFields, avoid creating a field
-	  clone in some cases where it's not really necessary.
-
-2006-11-13  Jensen Somers  <[email protected]>
-
-	* Fixed the Serializable attribute in OnDeserializedAttribute,
-	OnDeserializingAttribute, OnSerializedAttribute and
-	OnSerializingAttribute.
-
-2006-11-13  Jensen Somers  <[email protected]>
-
-	* Removed [Serializable] from OnDeserializedAttribute,
-	OnDeserializingAttribute, OnSerializedAttribute,
-	OnSerializingAttribute.
-
-2006-11-10  Jensen Somers  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* Apply ComVisibleAttribute.
-
-2006-10-29  Robert Jordan  <[email protected]>
-
-	* ObjectManager.cs: Add NET_2_0 serialization callbacks.
-	
-2006-10-29  Robert Jordan  <[email protected]>
-
-	* SerializationObjectManager.cs,
-	SerializationCallbacks.cs: Add support for NET_2_0 serialization
-	events. See bug #78594.
-
-2006-08-06  Lluis Sanchez Gual  <[email protected]>
-
-	* ObjectManager.cs: Add support for nested IObjectReference.
-	Fixes bug #78749.
-
-2006-07-31  Sebastien Pouliot  <[email protected]>
-
-	* ObjectIDGenerator.cs: Fix ArgumentNullException parameter.
-
-2006-06-04  Miguel de Icaza  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* ObjectManager.cs (ObjectRecord.IsInstanceReady): Fix regression
-	introduced in previous patch.  See the re-opened bug #76931.
-
-2005-12-15  Martin Baulig  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* ObjectIDGenerator.cs: Use custom comparer instead of an instance
-	wrapper. Closes bug #76017.
-
-2005-06-13  Lluis Sanchez Gual  <[email protected]>
-
-	* Formatter.cs: Properly initialize protected fields. Fixes bug #75233. 
-
-2005-05-17  Lluis Sanchez Gual  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* 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 <[email protected]>
-
-	* ObjectIDGenerator.cs: added TODO for serialization
-
-2004-06-09  Duncan Mak  <[email protected]>
-
-	* ObjectManager.cs (RegisterObject): Add checks for
-	ArgumentNullException as well.
-
-2004-06-09  Duncan Mak  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* SerializationInfo.cs: Removed useless [CLSCompliant (false)]
-
-2003-11-21  Andreas Nahr <[email protected]>
-
-	* FormatterServices.cs: Added CheckTypeSecurity() and
-	  GetSafeUninitializedObject().
-
-2003-11-18  Andreas Nahr <[email protected]>
-
-	* ObjectManager.cs: Fixed header, internalized enum
-	* Formatter.cs: Implemented
-
-2003-11-11  Lluis Sanchez Gual  <[email protected]>
-
-	* FormatterServices.cs: Fixed some comments.
-
-2003-10-21  Lluis Sanchez Gual  <[email protected]>
-
-	* SerializationInfo.cs: Fixed bug in GetValue. Use IsAssignableFrom instead
-	  of IsSubclass, since the type can be an interface.
-
-2003-10-18  Lluis Sanchez Gual  <[email protected]>
-
-	* FormatterServices.cs: In GetUninitializedObject methdod, reuse
-	ActivationServices.AllocateUninitializedClassInstance, it does the same.
-
-2003-07-28  Duncan Mak  <[email protected]>
-
-	* Formatter.cs (WriteSByte): Added CLSCompliant attribute.
-
-2003-07-26  Gonzalo Paniagua Javier <[email protected]>
-
-	* FormatterServices.cs:
-	(GetSerializableMembers): check that all base types are serializable
-	when getting their fields. Fixes bug #46875.
-
-2003-07-17  Lluis Sanchez Gual  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* SerializationInfo.cs: Fixed bug #44955
-
-2003-05-11  Gonzalo Paniagua Javier <[email protected]>
-
-	* FormatterServices.cs: patch from Jean Marc that fixes bug #42742.
-
-2003-02-18  Lluis Sanchez Gual  <[email protected]>
-
-	* ObjectManager.cs: Corrected a problem with arrays of structs. Elements where
-	  not correctly updated by the final fixup.
-
-2003-01-27  Lluis Sanchez Gual  <[email protected]>
-
-	* ObjectManager.cs: Corrected a problem with IObjectReferece objects.
-
-2003-01-24  Martin Baulig  <[email protected]>
-
-	* ObjectManager.cs (RaiseDeserializationEvent): Walk the object
-	list in the correct order.
-
-2003-01-16  Lluis Sanchez Gual  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* Formatter.cs (WriteValueType): Remove the erroneous CLSCompliant attribute.
-
-2002-08-16  Gonzalo Paniagua Javier <[email protected]>
-
-	* FormatterServices.cs: implemented GetUninitializedObject.
-	PopulateObjectMembers needs a working FieldInfo.SetValue (it's
-	not implemented right now).
-
-2002-08-16  Gonzalo Paniagua Javier <[email protected]>
-
-	* FormatterServices.cs:a implemented GetSerializableMembers ().
-
-2002-08-16  Gonzalo Paniagua Javier <[email protected]>
-
-	* FormatterServices.cs: New file with some implementation.
-
-2002-08-16  Dietmar Maurer  <[email protected]>
-
-	* SerializationInfo.cs: special case for null values.
-	use the converter everywhere.
-
-2002-08-14  Dietmar Maurer  <[email protected]>
-
-	* SerializationInfo.cs: added new function to support the runtime
-
-2002-07-16  Gonzalo Paniagua Javier <[email protected]>
-
-	* Formatter.cs: added namespace.
-
-2002-06-10  Duncan Mak  <[email protected]>
-
-	* Formatter.cs: Addd to CVS.
-
-	* FormatterConverter.cs: Added to CVS.
-
-	* SerializationInfo.cs (AddValue): Removed extra CLSCompliant attribute.
-
-2002-04-12  Duncan Mak  <[email protected]>
-
-	* SerializationException.cs: Added missing constructor for serialization.
-
-2002-03-12  Duncan Mak  <[email protected]>
-
-	* IFormatter.cs: Fix the return type of the Serialize method.
-
-2002/03/07  Nick Drochak <[email protected]>
-
-	* StreamingContextStates.cs: Add missing value (CrossAppDomain) and
-	adjust All value accordingly.
-
-2002-03-01  Duncan Mak  <[email protected]>
-
-	* ObjectIDGenerator.cs: Implemented.
-
-2002-02-19  Duncan Mak  <[email protected]>
-
-	* SurrogateSelector.cs: Implemented.	
-
-	* SerializationInfoEnumerator.cs: oh, and simplified the Current
-	property too.
-	
-	* SerializationInfo.cs: Forgot to finish up GetEnumerator ().
-
-2002-02-18  Duncan Mak  <[email protected]>
-
-	* SerializationInfo.cs: Converted Type.GetType calls to the faster
-	typeof operator.
-
-2002-02-16  Duncan Mak  <[email protected]>
-
-	* SurrogateSelector.cs: Stubbed out. Gonna be working on this
-	tomorrow.
-
-2002-02-15  Duncan Mak  <[email protected]>
-
-	* 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 <[email protected]>
-
-	* SerializationInfoEnumerator.cs: New file (stub)
-
-2002-02-12  Duncan Mak  <[email protected]>
-	
-	* 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 <[email protected]>
-
-	* IFormatter.cs : New file
-	* ISerializationSurrogate.cs : New file
-	* ISurrogateSelector.cs : New file
-
-2002-05-01  Ravi Pratap  <[email protected]>
-
-	* SerializationInfo.cs : Insert MonoTODO attribute.
-
-2001-08-24  Nick Drochak  <[email protected]>
-
-	* IDeserializationCallback.cs: New File
-
-Wed Nov 14 17:03:30 CET 2001 Paolo Molaro <[email protected]>
-
-	* IFormatterConverter.cs, SerializationInfo.cs: CLSCompliant updates.
-
-Fri Nov 2 18:40:12 CET 2001 Paolo Molaro <[email protected]>
-
-	* SerializationException.cs: implemented.
-
-2001-08-24  Nick Drochak  <[email protected]>
-
-	* SerializationInfo.cs: Added all the public methods so that the compile would not break
-
-2001-07-20  Miguel de Icaza  <[email protected]>
-
-	* SerializationInfo.cs: New file.
-
-	* IFormatterConverter.cs: New file.
-
-	* ISerializable.cs: New file.

+ 0 - 186
mcs/class/corlib/System.Runtime.Serialization/Formatter.cs

@@ -1,186 +0,0 @@
-//
-// System.Runtime.Serialization.Formatter.cs
-//
-// Authors:
-//   Duncan Mak  ([email protected])
-//   Andreas Nahr ([email protected])
-//
-// (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);	
-}
-}

+ 0 - 177
mcs/class/corlib/System.Runtime.Serialization/FormatterConverter.cs

@@ -1,177 +0,0 @@
-//
-// System.Runtime.Serialization.Formatter.cs
-//
-// Duncan Mak  ([email protected])
-//
-// (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);
-		}
-	}
-}

+ 0 - 218
mcs/class/corlib/System.Runtime.Serialization/FormatterServices.cs

@@ -1,218 +0,0 @@
-//
-// System.Runtime.Serialization.FormatterServices
-//
-// Authors:
-//	Gonzalo Paniagua Javier ([email protected])
-//
-// (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;
-		}
-	}
-}

+ 0 - 39
mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs

@@ -1,39 +0,0 @@
-//
-// System.Runtime.Serialization.IDeserializationCallback.cs
-//
-// Author:
-//   Nick Drochak([email protected])
-//
-// (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);
-	}
-}

+ 0 - 90
mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs

@@ -1,90 +0,0 @@
-//
-// System.Runtime.Serialization.IFormatter
-//
-// Author:
-//   David Dawkins ([email protected])
-//
-// (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 {
-
-	/// <summary>
-	/// Formatting for serialized objects</summary>
-	[System.Runtime.InteropServices.ComVisibleAttribute (true)]
-	public interface IFormatter {
-
-		//
-		// Properties
-		//
-
-		/// <summary>
-		/// Get or set the SerializationBinder used
-		/// for looking up types during deserialization</summary>
-		SerializationBinder Binder 
-		{
-			get; 
-			set; 
-		}
-
-		/// <summary>
-		/// Get or set the StreamingContext used for serialization
-		/// and deserialization</summary>
-		StreamingContext Context 
-		{ 
-			get; 
-			set; 
-		}
-
-		/// <summary>
-		/// Get or set the SurrogateSelector used by the current
-		/// formatter</summary>
-		ISurrogateSelector SurrogateSelector 
-		{ 
-			get; 
-			set; 
-		}
-
-		/// <summary>
-		/// Deserialize data from the specified stream, rebuilding
-		/// the object hierarchy</summary>
-		object Deserialize(
-			Stream serializationStream
-		);		
-
-		/// <summary>
-		/// Serialize the specified object to the specified stream.
-		/// Object may be the root of a graph of objects to be
-		/// serialized</summary>
-		void Serialize( 
-			Stream serializationStream,
-			object graph
-		);
-	}
-
-}

+ 0 - 57
mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs

@@ -1,57 +0,0 @@
-//
-// System.Runtime.Serialization.IFormatterConverter.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (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);
-	}
-}

+ 0 - 40
mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs

@@ -1,40 +0,0 @@
-//
-// System.Runtime.Serialization.IObjectReference.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (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);
-	}
-}
-

+ 0 - 36
mcs/class/corlib/System.Runtime.Serialization/ISafeSerializationData.cs

@@ -1,36 +0,0 @@
-//
-// System.Runtime.Serialization.ISafeSerializationData
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// 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);
-	}
-}
-

+ 0 - 40
mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs

@@ -1,40 +0,0 @@
-//
-// System.Runtime.Serialization.ISerializable.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (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);
-	}
-}

+ 0 - 68
mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs

@@ -1,68 +0,0 @@
-//
-// System.Runtime.Serialization.ISerializationSurrogate
-//
-// Author:
-//   David Dawkins ([email protected])
-//
-// (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 {
-
-	/// <summary>
-	/// Interface for serialization surrogates</summary>
-        [System.Runtime.InteropServices.ComVisibleAttribute (true)]
-
-	public interface ISerializationSurrogate {
-
-		/// <summary>
-		/// Get the SerializationInfo necessary to serialize
-		/// the specified object </summary>
-		/// <param name="obj">Object to be serialized</param>
-		/// <param name="info">SerializationInfo to be populated</param>
-		/// <param name="context">Destination for serialization</param>
-		void GetObjectData(
-			object obj,
-			SerializationInfo info,
-			StreamingContext context
-		);	
-
-		/// <summary>
-		/// Populate an object using the specified SerializationInfo </summary>
-		/// <param name="obj">Object to be populated</param>
-		/// <param name="info">Data used for populating object</param>
-		/// <param name="context">Source for deserialization of object</param>
-		/// <param name="selector>Starting point for searching for compatible surrogates</param>
-		/// <returns>The deserialized object</returns>
-		object SetObjectData(
-			object obj,
-			SerializationInfo info,
-			StreamingContext context,
-			ISurrogateSelector selector
-		);
-	}
-
-}

+ 0 - 65
mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs

@@ -1,65 +0,0 @@
-//
-// System.Runtime.Serialization.ISurrogateSelector
-//
-// Author:
-//   David Dawkins ([email protected])
-//
-// (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 {
-
-	/// <summary>
-	/// Creation of serialization surrogate selectors</summary>
-        [System.Runtime.InteropServices.ComVisibleAttribute (true)]
-
-	public interface ISurrogateSelector {
-
-		/// <summary>
-		/// Insert specified selector into available surrogates</summary>
-		void ChainSelector( ISurrogateSelector selector );
-
-		/// <summary>
-		/// Return next surrogate in the surrogate chain</summary>
-		ISurrogateSelector GetNextSelector();
-
-		/// <summary>
-		/// Fetch the surrogate according the specified type, starting
-		/// the search from the surrogate selector for the specified
-		/// StreamingContext</summary>
-		/// <param name="type">Type of the object to be serialized</param>
-		/// <param name="context">Context for the serialization/deserialization</para,>
-		/// <param name="selector">Upon return, contains a reference to the selector where the returned surrogate was found</param>
-		/// <returns>The surrogate for the specified type and context</returns>
-		ISerializationSurrogate GetSurrogate(
-			Type type,
-			StreamingContext context,
-			out ISurrogateSelector selector
-		);
-
-	}
-
-}

+ 0 - 117
mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs

@@ -1,117 +0,0 @@
-//
-// System.Runtime.Serialization.ObjectIDGenerator.cs
-//
-// Author: Duncan Mak  ([email protected])
-//         Lluis Sanchez ([email protected])
-//
-// (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 ++; }
-		}
-	}
-}

+ 0 - 638
mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs

@@ -1,638 +0,0 @@
-//
-// System.Runtime.Serialization.ObjectManager.cs
-//
-// Author: Lluis Sanchez Gual ([email protected])
-//
-// (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; }
-		}
-	}
-}

+ 0 - 38
mcs/class/corlib/System.Runtime.Serialization/OnDeserializedAttribute.cs

@@ -1,38 +0,0 @@
-//
-// System.Runtime.Serialization.OnDeserializedAttribute.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// 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 {
-	}
-}

+ 0 - 38
mcs/class/corlib/System.Runtime.Serialization/OnDeserializingAttribute.cs

@@ -1,38 +0,0 @@
-//
-// System.Runtime.Serialization.OnDeserializingAttribute.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// 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 {
-	}
-}

+ 0 - 38
mcs/class/corlib/System.Runtime.Serialization/OnSerializedAttribute.cs

@@ -1,38 +0,0 @@
-//
-// System.Runtime.Serialization.OnSerializedAttribute.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// 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 {
-	}
-}

+ 0 - 38
mcs/class/corlib/System.Runtime.Serialization/OnSerializingAttribute.cs

@@ -1,38 +0,0 @@
-//
-// System.Runtime.Serialization.OnSerializingAttribute.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// 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 {
-	}
-}

+ 0 - 49
mcs/class/corlib/System.Runtime.Serialization/OptionalFieldAttribute.cs

@@ -1,49 +0,0 @@
-//
-// System.Runtime.Serialization.OptionalFieldAttribute.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// 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;
-			}
-		}
-	}
-}

+ 0 - 50
mcs/class/corlib/System.Runtime.Serialization/SafeSerializationEventArgs.cs

@@ -1,50 +0,0 @@
-//
-// System.Runtime.Serialization.SafeSerializationEventArgs
-//
-// Author:
-//   Jb Evain ([email protected])
-//
-// 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 ();
-		}
-	}
-}
-

+ 0 - 52
mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs

@@ -1,52 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationBinder.cs
-//
-// Author: Duncan Mak ([email protected])
-//
-// (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;
-		}
-	}
-}

+ 0 - 160
mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs

@@ -1,160 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationCallbacks.cs
-//
-// Author:
-//   Robert Jordan ([email protected])
-//
-// 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;
-			}
-		}
-	}
-}

+ 0 - 64
mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs

@@ -1,64 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationEntry.cs
-//
-// Author: Duncan Mak ([email protected])
-//
-// (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;
-		}
-	}
-}

+ 0 - 62
mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs

@@ -1,62 +0,0 @@
-//
-// System.Runtime.Serialization/SerializationException.cs
-//
-// Author:
-//   Paolo Molaro ([email protected])
-//
-// (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)
-		{
-		}
-	}
-}

+ 0 - 390
mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs

@@ -1,390 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationInfo.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//   Duncan Mak ([email protected])
-//   Dietmar Maurer ([email protected])
-//
-// (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<string, SerializationEntry> serialized = new Dictionary<string, SerializationEntry> ();
-		List<SerializationEntry> values = new List<SerializationEntry> ();
-
-		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		
-	}
-}

+ 0 - 85
mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs

@@ -1,85 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationInfoEnumerator.cs
-//
-// Author: Duncan Mak ([email protected])
-//
-// (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 ();
-		}
-	}	
-}

+ 0 - 94
mcs/class/corlib/System.Runtime.Serialization/SerializationObjectManager.cs

@@ -1,94 +0,0 @@
-//
-// System.Runtime.Serialization.SerializationObjectManager.cs
-//
-// Author:
-//   Robert Jordan ([email protected])
-//
-// 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;
-			}
-		}
-	}
-}
-

+ 0 - 85
mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs

@@ -1,85 +0,0 @@
-//
-// System.Runtime.Serialization.StreamingContext.cs
-//
-// Author:
-//   Miguel de Icaza ([email protected])
-//
-// (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;
-		}
-	}
-}

+ 0 - 81
mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs

@@ -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 ([email protected])]
-// 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 {
-
-
-	/// <summary>
-	/// </summary>
-	[Flags]
-	[Serializable]
-	[System.Runtime.InteropServices.ComVisibleAttribute (true)]
-	public enum StreamingContextStates {
-
-		/// <summary>
-		/// </summary>
-		CrossProcess = 1,
-
-		/// <summary>
-		/// </summary>
-		CrossMachine = 2,
-
-		/// <summary>
-		/// </summary>
-		File = 4,
-
-		/// <summary>
-		/// </summary>
-		Persistence = 8,
-
-		/// <summary>
-		/// </summary>
-		Remoting = 16,
-
-		/// <summary>
-		/// </summary>
-		Other = 32,
-
-		/// <summary>
-		/// </summary>
-		Clone = 64,
-
-		CrossAppDomain = 128,
-
-		/// <summary>
-		/// </summary>
-		All = 255,
-	} // StreamingContextStates
-
-} // System.Runtime.Serialization

+ 0 - 120
mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs

@@ -1,120 +0,0 @@
-//
-// System.Runtime.Serialization.SurrogateSelector.cs
-//
-// Author: Duncan Mak ([email protected])
-//         Lluis Sanchez ([email protected])
-//
-// (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);
-		}
-	}
-}

+ 15 - 0
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};

+ 5 - 0
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);
+		}
 	}
 }

+ 1 - 1
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);

+ 9 - 0
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);
+		}
 	}
 }

+ 56 - 0
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 ()

+ 47 - 57
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

+ 3 - 0
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)