dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.19k stars 4.72k forks source link

Add missing members for System.Reflection namespace #16101

Closed pallavit closed 4 years ago

pallavit commented 8 years ago

This is a blanket issue to review gaps in System.Reflection namespace in .NetCore vs Desktop

Proposed additions to .NET Core

---.NET Core Currently
+++.NET Core Proposed
 namespace System.Reflection {
  public sealed class AmbiguousMatchException : Exception {
    public AmbiguousMatchException();
    public AmbiguousMatchException(string message);
    public AmbiguousMatchException(string message, Exception inner);
  }
  public abstract class Assembly {
+   public virtual string CodeBase { get; }
    public virtual IEnumerable<CustomAttributeData> CustomAttributes { get; }
    public abstract IEnumerable<TypeInfo> DefinedTypes { get; }
    public virtual MethodInfo EntryPoint { get; }
+   public virtual string EscapedCodeBase { get; }
    public virtual IEnumerable<Type> ExportedTypes { get; }
    public virtual string FullName { get; }
    public virtual bool IsDynamic { get; }
    public virtual string Location { get; }
    public virtual Module ManifestModule { get; }
    public abstract IEnumerable<Module> Modules { get; }
    public override bool Equals(object o);
    public static Assembly GetEntryAssembly();
    public override int GetHashCode();
    public virtual ManifestResourceInfo GetManifestResourceInfo(string resourceName);
    public virtual string[] GetManifestResourceNames();
    public virtual Stream GetManifestResourceStream(string name);
    public virtual AssemblyName GetName();
    public virtual Type GetType(string name);
    public virtual Type GetType(string name, bool throwOnError, bool ignoreCase);
    public static Assembly Load(AssemblyName assemblyRef);
    public override string ToString();
  }
  public enum AssemblyContentType {
    Default = 0,
    WindowsRuntime = 1,
  }
  public sealed class AssemblyName {
    public AssemblyName();
    public AssemblyName(string assemblyName);
    public AssemblyContentType ContentType { get; set; }
    public string CultureName { get; set; }
    public AssemblyNameFlags Flags { get; set; }
    public string FullName { get; }
    public string Name { get; set; }
    public ProcessorArchitecture ProcessorArchitecture { get; set; }
    public Version Version { get; set; }
    public byte[] GetPublicKey();
    public byte[] GetPublicKeyToken();
    public void SetPublicKey(byte[] publicKey);
    public void SetPublicKeyToken(byte[] publicKeyToken);
    public override string ToString();
  }
+ public abstract class Binder {
+   protected Binder();
  }
+ public enum BindingFlags {
+   CreateInstance = 512,
+   DeclaredOnly = 2,
+   Default = 0,
+   FlattenHierarchy = 64,
+   GetField = 1024,
+   GetProperty = 4096,
+   IgnoreCase = 1,
+   Instance = 4,
+   InvokeMethod = 256,
+   NonPublic = 32,
+   Public = 16,
+   SetField = 2048,
+   SetProperty = 8192,
+   Static = 8,
  }
  public abstract class ConstructorInfo : MethodBase {
    public static readonly string ConstructorName;
    public static readonly string TypeConstructorName;
+   public override MemberTypes MemberType { get; }
    public override bool Equals(object obj);
    public override int GetHashCode();
    public virtual object Invoke(object[] parameters);
  }
  public class CustomAttributeData {
    public virtual Type AttributeType { get; }
+   public virtual ConstructorInfo Constructor { get; }
    public virtual IList<CustomAttributeTypedArgument> ConstructorArguments { get; }
    public virtual IList<CustomAttributeNamedArgument> NamedArguments { get; }
+   public static IList<CustomAttributeData> GetCustomAttributes(Assembly target);
+   public static IList<CustomAttributeData> GetCustomAttributes(MemberInfo target);
+   public static IList<CustomAttributeData> GetCustomAttributes(Module target);
+   public static IList<CustomAttributeData> GetCustomAttributes(ParameterInfo target);
  }
  [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
  public struct CustomAttributeNamedArgument {
    public bool IsField { get; }
+   public MemberInfo MemberInfo { get; }
    public string MemberName { get; }
    public CustomAttributeTypedArgument TypedValue { get; }
  }
  [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
  public struct CustomAttributeTypedArgument {
    public Type ArgumentType { get; }
    public object Value { get; }
  }
  public abstract class EventInfo : MemberInfo {
    public virtual MethodInfo AddMethod { get; }
    public abstract EventAttributes Attributes { get; }
    public virtual Type EventHandlerType { get; }
+   public virtual bool IsMulticast { get; }
    public bool IsSpecialName { get; }
+   public override MemberTypes MemberType { get; }
    public virtual MethodInfo RaiseMethod { get; }
    public virtual MethodInfo RemoveMethod { get; }
    public virtual void AddEventHandler(object target, Delegate handler);
    public override bool Equals(object obj);
+   public MethodInfo GetAddMethod();
+   public virtual MethodInfo GetAddMethod(bool nonPublic);
    public override int GetHashCode();
+   public MethodInfo GetRaiseMethod();
+   public virtual MethodInfo GetRaiseMethod(bool nonPublic);
+   public MethodInfo GetRemoveMethod();
+   public virtual MethodInfo GetRemoveMethod(bool nonPublic);
    public virtual void RemoveEventHandler(object target, Delegate handler);
  }
  public abstract class FieldInfo : MemberInfo {
    public abstract FieldAttributes Attributes { get; }
+   public virtual RuntimeFieldHandle FieldHandle { get; }
    public abstract Type FieldType { get; }
    public bool IsAssembly { get; }
    public bool IsFamily { get; }
    public bool IsFamilyAndAssembly { get; }
    public bool IsFamilyOrAssembly { get; }
    public bool IsInitOnly { get; }
    public bool IsLiteral { get; }
    public bool IsPrivate { get; }
    public bool IsPublic { get; }
    public bool IsSpecialName { get; }
    public bool IsStatic { get; }
+   public override MemberTypes MemberType { get; }
    public override bool Equals(object obj);
    public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle);
    public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType);
    public override int GetHashCode();
    public abstract object GetValue(object obj);
    public virtual void SetValue(object obj, object value);
  }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
  public struct InterfaceMapping {
+   public MethodInfo[] InterfaceMethods;
+   public MethodInfo[] TargetMethods;
+   public Type InterfaceType;
+   public Type TargetType;
  }
  public static class IntrospectionExtensions {
    public static TypeInfo GetTypeInfo(this Type type);
  }
+ public class InvalidFilterCriteriaException : Exception {
+   public InvalidFilterCriteriaException();
+   public InvalidFilterCriteriaException(string message);
+   public InvalidFilterCriteriaException(string message, Exception inner);
  }
  public interface IReflectableType {
    TypeInfo GetTypeInfo();
  }
  public class LocalVariableInfo {
    protected LocalVariableInfo();
    public virtual bool IsPinned { get; }
    public virtual int LocalIndex { get; }
    public virtual Type LocalType { get; }
    public override string ToString();
  }
  public class ManifestResourceInfo {
    public ManifestResourceInfo(Assembly containingAssembly, string containingFileName, ResourceLocation resourceLocation);
    public virtual string FileName { get; }
    public virtual Assembly ReferencedAssembly { get; }
    public virtual ResourceLocation ResourceLocation { get; }
  }
+ public delegate bool MemberFilter(MemberInfo m, object filterCriteria);
  public abstract class MemberInfo {
    public virtual IEnumerable<CustomAttributeData> CustomAttributes { get; }
    public abstract Type DeclaringType { get; }
+   public virtual MemberTypes MemberType { get; }
+   public virtual int MetadataToken { get; }
    public virtual Module Module { get; }
    public abstract string Name { get; }
+   public virtual Type ReflectedType { get; }
    public override bool Equals(object obj);
    public override int GetHashCode();
  }
+ public enum MemberTypes {
+   All = 191,
+   Constructor = 1,
+   Custom = 64,
+   Event = 2,
+   Field = 4,
+   Method = 8,
+   NestedType = 128,
+   Property = 16,
+   TypeInfo = 32,
  }
  public abstract class MethodBase : MemberInfo {
    public abstract MethodAttributes Attributes { get; }
    public virtual CallingConventions CallingConvention { get; }
    public virtual bool ContainsGenericParameters { get; }
    public bool IsAbstract { get; }
    public bool IsAssembly { get; }
    public bool IsConstructor { get; }
    public bool IsFamily { get; }
    public bool IsFamilyAndAssembly { get; }
    public bool IsFamilyOrAssembly { get; }
    public bool IsFinal { get; }
    public virtual bool IsGenericMethod { get; }
    public virtual bool IsGenericMethodDefinition { get; }
    public bool IsHideBySig { get; }
    public bool IsPrivate { get; }
    public bool IsPublic { get; }
    public bool IsSpecialName { get; }
    public bool IsStatic { get; }
    public bool IsVirtual { get; }
+   public virtual RuntimeMethodHandle MethodHandle { get; }
    public abstract MethodImplAttributes MethodImplementationFlags { get; }
    public override bool Equals(object obj);
+   public static MethodBase GetCurrentMethod();
    public virtual Type[] GetGenericArguments();
    public override int GetHashCode();
    public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle);
    public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
+   public virtual MethodImplAttributes GetMethodImplementationFlags();
    public abstract ParameterInfo[] GetParameters();
    public virtual object Invoke(object obj, object[] parameters);
  }
  public abstract class MethodInfo : MethodBase {
+   public override MemberTypes MemberType { get; }
    public virtual ParameterInfo ReturnParameter { get; }
    public virtual Type ReturnType { get; }
    public virtual Delegate CreateDelegate(Type delegateType);
    public virtual Delegate CreateDelegate(Type delegateType, object target);
    public override bool Equals(object obj);
+   public virtual MethodInfo GetBaseDefinition();
    public override Type[] GetGenericArguments();
    public virtual MethodInfo GetGenericMethodDefinition();
    public override int GetHashCode();
    public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments);
  }
  public abstract class Module {
+   public static readonly TypeFilter FilterTypeName;
+   public static readonly TypeFilter FilterTypeNameIgnoreCase;
    public virtual Assembly Assembly { get; }
    public virtual IEnumerable<CustomAttributeData> CustomAttributes { get; }
    public virtual string FullyQualifiedName { get; }
+   public virtual int MDStreamVersion { get; }
+   public virtual int MetadataToken { get; }
+   public virtual Guid ModuleVersionId { get; }
    public virtual string Name { get; }
+   public virtual string ScopeName { get; }
    public override bool Equals(object o);
+   public virtual Type[] FindTypes(TypeFilter filter, object filterCriteria);
+   public FieldInfo GetField(string name);
+   public virtual FieldInfo GetField(string name, BindingFlags bindingAttr);
+   public FieldInfo[] GetFields();
+   public virtual FieldInfo[] GetFields(BindingFlags bindingFlags);
    public override int GetHashCode();
+   public MethodInfo GetMethod(string name);
+   public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
+   public MethodInfo GetMethod(string name, Type[] types);
+   public MethodInfo[] GetMethods();
+   public virtual MethodInfo[] GetMethods(BindingFlags bindingFlags);
+   public virtual Type GetType(string className);
+   public virtual Type GetType(string className, bool ignoreCase);
    public virtual Type GetType(string className, bool throwOnError, bool ignoreCase);
+   public virtual Type[] GetTypes();
+   public FieldInfo ResolveField(int metadataToken);
+   public virtual FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
+   public MemberInfo ResolveMember(int metadataToken);
+   public virtual MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
+   public MethodBase ResolveMethod(int metadataToken);
+   public virtual MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
+   public virtual byte[] ResolveSignature(int metadataToken);
+   public virtual string ResolveString(int metadataToken);
+   public Type ResolveType(int metadataToken);
+   public virtual Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
    public override string ToString();
  }
  public class ParameterInfo {
    public virtual ParameterAttributes Attributes { get; }
    public virtual IEnumerable<CustomAttributeData> CustomAttributes { get; }
    public virtual object DefaultValue { get; }
    public virtual bool HasDefaultValue { get; }
    public bool IsIn { get; }
    public bool IsOptional { get; }
    public bool IsOut { get; }
    public bool IsRetval { get; }
    public virtual MemberInfo Member { get; }
+   public virtual int MetadataToken { get; }
    public virtual string Name { get; }
    public virtual Type ParameterType { get; }
    public virtual int Position { get; }
+   public virtual object RawDefaultValue { get; }
  }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
  public struct ParameterModifier {
+   public ParameterModifier(int parameterCount);
+   public bool this[int index] { get; set; }
  }
  public abstract class PropertyInfo : MemberInfo {
    public abstract PropertyAttributes Attributes { get; }
    public abstract bool CanRead { get; }
    public abstract bool CanWrite { get; }
    public virtual MethodInfo GetMethod { get; }
    public bool IsSpecialName { get; }
+   public override MemberTypes MemberType { get; }
    public abstract Type PropertyType { get; }
    public virtual MethodInfo SetMethod { get; }
    public override bool Equals(object obj);
+   public MethodInfo[] GetAccessors();
+   public virtual MethodInfo[] GetAccessors(bool nonPublic);
    public virtual object GetConstantValue();
+   public MethodInfo GetGetMethod();
+   public virtual MethodInfo GetGetMethod(bool nonPublic);
    public override int GetHashCode();
    public abstract ParameterInfo[] GetIndexParameters();
+   public MethodInfo GetSetMethod();
+   public virtual MethodInfo GetSetMethod(bool nonPublic);
    public object GetValue(object obj);
    public virtual object GetValue(object obj, object[] index);
    public void SetValue(object obj, object value);
    public virtual void SetValue(object obj, object value, object[] index);
  }
  public abstract class ReflectionContext {
    protected ReflectionContext();
    public virtual TypeInfo GetTypeForObject(object value);
    public abstract Assembly MapAssembly(Assembly assembly);
    public abstract TypeInfo MapType(TypeInfo type);
  }
  public sealed class ReflectionTypeLoadException : Exception {
    public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions);
    public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, string message);
    public Exception[] LoaderExceptions { get; }
    public Type[] Types { get; }
  }
  public enum ResourceLocation {
    ContainedInAnotherAssembly = 2,
    ContainedInManifestFile = 4,
    Embedded = 1,
  }
+ public class TargetException : Exception {
+   public TargetException();
+   public TargetException(string message);
+   public TargetException(string message, Exception inner);
  }
  public sealed class TargetInvocationException : Exception {
    public TargetInvocationException(Exception inner);
    public TargetInvocationException(string message, Exception inner);
  }
  public sealed class TargetParameterCountException : Exception {
    public TargetParameterCountException();
    public TargetParameterCountException(string message);
    public TargetParameterCountException(string message, Exception inner);
  }
+ public delegate bool TypeFilter(Type m, object filterCriteria);
  public abstract class TypeInfo : MemberInfo, IReflectableType {
    public abstract Assembly Assembly { get; }
    public abstract string AssemblyQualifiedName { get; }
    public abstract TypeAttributes Attributes { get; }
    public abstract Type BaseType { get; }
    public abstract bool ContainsGenericParameters { get; }
    public virtual IEnumerable<ConstructorInfo> DeclaredConstructors { get; }
    public virtual IEnumerable<EventInfo> DeclaredEvents { get; }
    public virtual IEnumerable<FieldInfo> DeclaredFields { get; }
    public virtual IEnumerable<MemberInfo> DeclaredMembers { get; }
    public virtual IEnumerable<MethodInfo> DeclaredMethods { get; }
    public virtual IEnumerable<TypeInfo> DeclaredNestedTypes { get; }
    public virtual IEnumerable<PropertyInfo> DeclaredProperties { get; }
    public abstract MethodBase DeclaringMethod { get; }
    public abstract string FullName { get; }
    public abstract GenericParameterAttributes GenericParameterAttributes { get; }
    public abstract int GenericParameterPosition { get; }
    public abstract Type[] GenericTypeArguments { get; }
    public virtual Type[] GenericTypeParameters { get; }
    public abstract Guid GUID { get; }
    public bool HasElementType { get; }
    public virtual IEnumerable<Type> ImplementedInterfaces { get; }
    public bool IsAbstract { get; }
    public bool IsAnsiClass { get; }
    public bool IsArray { get; }
    public bool IsAutoClass { get; }
    public bool IsAutoLayout { get; }
    public bool IsByRef { get; }
    public bool IsClass { get; }
    public virtual bool IsCOMObject { get; }
    public abstract bool IsEnum { get; }
    public bool IsExplicitLayout { get; }
    public abstract bool IsGenericParameter { get; }
    public abstract bool IsGenericType { get; }
    public abstract bool IsGenericTypeDefinition { get; }
    public bool IsImport { get; }
    public bool IsInterface { get; }
    public bool IsLayoutSequential { get; }
    public bool IsMarshalByRef { get; }
    public bool IsNested { get; }
    public bool IsNestedAssembly { get; }
    public bool IsNestedFamANDAssem { get; }
    public bool IsNestedFamily { get; }
    public bool IsNestedFamORAssem { get; }
    public bool IsNestedPrivate { get; }
    public bool IsNestedPublic { get; }
    public bool IsNotPublic { get; }
    public bool IsPointer { get; }
    public virtual bool IsPrimitive { get; }
    public bool IsPublic { get; }
    public bool IsSealed { get; }
    public abstract bool IsSerializable { get; }
    public bool IsSpecialName { get; }
    public bool IsUnicodeClass { get; }
    public virtual bool IsValueType { get; }
    public bool IsVisible { get; }
    public abstract string Namespace { get; }
+   public virtual StructLayoutAttribute StructLayoutAttribute { get; }
+   public ConstructorInfo TypeInitializer { get; }
+   public abstract Type UnderlyingSystemType { get; }
    public virtual Type AsType();
+   public virtual Type[] FindInterfaces(TypeFilter filter, object filterCriteria);
+   public virtual MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria);
    public abstract int GetArrayRank();
+   public ConstructorInfo GetConstructor(Type[] types);
+   public ConstructorInfo[] GetConstructors();
+   public abstract ConstructorInfo[] GetConstructors(BindingFlags bindingAttr);
    public virtual EventInfo GetDeclaredEvent(string name);
    public virtual FieldInfo GetDeclaredField(string name);
    public virtual MethodInfo GetDeclaredMethod(string name);
    public virtual IEnumerable<MethodInfo> GetDeclaredMethods(string name);
    public virtual TypeInfo GetDeclaredNestedType(string name);
    public virtual PropertyInfo GetDeclaredProperty(string name);
+   public virtual MemberInfo[] GetDefaultMembers();
    public abstract Type GetElementType();
+   public virtual string GetEnumName(object value);
+   public virtual string[] GetEnumNames();
+   public virtual Type GetEnumUnderlyingType();
+   public virtual Array GetEnumValues();
+   public EventInfo GetEvent(string name);
+   public abstract EventInfo GetEvent(string name, BindingFlags bindingAttr);
+   public virtual EventInfo[] GetEvents();
+   public abstract EventInfo[] GetEvents(BindingFlags bindingAttr);
+   public FieldInfo GetField(string name);
+   public abstract FieldInfo GetField(string name, BindingFlags bindingAttr);
+   public FieldInfo[] GetFields();
+   public abstract FieldInfo[] GetFields(BindingFlags bindingAttr);
+   public virtual Type[] GetGenericArguments();
    public abstract Type[] GetGenericParameterConstraints();
    public abstract Type GetGenericTypeDefinition();
+   public Type GetInterface(string name);
+   public abstract Type GetInterface(string name, bool ignoreCase);
+   public virtual InterfaceMapping GetInterfaceMap(Type interfaceType);
+   public abstract Type[] GetInterfaces();
+   public MemberInfo[] GetMember(string name);
+   public virtual MemberInfo[] GetMember(string name, BindingFlags bindingAttr);
+   public virtual MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr);
+   public MemberInfo[] GetMembers();
+   public abstract MemberInfo[] GetMembers(BindingFlags bindingAttr);
+   public MethodInfo GetMethod(string name);
+   public MethodInfo GetMethod(string name, BindingFlags bindingAttr);
+   public MethodInfo GetMethod(string name, Type[] types);
+   public MethodInfo GetMethod(string name, Type[] types, ParameterModifier[] modifiers);
+   public MethodInfo[] GetMethods();
+   public abstract MethodInfo[] GetMethods(BindingFlags bindingAttr);
+   public Type GetNestedType(string name);
+   public abstract Type GetNestedType(string name, BindingFlags bindingAttr);
+   public Type[] GetNestedTypes();
+   public abstract Type[] GetNestedTypes(BindingFlags bindingAttr);
+   public PropertyInfo[] GetProperties();
+   public abstract PropertyInfo[] GetProperties(BindingFlags bindingAttr);
+   public PropertyInfo GetProperty(string name);
+   public PropertyInfo GetProperty(string name, BindingFlags bindingAttr);
+   public PropertyInfo GetProperty(string name, Type returnType);
+   public PropertyInfo GetProperty(string name, Type returnType, Type[] types);
+   public PropertyInfo GetProperty(string name, Type returnType, Type[] types, ParameterModifier[] modifiers);
+   public PropertyInfo GetProperty(string name, Type[] types);
    public virtual bool IsAssignableFrom(TypeInfo typeInfo);
+   public virtual bool IsAssignableFrom(Type c);
+   public abstract bool IsDefined(Type attributeType, bool inherit);
+   public virtual bool IsEnumDefined(object value);
    public virtual bool IsEquivalentTo(Type other);
+   public virtual bool IsInstanceOfType(object o);
    public virtual bool IsSubclassOf(Type c);
    public abstract Type MakeArrayType();
    public abstract Type MakeArrayType(int rank);
    public abstract Type MakeByRefType();
    public abstract Type MakeGenericType(params Type[] typeArguments);
    public abstract Type MakePointerType();
    TypeInfo System.Reflection.IReflectableType.GetTypeInfo();
  }
 }

Notes

---.NET Framework
+++.NET Core
 namespace System {
  public abstract class Type : MemberInfo, _Type, IReflect {
    public static readonly char Delimiter;
    ^ Pallavi Taneja: Added on the Type.
    public static readonly object Missing;
    ^ Pallavi Taneja: Already present.
-   public static readonly MemberFilter FilterAttribute;
    ^ Pallavi Taneja: Filter* can't be added to TypeInfo in this contract revision.
-   public static readonly MemberFilter FilterName;
-   public static readonly MemberFilter FilterNameIgnoreCase;
    public static readonly Type[] EmptyTypes;
    ^ Pallavi Taneja: Already present.
-   protected Type();
-   public abstract Assembly Assembly { get; }
    public abstract string AssemblyQualifiedName { get; }
-   public TypeAttributes Attributes { get; }
-   public abstract Type BaseType { get; }
-   public virtual bool ContainsGenericParameters { get; }
-   public virtual MethodBase DeclaringMethod { get; }
    public overrideabstract Type DeclaringType { get; }
-   public static Binder DefaultBinder { get; }
    ^ Pallavi Taneja: [Pending discussion] Whether Binder should be empty or exposed via a separate contract.
    public abstract string FullName { get; }
-   public virtual GenericParameterAttributes GenericParameterAttributes { get; }
    public virtualabstract int GenericParameterPosition { get; }
    public virtualabstract Type[] GenericTypeArguments { get; }
-   public abstract Guid GUID { get; }
    public bool HasElementType { get; }
-   public bool IsAbstract { get; }
-   public bool IsAnsiClass { get; }
    public virtual bool IsArray { get; }
-   public bool IsAutoClass { get; }
-   public bool IsAutoLayout { get; }
    public virtual bool IsByRef { get; }
-   public bool IsClass { get; }
-   public bool IsCOMObject { get; }
    public virtualabstract bool IsConstructedGenericType { get; }
    ^ Pallavi Taneja: Already exposed in Type.
-   public bool IsContextful { get; }
    ^ Pallavi Taneja: Used only in remoting.
-   public virtual bool IsEnum { get; }
-   public bool IsExplicitLayout { get; }
    public virtualabstract bool IsGenericParameter { get; }
-   public virtual bool IsGenericType { get; }
-   public virtual bool IsGenericTypeDefinition { get; }
-   public bool IsImport { get; }
-   public bool IsInterface { get; }
-   public bool IsLayoutSequential { get; }
-   public bool IsMarshalByRef { get; }
    public bool IsNested { get; }
-   public bool IsNestedAssembly { get; }
-   public bool IsNestedFamANDAssem { get; }
-   public bool IsNestedFamily { get; }
-   public bool IsNestedFamORAssem { get; }
-   public bool IsNestedPrivate { get; }
-   public bool IsNestedPublic { get; }
-   public bool IsNotPublic { get; }
    public virtual bool IsPointer { get; }
-   public bool IsPrimitive { get; }
-   public bool IsPublic { get; }
-   public bool IsSealed { get; }
-   public virtual bool IsSecurityCritical { get; }
    ^ Pallavi Taneja: Obsolete concept.
-   public virtual bool IsSecuritySafeCritical { get; }
-   public virtual bool IsSecurityTransparent { get; }
-   public virtual bool IsSerializable { get; }
-   public bool IsSpecialName { get; }
-   public bool IsUnicodeClass { get; }
-   public bool IsValueType { get; }
-   public bool IsVisible { get; }
-   public override MemberTypes MemberType { get; }
-   public abstract new Module Module { get; }
+   public abstract string Name { get; }
    public abstract string Namespace { get; }
-   public override Type ReflectedType { get; }
-   public virtual StructLayoutAttribute StructLayoutAttribute { get; }
    public virtual RuntimeTypeHandle TypeHandle { get; }
    ^ Pallavi Taneja: Already exposed in Type
-   public ConstructorInfo TypeInitializer { get; }
-   public abstract Type UnderlyingSystemType { get; }
    public override bool Equals(object o);
    public virtual bool Equals(Type o);
-   public virtual Type[] FindInterfaces(TypeFilter filter, object filterCriteria);
-   public virtual MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria);
    public virtualabstract int GetArrayRank();
-   protected abstract TypeAttributes GetAttributeFlagsImpl();
-   public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
    ^ Pallavi Taneja: Binder decision pending.
-   public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers);
-   public ConstructorInfo GetConstructor(Type[] types);
-   protected abstract ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
-   public ConstructorInfo[] GetConstructors();
-   public abstract ConstructorInfo[] GetConstructors(BindingFlags bindingAttr);
-   public virtual MemberInfo[] GetDefaultMembers();
    public abstract Type GetElementType();
-   public virtual string GetEnumName(object value);
-   public virtual string[] GetEnumNames();
-   public virtual Type GetEnumUnderlyingType();
-   public virtual Array GetEnumValues();
-   public EventInfo GetEvent(string name);
-   public abstract EventInfo GetEvent(string name, BindingFlags bindingAttr);
-   public virtual EventInfo[] GetEvents();
-   public abstract EventInfo[] GetEvents(BindingFlags bindingAttr);
-   public FieldInfo GetField(string name);
-   public abstract FieldInfo GetField(string name, BindingFlags bindingAttr);
-   public FieldInfo[] GetFields();
-   public abstract FieldInfo[] GetFields(BindingFlags bindingAttr);
-   public virtual Type[] GetGenericArguments();
-   public virtual Type[] GetGenericParameterConstraints();
    public virtualabstract Type GetGenericTypeDefinition();
    public override int GetHashCode();
-   public Type GetInterface(string name);
-   public abstract Type GetInterface(string name, bool ignoreCase);
-   public virtual InterfaceMapping GetInterfaceMap(Type interfaceType);
-   public abstract Type[] GetInterfaces();
-   public MemberInfo[] GetMember(string name);
-   public virtual MemberInfo[] GetMember(string name, BindingFlags bindingAttr);
-   public virtual MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr);
-   public MemberInfo[] GetMembers();
-   public abstract MemberInfo[] GetMembers(BindingFlags bindingAttr);
-   public MethodInfo GetMethod(string name);
-   public MethodInfo GetMethod(string name, BindingFlags bindingAttr);
-   public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
    ^ Pallavi Taneja: Binder decision pending.
-   public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers);
-   public MethodInfo GetMethod(string name, Type[] types);
-   public MethodInfo GetMethod(string name, Type[] types, ParameterModifier[] modifiers);
-   protected abstract MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
-   public MethodInfo[] GetMethods();
-   public abstract MethodInfo[] GetMethods(BindingFlags bindingAttr);
-   public Type GetNestedType(string name);
-   public abstract Type GetNestedType(string name, BindingFlags bindingAttr);
-   public Type[] GetNestedTypes();
-   public abstract Type[] GetNestedTypes(BindingFlags bindingAttr);
-   public PropertyInfo[] GetProperties();
-   public abstract PropertyInfo[] GetProperties(BindingFlags bindingAttr);
-   public PropertyInfo GetProperty(string name);
-   public PropertyInfo GetProperty(string name, BindingFlags bindingAttr);
-   public PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
    ^ Pallavi Taneja: Binder decision pending.
-   public PropertyInfo GetProperty(string name, Type returnType);
-   public PropertyInfo GetProperty(string name, Type returnType, Type[] types);
-   public PropertyInfo GetProperty(string name, Type returnType, Type[] types, ParameterModifier[] modifiers);
-   public PropertyInfo GetProperty(string name, Type[] types);
-   protected abstract PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
-   public new Type GetType();
-   [MethodImpl(NoInlining)]public static Type GetType(string typeName);
    ^ Pallavi Taneja: GetType* can't be added to TypeInfo in the current contract version.
-   [MethodImpl(NoInlining)]public static Type GetType(string typeName, bool throwOnError);
-   [MethodImpl(NoInlining)]public static Type GetType(string typeName, bool throwOnError, bool ignoreCase);
-   [MethodImpl(NoInlining)]public static Type GetType(string typeName, Func<AssemblyName, Assembly> assemblyResolver, Func<Assembly, string, bool, Type> typeResolver);
-   [MethodImpl(NoInlining)]public static Type GetType(string typeName, Func<AssemblyName, Assembly> assemblyResolver, Func<Assembly, string, bool, Type> typeResolver, bool throwOnError);
-   [MethodImpl(NoInlining)]public static Type GetType(string typeName, Func<AssemblyName, Assembly> assemblyResolver, Func<Assembly, string, bool, Type> typeResolver, bool throwOnError, bool ignoreCase);
-   public static Type[] GetTypeArray(object[] args);
    ^ Pallavi Taneja: Can't be added to TypeInfo in the current contract version.
    public static TypeCode GetTypeCode(Type type);
-   protected virtual TypeCode GetTypeCodeImpl();
-   public static Type GetTypeFromCLSID(Guid clsid);
    ^ Pallavi Taneja: Interop concept
-   public static Type GetTypeFromCLSID(Guid clsid, bool throwOnError);
-   public static Type GetTypeFromCLSID(Guid clsid, string server);
-   public static Type GetTypeFromCLSID(Guid clsid, string server, bool throwOnError);
-   [MethodImpl(InternalCall)]public static Type GetTypeFromHandle(RuntimeTypeHandle handle);
    ^ Pallavi Taneja: Already implemented.
-   public static Type GetTypeFromProgID(string progID);
    ^ Pallavi Taneja: Interop concept
-   public static Type GetTypeFromProgID(string progID, bool throwOnError);
-   public static Type GetTypeFromProgID(string progID, string server);
-   public static Type GetTypeFromProgID(string progID, string server, bool throwOnError);
-   public static RuntimeTypeHandle GetTypeHandle(object o);
    ^ Pallavi Taneja: Decision pending.
-   protected abstract bool HasElementTypeImpl();
-   public object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args);
    ^ Pallavi Taneja: Binder decision pending.
-   public object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, CultureInfo culture);
-   public abstract object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
-   protected abstract bool IsArrayImpl();
-   public virtual bool IsAssignableFrom(Type c);
-   protected abstract bool IsByRefImpl();
-   protected abstract bool IsCOMObjectImpl();
-   protected virtual bool IsContextfulImpl();
-   public virtual bool IsEnumDefined(object value);
-   public virtual bool IsEquivalentTo(Type other);
-   public virtual bool IsInstanceOfType(object o);
-   protected virtual bool IsMarshalByRefImpl();
-   protected abstract bool IsPointerImpl();
-   protected abstract bool IsPrimitiveImpl();
-   public virtual bool IsSubclassOf(Type c);
-   protected virtual bool IsValueTypeImpl();
    public virtualabstract Type MakeArrayType();
    public virtualabstract Type MakeArrayType(int rank);
    public virtualabstract Type MakeByRefType();
    public virtualabstract Type MakeGenericType(params Type[] typeArguments);
    public virtualabstract Type MakePointerType();
-   [MethodImpl(InternalCall)]public static bool operator ==(Type left, Type right);
-   [MethodImpl(InternalCall)]public static bool operator !=(Type left, Type right);
-   [MethodImpl(NoInlining)]public static Type ReflectionOnlyGetType(string typeName, bool throwIfNotFound, bool ignoreCase);
-   void System.Runtime.InteropServices._Type.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   void System.Runtime.InteropServices._Type.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._Type.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._Type.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
    public override string ToString();
  }
 namespace System.Reflection {
  public abstract class Binder {
    ^ Pallavi Taneja: Expose as Empty in System.Reflection. Options added separately.
    protected Binder();
-   public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture);
-   public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state);
-   public abstract object ChangeType(object value, Type type, CultureInfo culture);
-   public abstract void ReorderArgumentArray(ref object[] args, object state);
-   public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers);
-   public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers);
  }
  public enum BindingFlags {
    CreateInstance = 512,
    DeclaredOnly = 2,
    Default = 0,
-   ExactBinding = 65536,
    ^ Pallavi Taneja: Used only in case Binder is extensible.
    FlattenHierarchy = 64,
    GetField = 1024,
    GetProperty = 4096,
    IgnoreCase = 1,
-   IgnoreReturn = 16777216,
    ^ Pallavi Taneja: Only used in Interop.
    Instance = 4,
    InvokeMethod = 256,
    NonPublic = 32,
-   OptionalParamBinding = 262144,
    ^ Pallavi Taneja: [Unsure] used most only in varArgs scenario.
    Public = 16,
-   PutDispProperty = 16384,
    ^ Pallavi Taneja: Interop scenario.
-   PutRefDispProperty = 32768,
    SetField = 2048,
    SetProperty = 8192,
    Static = 8,
-   SuppressChangeType = 131072,
  }
  public abstract class ConstructorInfo : MethodBase, _ConstructorInfo {
    public static readonly string ConstructorName;
    public static readonly string TypeConstructorName;
-   protected ConstructorInfo();
    public override MemberTypes MemberType { get; }
    public override bool Equals(object obj);
    public override int GetHashCode();
    public virtual object Invoke(object[] parameters);
-   public abstract object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture);
    ^ Pallavi Taneja: System.Globalization dependency. Usage < 2%. No reflection contract currently take glob dep not just S.R.dll
-   public static bool operator ==(ConstructorInfo left, ConstructorInfo right);
-   public static bool operator !=(ConstructorInfo left, ConstructorInfo right);
-   void System.Runtime.InteropServices._ConstructorInfo.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   Type System.Runtime.InteropServices._ConstructorInfo.GetType();
-   void System.Runtime.InteropServices._ConstructorInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._ConstructorInfo.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._ConstructorInfo.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-   object System.Runtime.InteropServices._ConstructorInfo.Invoke_2(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture);
-   object System.Runtime.InteropServices._ConstructorInfo.Invoke_3(object obj, object[] parameters);
-   object System.Runtime.InteropServices._ConstructorInfo.Invoke_4(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture);
-   object System.Runtime.InteropServices._ConstructorInfo.Invoke_5(object[] parameters);
  }
- public class CustomAttributeFormatException : FormatException {
    ^ Pallavi Taneja: [Not sure] Used mainly in case a tool formatted a custom attribute incorrectly.
-   public CustomAttributeFormatException();
-   protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context);
-   public CustomAttributeFormatException(string message);
-   public CustomAttributeFormatException(string message, Exception inner);
  }
  [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
  public struct CustomAttributeNamedArgument {
-   public CustomAttributeNamedArgument(MemberInfo memberInfo, object value);
-   public CustomAttributeNamedArgument(MemberInfo memberInfo, CustomAttributeTypedArgument typedArgument);
    public bool IsField { get; }
    public MemberInfo MemberInfo { get; }
    public string MemberName { get; }
    public CustomAttributeTypedArgument TypedValue { get; }
-   public override bool Equals(object obj);
-   public override int GetHashCode();
-   public static bool operator ==(CustomAttributeNamedArgument left, CustomAttributeNamedArgument right);
    ^ Pallavi Taneja: I have left out equality operators across reflection since, there were concerns earlier that its behavior might not be consistent with .Equals
-   public static bool operator !=(CustomAttributeNamedArgument left, CustomAttributeNamedArgument right);
-   public override string ToString();
  }
  public abstract class EventInfo : MemberInfo, _EventInfo {
-   protected EventInfo();
    public virtual MethodInfo AddMethod { get; }
    public abstract EventAttributes Attributes { get; }
    public virtual Type EventHandlerType { get; }
    public virtual bool IsMulticast { get; }
    public bool IsSpecialName { get; }
    public override MemberTypes MemberType { get; }
    public virtual MethodInfo RaiseMethod { get; }
    public virtual MethodInfo RemoveMethod { get; }
    public virtual void AddEventHandler(object target, Delegate handler);
    public override bool Equals(object obj);
    public MethodInfo GetAddMethod();
    ^ Pallavi Taneja: Get*Method are exposed via S.R.TE. Consider removing from there.
    public abstractvirtual MethodInfo GetAddMethod(bool nonPublic);
    public override int GetHashCode();
-   public MethodInfo[] GetOtherMethods();
    ^ Pallavi Taneja: .other directive in events is not exposed in any language semantics we care about AFAIK and currently can be leveraged using ilasm only.
-   public virtual MethodInfo[] GetOtherMethods(bool nonPublic);
    public MethodInfo GetRaiseMethod();
    public abstractvirtual MethodInfo GetRaiseMethod(bool nonPublic);
    public MethodInfo GetRemoveMethod();
    public abstractvirtual MethodInfo GetRemoveMethod(bool nonPublic);
-   public static bool operator ==(EventInfo left, EventInfo right);
-   public static bool operator !=(EventInfo left, EventInfo right);
    public virtual void RemoveEventHandler(object target, Delegate handler);
-   void System.Runtime.InteropServices._EventInfo.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   Type System.Runtime.InteropServices._EventInfo.GetType();
-   void System.Runtime.InteropServices._EventInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._EventInfo.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._EventInfo.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
  }
- public class ExceptionHandlingClause {
    ^ Pallavi Taneja: Not sure if we would want to expose SEH inspection or IL inspection in general.
-   protected ExceptionHandlingClause();
-   public virtual Type CatchType { get; }
-   public virtual int FilterOffset { get; }
-   public virtual ExceptionHandlingClauseOptions Flags { get; }
-   public virtual int HandlerLength { get; }
-   public virtual int HandlerOffset { get; }
-   public virtual int TryLength { get; }
-   public virtual int TryOffset { get; }
-   public override string ToString();
  }
- public enum ExceptionHandlingClauseOptions {
    ^ Pallavi Taneja: Same as above.
-   Clause = 0,
-   Fault = 4,
-   Filter = 1,
-   Finally = 2,
  }
  public abstract class FieldInfo : MemberInfo, _FieldInfo {
-   protected FieldInfo();
    public abstract FieldAttributes Attributes { get; }
    public abstractvirtual RuntimeFieldHandle FieldHandle { get; }
    public abstract Type FieldType { get; }
    public bool IsAssembly { get; }
    public bool IsFamily { get; }
    public bool IsFamilyAndAssembly { get; }
    public bool IsFamilyOrAssembly { get; }
    public bool IsInitOnly { get; }
    public bool IsLiteral { get; }
-   public bool IsNotSerialized { get; }
    ^ Pallavi Taneja: We do not expose NotSerializedAttribute notion.
-   public bool IsPinvokeImpl { get; }
    public bool IsPrivate { get; }
    public bool IsPublic { get; }
-   public virtual bool IsSecurityCritical { get; }
-   public virtual bool IsSecuritySafeCritical { get; }
-   public virtual bool IsSecurityTransparent { get; }
    public bool IsSpecialName { get; }
    public bool IsStatic { get; }
    public override MemberTypes MemberType { get; }
    public override bool Equals(object obj);
    public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle);
    public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType);
    public override int GetHashCode();
-   public virtual Type[] GetOptionalCustomModifiers();
    ^ Pallavi Taneja: [Not sure] Used in Compiler only context. Usage < 1% except xamarin using GetRawConstantValue 10%. Should there not be an alternative in metadata instead?
-   public virtual object GetRawConstantValue();
-   public virtual Type[] GetRequiredCustomModifiers();
    public abstract object GetValue(object obj);
-   public virtual object GetValueDirect(TypedReference obj);
    ^ Pallavi Taneja: TypedReference is not exposed.
-   public static bool operator ==(FieldInfo left, FieldInfo right);
-   public static bool operator !=(FieldInfo left, FieldInfo right);
    public virtual void SetValue(object obj, object value);
-   public abstract void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture);
-   public virtual void SetValueDirect(TypedReference obj, object value);
-   void System.Runtime.InteropServices._FieldInfo.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   Type System.Runtime.InteropServices._FieldInfo.GetType();
-   void System.Runtime.InteropServices._FieldInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._FieldInfo.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._FieldInfo.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
  }
- public interface ICustomAttributeProvider {
    ^ Pallavi Taneja: We do not expose ICustomAttributeProvider, however we expose the members via extension methods via S.R.E. Hence, exposing this correctly will be difficult.
-   object[] GetCustomAttributes(bool inherit);
-   object[] GetCustomAttributes(Type attributeType, bool inherit);
-   bool IsDefined(Type attributeType, bool inherit);
  }
- public enum ImageFileMachine {
    ^ Pallavi Taneja: Use S.R.I.RuntimeInformation instead
-   AMD64 = 34404,
-   ARM = 452,
-   I386 = 332,
-   IA64 = 512,
  }
  public class InvalidFilterCriteriaException : ApplicationExceptionException {
    ^ Pallavi Taneja: Used my Module and TYpe. Although Type.Filter* can't be exposed yet, we can expose Module.Filter* members.
    public InvalidFilterCriteriaException();
-   protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context);
    public InvalidFilterCriteriaException(string message);
    public InvalidFilterCriteriaException(string message, Exception inner);
  }
- public interface IReflect {
    ^ Pallavi Taneja: Exposed in S.R.IS as used with IDispatch.
-   Type UnderlyingSystemType { get; }
-   FieldInfo GetField(string name, BindingFlags bindingAttr);
-   FieldInfo[] GetFields(BindingFlags bindingAttr);
-   MemberInfo[] GetMember(string name, BindingFlags bindingAttr);
-   MemberInfo[] GetMembers(BindingFlags bindingAttr);
-   MethodInfo GetMethod(string name, BindingFlags bindingAttr);
-   MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers);
-   MethodInfo[] GetMethods(BindingFlags bindingAttr);
-   PropertyInfo[] GetProperties(BindingFlags bindingAttr);
-   PropertyInfo GetProperty(string name, BindingFlags bindingAttr);
-   PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
-   object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
  }
  public abstract class MemberInfo : _MemberInfo, ICustomAttributeProvider {
-   protected MemberInfo();
    public virtual IEnumerable<CustomAttributeData> CustomAttributes { get; }
    public abstract Type DeclaringType { get; }
    public abstractvirtual MemberTypes MemberType { get; }
    public virtual int MetadataToken { get; }
    public virtual Module Module { get; }
    public abstract string Name { get; }
    public abstractvirtual Type ReflectedType { get; }
    ^ Pallavi Taneja: Some concerns around PN implementation.
    public override bool Equals(object obj);
-   public abstract object[] GetCustomAttributes(bool inherit);
    ^ Pallavi Taneja: Already exposed via extensions.
-   public abstract object[] GetCustomAttributes(Type attributeType, bool inherit);
-   public virtual IList<CustomAttributeData> GetCustomAttributesData();
    public override int GetHashCode();
-   public abstract bool IsDefined(Type attributeType, bool inherit);
-   public static bool operator ==(MemberInfo left, MemberInfo right);
    ^ Pallavi Taneja: Operator overloads behave different than .Equals().
-   public static bool operator !=(MemberInfo left, MemberInfo right);
-   void System.Runtime.InteropServices._MemberInfo.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   Type System.Runtime.InteropServices._MemberInfo.GetType();
-   void System.Runtime.InteropServices._MemberInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._MemberInfo.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._MemberInfo.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
  }
  public abstract class MethodBase : MemberInfo, _MethodBase {
-   protected MethodBase();
    public abstract MethodAttributes Attributes { get; }
    public virtual CallingConventions CallingConvention { get; }
    public virtual bool ContainsGenericParameters { get; }
    public bool IsAbstract { get; }
    public bool IsAssembly { get; }
    public bool IsConstructor { get; }
    public bool IsFamily { get; }
    public bool IsFamilyAndAssembly { get; }
    public bool IsFamilyOrAssembly { get; }
    public bool IsFinal { get; }
    public virtual bool IsGenericMethod { get; }
    public virtual bool IsGenericMethodDefinition { get; }
    public bool IsHideBySig { get; }
    public bool IsPrivate { get; }
    public bool IsPublic { get; }
-   public virtual bool IsSecurityCritical { get; }
-   public virtual bool IsSecuritySafeCritical { get; }
-   public virtual bool IsSecurityTransparent { get; }
    public bool IsSpecialName { get; }
    public bool IsStatic { get; }
    public bool IsVirtual { get; }
    public abstractvirtual RuntimeMethodHandle MethodHandle { get; }
    public virtualabstract MethodImplAttributes MethodImplementationFlags { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsAbstract { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsAssembly { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsConstructor { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsFamily { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsFamilyAndAssembly { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsFamilyOrAssembly { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsFinal { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsHideBySig { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsPrivate { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsPublic { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsSpecialName { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsStatic { get; }
-   bool System.Runtime.InteropServices._MethodBase.IsVirtual { get; }
    public override bool Equals(object obj);
-   [MethodImpl(NoInlining)]public static MethodBase GetCurrentMethod();
    public virtual Type[] GetGenericArguments();
    public override int GetHashCode();
-   public virtual MethodBody GetMethodBody();
    ^ Pallavi Taneja: [Not sure] Used for IL inspection. Usage ~ 1%
    public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle);
    public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);
    public abstractvirtual MethodImplAttributes GetMethodImplementationFlags();
    public abstract ParameterInfo[] GetParameters();
    public virtual object Invoke(object obj, object[] parameters);
-   public abstract object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture);
    ^ Pallavi Taneja: Dependency on System.Glob
-   public static bool operator ==(MethodBase left, MethodBase right);
-   public static bool operator !=(MethodBase left, MethodBase right);
-   void System.Runtime.InteropServices._MethodBase.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   Type System.Runtime.InteropServices._MethodBase.GetType();
-   void System.Runtime.InteropServices._MethodBase.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._MethodBase.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._MethodBase.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
  }
- public class MethodBody {
    ^ Pallavi Taneja: [Not sure] IL inspection
-   protected MethodBody();
-   public virtual IList<ExceptionHandlingClause> ExceptionHandlingClauses { get; }
-   public virtual bool InitLocals { get; }
-   public virtual int LocalSignatureMetadataToken { get; }
-   public virtual IList<LocalVariableInfo> LocalVariables { get; }
-   public virtual int MaxStackSize { get; }
-   public virtual byte[] GetILAsByteArray();
  }
  public abstract class MethodInfo : MethodBase, _MethodInfo {
-   protected MethodInfo();
    public override MemberTypes MemberType { get; }
    public virtual ParameterInfo ReturnParameter { get; }
    public virtual Type ReturnType { get; }
-   public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
    ^ Pallavi Taneja: Issues with exposing ICustomAttributeProvider
    public virtual Delegate CreateDelegate(Type delegateType);
    public virtual Delegate CreateDelegate(Type delegateType, object target);
    public override bool Equals(object obj);
    public abstractvirtual MethodInfo GetBaseDefinition();
    public override Type[] GetGenericArguments();
    public virtual MethodInfo GetGenericMethodDefinition();
    public override int GetHashCode();
    public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments);
-   public static bool operator ==(MethodInfo left, MethodInfo right);
-   public static bool operator !=(MethodInfo left, MethodInfo right);
-   void System.Runtime.InteropServices._MethodInfo.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   Type System.Runtime.InteropServices._MethodInfo.GetType();
-   void System.Runtime.InteropServices._MethodInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._MethodInfo.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._MethodInfo.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
  }
- public sealed class Missing : ISerializable {
    ^ Pallavi Taneja: Interop sceanrio, used in IDispatch.
-   public static readonly Missing Value;
-   void System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo info, StreamingContext context);
  }
  public abstract class Module : _Module, ICustomAttributeProvider, ISerializable {
    public static readonly TypeFilter FilterTypeName;
    public static readonly TypeFilter FilterTypeNameIgnoreCase;
-   protected Module();
    public virtual Assembly Assembly { get; }
    public virtual IEnumerable<CustomAttributeData> CustomAttributes { get; }
    public virtual string FullyQualifiedName { get; }
    public virtual int MDStreamVersion { get; }
    public virtual int MetadataToken { get; }
-   public ModuleHandle ModuleHandle { get; }
    ^ Pallavi Taneja: ModuleHandle is not exposed.
    public virtual Guid ModuleVersionId { get; }
    public virtual string Name { get; }
    public virtual string ScopeName { get; }
    public override bool Equals(object o);
    public virtual Type[] FindTypes(TypeFilter filter, object filterCriteria);
-   public virtual object[] GetCustomAttributes(bool inherit);
-   public virtual object[] GetCustomAttributes(Type attributeType, bool inherit);
-   public virtual IList<CustomAttributeData> GetCustomAttributesData();
    public FieldInfo GetField(string name);
    public virtual FieldInfo GetField(string name, BindingFlags bindingAttr);
    public FieldInfo[] GetFields();
    public virtual FieldInfo[] GetFields(BindingFlags bindingFlags);
    public override int GetHashCode();
    public MethodInfo GetMethod(string name);
    public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
    public MethodInfo GetMethod(string name, Type[] types);
-   protected virtual MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
    public MethodInfo[] GetMethods();
    public virtual MethodInfo[] GetMethods(BindingFlags bindingFlags);
-   public virtual void GetObjectData(SerializationInfo info, StreamingContext context);
-   public virtual void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine);
-   public virtual X509Certificate GetSignerCertificate();
    public virtual Type GetType(string className);
    public virtual Type GetType(string className, bool ignoreCase);
    public virtual Type GetType(string className, bool throwOnError, bool ignoreCase);
    public virtual Type[] GetTypes();
-   public virtual bool IsDefined(Type attributeType, bool inherit);
-   public virtual bool IsResource();
-   public static bool operator ==(Module left, Module right);
-   public static bool operator !=(Module left, Module right);
    public FieldInfo ResolveField(int metadataToken);
    public virtual FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
    public MemberInfo ResolveMember(int metadataToken);
    public virtual MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
    public MethodBase ResolveMethod(int metadataToken);
    public virtual MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
    public virtual byte[] ResolveSignature(int metadataToken);
    public virtual string ResolveString(int metadataToken);
    public Type ResolveType(int metadataToken);
    public virtual Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments);
-   void System.Runtime.InteropServices._Module.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   void System.Runtime.InteropServices._Module.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._Module.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._Module.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
    public override string ToString();
  }
- public sealed class ObfuscateAssemblyAttribute : Attribute {
    ^ Pallavi Taneja: Not a reflection concept.
-   public ObfuscateAssemblyAttribute(bool assemblyIsPrivate);
-   public bool AssemblyIsPrivate { get; }
-   public bool StripAfterObfuscation { get; set; }
  }
- public sealed class ObfuscationAttribute : Attribute {
    ^ Pallavi Taneja: Same as above.s
-   public ObfuscationAttribute();
-   public bool ApplyToMembers { get; set; }
-   public bool Exclude { get; set; }
-   public string Feature { get; set; }
-   public bool StripAfterObfuscation { get; set; }
  }
  public class ParameterInfo : _ParameterInfo, ICustomAttributeProvider, IObjectReference {
-   protected int PositionImpl;
-   protected object DefaultValueImpl;
-   protected MemberInfo MemberImpl;
-   protected ParameterAttributes AttrsImpl;
-   protected string NameImpl;
-   protected Type ClassImpl;
-   protected ParameterInfo();
    public virtual ParameterAttributes Attributes { get; }
    public virtual IEnumerable<CustomAttributeData> CustomAttributes { get; }
    public virtual object DefaultValue { get; }
    public virtual bool HasDefaultValue { get; }
    public bool IsIn { get; }
-   public bool IsLcid { get; }
    public bool IsOptional { get; }
    public bool IsOut { get; }
    public bool IsRetval { get; }
    public virtual MemberInfo Member { get; }
    public virtual int MetadataToken { get; }
    public virtual string Name { get; }
    public virtual Type ParameterType { get; }
    public virtual int Position { get; }
    public virtual object RawDefaultValue { get; }
-   public virtual object[] GetCustomAttributes(bool inherit);
-   public virtual object[] GetCustomAttributes(Type attributeType, bool inherit);
-   public virtual IList<CustomAttributeData> GetCustomAttributesData();
-   public virtual Type[] GetOptionalCustomModifiers();
-   public object GetRealObject(StreamingContext context);
-   public virtual Type[] GetRequiredCustomModifiers();
    ^ Pallavi Taneja: [Not sure] Compiler only scenario.
-   public virtual bool IsDefined(Type attributeType, bool inherit);
-   void System.Runtime.InteropServices._ParameterInfo.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   void System.Runtime.InteropServices._ParameterInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._ParameterInfo.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._ParameterInfo.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-   public override string ToString();
  }
- public sealed class Pointer : ISerializable {
    ^ Pallavi Taneja: Interop scenario.
-   public unsafe static object Box(void* ptr, Type type);
-   void System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo info, StreamingContext context);
-   public unsafe static void* Unbox(object ptr);
  }
  public abstract class PropertyInfo : MemberInfo, _PropertyInfo {
-   protected PropertyInfo();
    public abstract PropertyAttributes Attributes { get; }
    public abstract bool CanRead { get; }
    public abstract bool CanWrite { get; }
    public virtual MethodInfo GetMethod { get; }
    public bool IsSpecialName { get; }
    public override MemberTypes MemberType { get; }
    public abstract Type PropertyType { get; }
    public virtual MethodInfo SetMethod { get; }
    public override bool Equals(object obj);
    public MethodInfo[] GetAccessors();
    ^ Pallavi Taneja: Get* APIs exposed via TypeExtensions
    public abstractvirtual MethodInfo[] GetAccessors(bool nonPublic);
    public virtual object GetConstantValue();
    public MethodInfo GetGetMethod();
    public abstractvirtual MethodInfo GetGetMethod(bool nonPublic);
    public override int GetHashCode();
    public abstract ParameterInfo[] GetIndexParameters();
-   public virtual Type[] GetOptionalCustomModifiers();
    ^ Pallavi Taneja: Compiler only scenario.
-   public virtual object GetRawConstantValue();
-   public virtual Type[] GetRequiredCustomModifiers();
    public MethodInfo GetSetMethod();
    public abstractvirtual MethodInfo GetSetMethod(bool nonPublic);
    public object GetValue(object obj);
    public virtual object GetValue(object obj, object[] index);
-   public abstract object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
    ^ Pallavi Taneja: CultureInfo dependency.
-   public static bool operator ==(PropertyInfo left, PropertyInfo right);
-   public static bool operator !=(PropertyInfo left, PropertyInfo right);
    public void SetValue(object obj, object value);
    public virtual void SetValue(object obj, object value, object[] index);
-   public abstract void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
-   void System.Runtime.InteropServices._PropertyInfo.GetIDsOfNames(ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-   Type System.Runtime.InteropServices._PropertyInfo.GetType();
-   void System.Runtime.InteropServices._PropertyInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-   void System.Runtime.InteropServices._PropertyInfo.GetTypeInfoCount(out uint pcTInfo);
-   void System.Runtime.InteropServices._PropertyInfo.Invoke(uint dispIdMember, ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
  }
- public class StrongNameKeyPair : IDeserializationCallback, ISerializable {
    ^ Pallavi Taneja: Is System.Reflection the right place for this?
-   public StrongNameKeyPair(byte[] keyPairArray);
-   public StrongNameKeyPair(FileStream keyPairFile);
-   protected StrongNameKeyPair(SerializationInfo info, StreamingContext context);
-   public StrongNameKeyPair(string keyPairContainer);
-   public byte[] PublicKey { get; }
-   void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender);
-   void System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo info, StreamingContext context);
  }
- public class TypeDelegator : TypeInfo {
    ^ Pallavi Taneja: Used in extension scenarios.
-   protected Type typeImpl;
-   protected TypeDelegator();
-   public TypeDelegator(Type delegatingType);
-   public override Assembly Assembly { get; }
-   public override string AssemblyQualifiedName { get; }
-   public override Type BaseType { get; }
-   public override string FullName { get; }
-   public override Guid GUID { get; }
-   public override bool IsConstructedGenericType { get; }
-   public override int MetadataToken { get; }
-   public override Module Module { get; }
-   public override string Name { get; }
-   public override string Namespace { get; }
-   public override RuntimeTypeHandle TypeHandle { get; }
-   public override Type UnderlyingSystemType { get; }
-   protected override TypeAttributes GetAttributeFlagsImpl();
-   protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
-   public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr);
-   public override object[] GetCustomAttributes(bool inherit);
-   public override object[] GetCustomAttributes(Type attributeType, bool inherit);
-   public override Type GetElementType();
-   public override EventInfo GetEvent(string name, BindingFlags bindingAttr);
-   public override EventInfo[] GetEvents();
-   public override EventInfo[] GetEvents(BindingFlags bindingAttr);
-   public override FieldInfo GetField(string name, BindingFlags bindingAttr);
-   public override FieldInfo[] GetFields(BindingFlags bindingAttr);
-   public override Type GetInterface(string name, bool ignoreCase);
-   public override InterfaceMapping GetInterfaceMap(Type interfaceType);
-   public override Type[] GetInterfaces();
-   public override MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr);
-   public override MemberInfo[] GetMembers(BindingFlags bindingAttr);
-   protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
-   public override MethodInfo[] GetMethods(BindingFlags bindingAttr);
-   public override Type GetNestedType(string name, BindingFlags bindingAttr);
-   public override Type[] GetNestedTypes(BindingFlags bindingAttr);
-   public override PropertyInfo[] GetProperties(BindingFlags bindingAttr);
-   protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
-   protected override bool HasElementTypeImpl();
-   public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
-   protected override bool IsArrayImpl();
-   public override bool IsAssignableFrom(TypeInfo typeInfo);
-   protected override bool IsByRefImpl();
-   protected override bool IsCOMObjectImpl();
-   public override bool IsDefined(Type attributeType, bool inherit);
-   protected override bool IsPointerImpl();
-   protected override bool IsPrimitiveImpl();
-   protected override bool IsValueTypeImpl();
  }
 }
terrajobst commented 8 years ago

We've reviewed this proposal and approved the direction. I've marked it as "in progress", because still want to review the effect surface area being added. Specifically, there are some open issues:

@pallavit, I'll remove the 'api-ready-for-review' label. Once we've a complete diff, please copy & paste the unified diff in your description above and add the 'api-ready-for-review' label. Thanks!

terrajobst commented 8 years ago

@pallavit Does closing dotnet/runtime#15689 mean we'll bring back TargetException?

pallavit commented 8 years ago

@terrajobst In the review, we decided to expose the type. Do you have any concerns with the decision?

terrajobst commented 8 years ago

Nope. Was just asking because I didn't remember talking about this. Will add this to the notes.

terrajobst commented 8 years ago

Notes are now available.

terrajobst commented 8 years ago

Considering we're all on the same page now and the only thing pending is the dev work, I've marked the change as approved.

pallavit commented 8 years ago

The following PRs expose the APIs reviewed for System.Reflection. Please let me know if you see any issue consuming them. (#6557, dotnet/corefx#6754, dotnet/corefx#6808 , dotnet/corefx#6815, dotnet/corefx#6870).

NickCraver commented 8 years ago

Is there a particular reason ExceptionHandlingClause was removed? We consume it in Sigil (one of our IL utility libraries).

jhudsoncedaron commented 8 years ago

Found this by accident.

Assembly.EscapedCodeBase is something we've had to depend on for its ability to locate the real assembly directory when hosted by IIS, while the normal path function returns something stupid (IIS scratch directory).

henkmollema commented 8 years ago

What about MemberInfo.ReflectedType? I'm unable to find it.

OmerRaviv commented 8 years ago

Are DynamicILInfo and MethodBody ever coming back? If not, what alternatives are there for someone trying to port to .NET Core and relying on these types?

bartdesmet commented 8 years ago

Found when writing tests for System.Linq.Expressions to assert generated IL code: the Resolve methods on Module are missing.

hughbe commented 8 years ago

+1 for the Resolve members: I was trying to do the following in PR dotnet/corefx#11417 to reproduce a bug and demonstrate a test, but the APIs weren't exposed on .NET core

AssemblyBuilder assembly = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Name"), AssemblyBuilderAccess.Run);
ModuleBuilder module = assembly.DefineDynamicModule("Name");
MethodBuilder builder = module.DefineGlobalMethod(".cctor", MethodAttributes.RTSpecialName | MethodAttributes.SpecialName | MethodAttributes.Static, typeof(void), new Type[0]);
builder.GetILGenerator().Emit(OpCodes.Ret);

int token = builder.GetToken().Token;

module.CreateGlobalFunctions();

ConstructorInfo constructor = (ConstructorInfo)module.ResolveMember(token);
Console.WriteLine(constructor.Name);
kevin-montrose commented 7 years ago

Is there a rationale for removing / replacement for using MethodBase.GetMethodBody() (or rather, MethodBody.GetILAsByteArray() which is my ultimate target). Used in a couple places in Jil, and it's not trivial to work around it's absence.

svick commented 7 years ago

@kevin-montrose As far as I can tell, both [MethodBase.GetMethodBody()](https://apisof.net/catalog/System.Reflection.MethodBase.GetMethodBody()) and [MethodBody.GetILAsByteArray()](https://apisof.net/catalog/System.Reflection.MethodBody.GetILAsByteArray()) are planned for .Net Standard 2.0 and .Net Core 1.2.

khancyai commented 7 years ago

Hey! IsSubclassOf was removed. What can use to same result?

svick commented 7 years ago

@bits8 Type.IsSubclassOf is coming back in .Net Core 2.0 and .Net Standard 2.0. In the meantime, one option would be to copy its source code.

JonHanna commented 7 years ago

If you make an extension method matching the signature, then the compiler will switch to using the instance method instead as soon as it becomes available.

JonHanna commented 7 years ago

@bits8 This should serve:


internal static class TypeExtensions
{
    public static bool IsSubclassOf(this Type p, Type c)
    {
        // Don't leave this null-check out, or you could have silent errors
        // that suddenly break when the instance method comes back.
        if (p == null)
        {
            throw new ArgumentNullException(nameof(p));
        }

        if (p == c)
            return false;
        while (p != null)
        {
            if (p == c)
                return true;
            p = p.BaseType;
        }
        return false;
    }
}
khancyai commented 7 years ago

@svick @JonHanna Thank you! I've solved this issue with writing own code.

roa-nyx commented 7 years ago

@JonHanna

Hey, I'm having an issue where it seems like BaseType is not defined?

'Type' does not contain a definition for 'BaseType' and no extension method 'BaseType' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?)

Is this right, or am I doing something wrong?