public virtual FileStream[] GetFiles() => GetFiles(getResourceModules: false);
public virtual FileStream[] GetFiles(bool getResourceModules) { throw NotImplemented.ByDesign; }
- public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
+ public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw NotImplemented.ByDesign; }
public override string ToString()
{
public Type ResolveType(int metadataToken) => ResolveType(metadataToken, null, null);
public virtual Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { throw NotImplemented.ByDesign; }
- public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
+ public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw NotImplemented.ByDesign; }
public override bool Equals(object o) => base.Equals(o);
public override int GetHashCode() => base.GetHashCode();
public object GetRealObject(StreamingContext context)
{
- throw new PlatformNotSupportedException();
+ // Once all the serializable fields have come in we can set up the real
+ // instance based on just two of them (MemberImpl and PositionImpl).
+
+ if (MemberImpl == null)
+ throw new SerializationException(SR.Serialization_InsufficientState);
+
+ ParameterInfo[] args = null;
+
+ switch (MemberImpl.MemberType)
+ {
+ case MemberTypes.Constructor:
+ case MemberTypes.Method:
+ if (PositionImpl == -1)
+ {
+ if (MemberImpl.MemberType == MemberTypes.Method)
+ return ((MethodInfo)MemberImpl).ReturnParameter;
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+ }
+ else
+ {
+ args = ((MethodBase)MemberImpl).GetParametersNoCopy();
+
+ if (args != null && PositionImpl < args.Length)
+ return args[PositionImpl];
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+ }
+
+ case MemberTypes.Property:
+ args = ((PropertyInfo)MemberImpl).GetIndexParameters();
+
+ if (args != null && PositionImpl > -1 && PositionImpl < args.Length)
+ return args[PositionImpl];
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+
+ default:
+ throw new SerializationException(SR.Serialization_NoParameterInfo);
+ }
}
public override string ToString() => ParameterType.FormatTypeName() + " " + Name;
using System.Diagnostics;
using System.Globalization;
-using System.Runtime.Serialization;
using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- internal sealed unsafe class MdFieldInfo : RuntimeFieldInfo, ISerializable
+ internal sealed unsafe class MdFieldInfo : RuntimeFieldInfo
{
#region Private Data Members
private int m_tkField;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Globalization;
-using System.Runtime.Serialization;
using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- internal sealed class RuntimeConstructorInfo : ConstructorInfo, ISerializable, IRuntimeMethodInfo
+ internal sealed class RuntimeConstructorInfo : ConstructorInfo, IRuntimeMethodInfo
{
#region Private Data Members
private volatile RuntimeType m_declaringType;
return RuntimeMethodHandle.InvokeMethod(null, null, sig, true);
}
#endregion
-
- #region ISerializable Implementation
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
-
- internal string SerializationToString()
- {
- // We don't need the return type for constructors.
- return FormatNameAndSig(true);
- }
- #endregion
}
}
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- internal unsafe sealed class RuntimeEventInfo : EventInfo, ISerializable
+ internal unsafe sealed class RuntimeEventInfo : EventInfo
{
#region Private Data Members
private int m_token;
internal RuntimeModule GetRuntimeModule() { return m_declaringType.GetRuntimeModule(); }
#endregion
- #region ISerializable
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
- #endregion
-
#region EventInfo Overrides
public override MethodInfo[] GetOtherMethods(bool nonPublic)
{
using System.Collections.Generic;
using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- internal abstract class RuntimeFieldInfo : FieldInfo, ISerializable
+ internal abstract class RuntimeFieldInfo : FieldInfo
{
#region Private Data Members
private BindingFlags m_bindingFlags;
#region FieldInfo Overrides
// All implemented on derived classes
#endregion
-
- #region ISerializable Implementation
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
- #endregion
}
}
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Globalization;
-using System.Runtime.Serialization;
using System.Security;
using System.Text;
using System.Threading;
namespace System.Reflection
{
- internal sealed class RuntimeMethodInfo : MethodInfo, ISerializable, IRuntimeMethodInfo
+ internal sealed class RuntimeMethodInfo : MethodInfo, IRuntimeMethodInfo
{
#region Private Data Members
private IntPtr m_handle;
}
#endregion
- #region ISerializable Implementation
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
-
- internal string SerializationToString()
- {
- return ReturnType.FormatTypeName(true) + " " + FormatNameAndSig(true);
- }
- #endregion
-
#region Legacy Internal
internal static MethodBase InternalGetCurrentMethod(ref StackCrawlMark stackMark)
{
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
using MdToken = System.Reflection.MetadataToken;
namespace System.Reflection
{
- internal unsafe sealed class RuntimeParameterInfo : ParameterInfo, ISerializable
+ internal unsafe sealed class RuntimeParameterInfo : ParameterInfo
{
#region Static Members
internal unsafe static ParameterInfo[] GetParameters(IRuntimeMethodInfo method, MemberInfo member, Signature sig)
}
#endregion
- #region VTS magic to serialize/deserialized to/from pre-Whidbey endpoints.
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
- #endregion
-
#region Constructor
// used by RuntimePropertyInfo
internal RuntimeParameterInfo(RuntimeParameterInfo accessor, RuntimePropertyInfo property)
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Globalization;
-using System.Runtime.Serialization;
using System.Text;
using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- internal unsafe sealed class RuntimePropertyInfo : PropertyInfo, ISerializable
+ internal unsafe sealed class RuntimePropertyInfo : PropertyInfo
{
#region Private Data Members
private int m_token;
#endregion
#endregion
-
- #region ISerializable Implementation
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
-
- internal string SerializationToString()
- {
- return FormatNameAndSig(true);
- }
- #endregion
}
}
using System.Collections;
using System.Collections.Generic;
using System.Runtime;
-using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
using System.Security;
using System.Text;
}
internal class RuntimeType :
- System.Reflection.TypeInfo, ISerializable, ICloneable
+ System.Reflection.TypeInfo, ICloneable
{
#region Definitions
}
#endregion
- #region ISerializable
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new PlatformNotSupportedException();
- }
- #endregion
-
#region ICustomAttributeProvider
public override Object[] GetCustomAttributes(bool inherit)
{