Mono friendly MethodInfo
authorMarek Safar <marek.safar@gmail.com>
Mon, 15 Feb 2016 17:13:37 +0000 (18:13 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 3 May 2016 09:42:40 +0000 (11:42 +0200)
mcs/class/referencesource/mscorlib/system/reflection/methodinfo.cs

index 6b8acb771a1031714383015cc770bebf0ec929a0..d82cc177e4e4d1df105c903040a2e9ac430c0f61 100644 (file)
@@ -25,7 +25,9 @@ namespace System.Reflection
     using System.Text;
     using System.Threading;
     using MemberListType = System.RuntimeType.MemberListType;
+#if !MONO
     using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
+#endif
     using System.Runtime.CompilerServices;
 
     [Serializable]
@@ -35,7 +37,10 @@ namespace System.Reflection
     [PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
 #pragma warning restore 618
     [System.Runtime.InteropServices.ComVisible(true)]
-    public abstract class MethodInfo : MethodBase, _MethodInfo
+    public abstract class MethodInfo : MethodBase
+#if !MOBILE
+    , _MethodInfo
+#endif
     {
         #region Constructor
         protected MethodInfo() { }
@@ -96,7 +101,7 @@ namespace System.Reflection
         public virtual Delegate CreateDelegate(Type delegateType, Object target) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); }
         #endregion
 
-#if !FEATURE_CORECLR
+#if !FEATURE_CORECLR && !MOBILE
         Type _MethodInfo.GetType()
         {
             return base.GetType();
@@ -124,8 +129,17 @@ namespace System.Reflection
             throw new NotImplementedException();
         }
 #endif
+
+#if MONO
+        // TODO: Remove, needed only for MonoCustomAttribute
+        internal virtual MethodInfo GetBaseMethod ()
+        {
+            return this;
+        }
+#endif
     }
 
+#if !MONO
     [Serializable]
     internal sealed class RuntimeMethodInfo : MethodInfo, ISerializable, IRuntimeMethodInfo
     {
@@ -1063,4 +1077,5 @@ namespace System.Reflection
         }
         #endregion
     }
+#endif
 }