Merge System/MonoType.cs into ReferenceSources/RuntimeType.cs, use th… (#3045)
[mono.git] / mcs / class / referencesource / mscorlib / system / rttype.cs
index f518646e30cdd460aac1c175e95662f1b754c580..5e3d732b8e237f2a3852d83b798ff2b15eb6bea3 100644 (file)
@@ -5028,10 +5028,12 @@ namespace System
             return obj == (object)this;
         }
 
+#if !MONO
         public override int GetHashCode() 
         {
             return RuntimeHelpers.GetHashCode(this);
         }
+#endif
 
 #if !FEATURE_CORECLR
         public static bool operator ==(RuntimeType left, RuntimeType right)
@@ -5369,12 +5371,31 @@ namespace System
                                     Environment.GetResourceString("NotSupported_CallToVarArg")));
                             }
 
+#if MONO && FEATURE_REMOTING
+                            if (activationAttributes != null && activationAttributes.Length != 0) {
+                                server = ActivationCreateInstance (invokeMethod, bindingAttr, binder, args, culture, activationAttributes);
+                            } else {
+#endif
                             // fast path??
                             server = Activator.CreateInstance(this, true);
+
+#if MONO && FEATURE_REMOTING
+                            }
+#endif
                         }
                         else
                         {
+#if MONO && FEATURE_REMOTING
+
+                            if (activationAttributes != null && activationAttributes.Length != 0) {
+                                server = ActivationCreateInstance (invokeMethod, bindingAttr, binder, args, culture, activationAttributes);
+                            } else {
+#endif
                             server = ((ConstructorInfo)invokeMethod).Invoke(bindingAttr, binder, args, culture);
+#if MONO && FEATURE_REMOTING
+                            }
+#endif
+
                             if (state != null)
                                 binder.ReorderArgumentArray(ref args, state);
                         }
@@ -5400,7 +5421,25 @@ namespace System
             //Console.WriteLine(server);
             return server;                                
         }
-#if !MONO
+
+#if MONO
+#if FEATURE_REMOTING
+        //
+        // .NET seems to do this deep in method invocation which looks odd as it
+        // needs extra push/pop as PushActivationAttributes/PopActivationAttributes.
+        // We let them do nothing and have all logic here without complicated checks
+        // inside fast path invoke.
+        //
+        object ActivationCreateInstance (MethodBase invokeMethod, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
+        {
+            var server = ActivationServices.CreateProxyFromAttributes (this, activationAttributes);
+            if (server != null)
+                invokeMethod.Invoke (server, bindingAttr, binder, args, culture);
+
+            return server;
+        }
+#endif
+#else
         // the cache entry
         class ActivatorCacheEntry
         {