Exposing MarshalByRefObject (dotnet/coreclr#7558)
authorRama krishnan Raghupathy <ramarag@microsoft.com>
Wed, 12 Oct 2016 17:34:09 +0000 (10:34 -0700)
committerJan Kotas <jkotas@microsoft.com>
Wed, 12 Oct 2016 17:34:09 +0000 (10:34 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/3cdb42e9b5a8ca871b53a27194106707a2db8962

13 files changed:
src/coreclr/src/mscorlib/model.xml
src/coreclr/src/mscorlib/ref/mscorlib.cs
src/coreclr/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
src/coreclr/src/mscorlib/src/System/AppDomainManager.cs
src/coreclr/src/mscorlib/src/System/ContextBoundObject.cs
src/coreclr/src/mscorlib/src/System/IO/FileSystemInfo.cs
src/coreclr/src/mscorlib/src/System/IO/Stream.cs
src/coreclr/src/mscorlib/src/System/IO/TextReader.cs
src/coreclr/src/mscorlib/src/System/IO/TextWriter.cs
src/coreclr/src/mscorlib/src/System/MarshalByRefObject.cs
src/coreclr/src/mscorlib/src/System/Threading/ThreadPool.cs
src/coreclr/src/mscorlib/src/System/Threading/Timer.cs
src/coreclr/src/mscorlib/src/System/Threading/WaitHandle.cs

index 445f3b6..e7733ae 100644 (file)
     </Type>
     <Type Name="System.MarshalByRefObject">
       <Member Name="#ctor" />
+      <Member Name="GetLifetimeService" />
+      <Member Name="InitializeLifetimeService" />
+      <Member Name="MemberwiseClone(System.Boolean)" />
     </Type>
     <Type Status="ImplRoot" Name="System.System_LazyDebugView&lt;T&gt;">
       <Member Status="ImplRoot" Name="#ctor(System.Lazy&lt;T&gt;)"/>
index 2f0e873..1231d89 100644 (file)
@@ -2490,6 +2490,10 @@ namespace System
     public abstract partial class MarshalByRefObject
     {
         protected MarshalByRefObject() { }
+        public object GetLifetimeService() { throw null; }
+        public virtual object InitializeLifetimeService() { throw null; }
+        protected System.MarshalByRefObject MemberwiseClone(bool cloneIdentity) { throw null; }
+    
     }
     public static partial class Math
     {
index dcf31dc..0d6a447 100644 (file)
@@ -96,13 +96,8 @@ namespace Microsoft.Win32 {
      * @security(checkDllCalls=off)
      * @security(checkClassLinking=on)
      */
-#if FEATURE_REMOTING
     [ComVisible(true)]
     public sealed class RegistryKey : MarshalByRefObject, IDisposable 
-#else
-    [ComVisible(true)]
-    public sealed class RegistryKey : IDisposable 
-#endif
     {
 
         // We could use const here, if C# supported ELEMENT_TYPE_I fully.
index 291099e..dc9fae4 100644 (file)
@@ -39,11 +39,7 @@ namespace System {
 #if !FEATURE_CORECLR
     [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.Infrastructure)]
 #endif
-#if FEATURE_REMOTING
     public class AppDomainManager : MarshalByRefObject {
-#else // FEATURE_REMOTING
-    public class AppDomainManager {
-#endif // FEATURE_REMOTING
         public AppDomainManager () {}
 #if FEATURE_REMOTING
         [System.Security.SecurityCritical]  // auto-generated
index 01929da..d074ad1 100644 (file)
@@ -15,10 +15,6 @@ namespace System {
     using System.Security.Permissions;
     [Serializable]
     [System.Runtime.InteropServices.ComVisible(true)]
-#if FEATURE_REMOTING
     public abstract class ContextBoundObject : MarshalByRefObject {
-#else // FEATURE_REMOTING
-    public abstract class ContextBoundObject {
-#endif // FEATURE_REMOTING
     }
 }
index 7a17a41..a35b87f 100644 (file)
@@ -32,11 +32,7 @@ namespace System.IO {
     [FileIOPermissionAttribute(SecurityAction.InheritanceDemand,Unrestricted=true)]
 #endif
     [ComVisible(true)]
-#if FEATURE_REMOTING
     public abstract class FileSystemInfo : MarshalByRefObject, ISerializable {
-#else // FEATURE_REMOTING
-    public abstract class FileSystemInfo : ISerializable {   
-#endif  //FEATURE_REMOTING      
         
         [System.Security.SecurityCritical] // auto-generated
         internal Win32Native.WIN32_FILE_ATTRIBUTE_DATA _data; // Cache the file information
index 4ec0a31..3b94cec 100644 (file)
@@ -30,11 +30,7 @@ using System.Reflection;
 namespace System.IO {
     [Serializable]
     [ComVisible(true)]
-#if FEATURE_REMOTING
     public abstract class Stream : MarshalByRefObject, IDisposable {
-#else // FEATURE_REMOTING
-    public abstract class Stream : IDisposable {
-#endif // FEATURE_REMOTING
 
         public static readonly Stream Null = new NullStream();
 
index ede4827..b8cacde 100644 (file)
@@ -35,11 +35,7 @@ namespace System.IO {
     // There are methods on the Stream class for reading bytes. 
     [Serializable]
     [ComVisible(true)]
-#if FEATURE_REMOTING
     public abstract class TextReader : MarshalByRefObject, IDisposable {
-#else // FEATURE_REMOTING
-    public abstract class TextReader : IDisposable {
-#endif // FEATURE_REMOTING
 
         public static readonly TextReader Null = new NullTextReader();
     
index 165001e..b923106 100644 (file)
@@ -35,11 +35,7 @@ namespace System.IO {
     // There are methods on the Stream class for writing bytes. 
     [Serializable]
     [ComVisible(true)]
-#if FEATURE_REMOTING
     public abstract class TextWriter : MarshalByRefObject, IDisposable {
-#else // FEATURE_REMOTING
-    public abstract class TextWriter : IDisposable {
-#endif // FEATURE_REMOTING
         public static readonly TextWriter Null = new NullTextWriter();
 
         // This should be initialized to Environment.NewLine, but
index 4948a43..201aa75 100644 (file)
@@ -35,7 +35,7 @@ namespace System {
 [System.Runtime.InteropServices.ComVisible(true)]
     public abstract class MarshalByRefObject 
     {
-#if FEATURE_REMOTING    
+#if FEATURE_REMOTING
         private Object __identity;        
 
         private Object Identity { get { return __identity; } set { __identity = value; } }        
@@ -87,7 +87,8 @@ namespace System {
             return t.InvokeMember(name, invokeAttr, binder, this, args, modifiers, culture, namedParameters);
         }
 
-        // Returns a new cloned MBR instance that is a memberwise copy of this 
+
+        // Returns a new cloned MBR instance that is a memberwise copy of this
         // with the identity nulled out, so there are no identity conflicts
         // when the cloned object is marshalled
         protected MarshalByRefObject MemberwiseClone(bool cloneIdentity)
@@ -98,8 +99,6 @@ namespace System {
                 mbr.Identity = null;
             return mbr;
         }
-
-
         
         // A helper routine to extract the identity either from the marshalbyrefobject base
         // class if it is not a proxy, otherwise from the real proxy.
@@ -256,7 +255,22 @@ namespace System {
 
             return o.CanCastToXmlType(xmlTypeName, xmlTypeNamespace);
         } // CanCastToXmlType
-
+#else
+        protected MarshalByRefObject() { }
+        public object GetLifetimeService()
+        {
+            throw new PlatformNotSupportedException();
+        }
+        public virtual object InitializeLifetimeService()
+        {
+            throw new PlatformNotSupportedException();
+        }
+        protected MarshalByRefObject MemberwiseClone(bool cloneIdentity)
+        {
+            MarshalByRefObject mbr = (MarshalByRefObject)base.MemberwiseClone();
+            return mbr;
+        }
 #endif // FEATURE_REMOTING
+
     }            
 } // namespace    
index 09fe93c..046dabe 100644 (file)
@@ -1094,11 +1094,7 @@ namespace System.Threading
     }
 
 [System.Runtime.InteropServices.ComVisible(true)]
-#if FEATURE_REMOTING    
     public sealed class RegisteredWaitHandle : MarshalByRefObject {
-#else // FEATURE_REMOTING
-    public sealed class RegisteredWaitHandle {
-#endif // FEATURE_REMOTING
         private RegisteredWaitHandleSafe internalRegisteredWait;
     
         internal RegisteredWaitHandle()
index cb08c6e..99eae69 100644 (file)
@@ -774,11 +774,7 @@ namespace System.Threading
 
     [HostProtection(Synchronization=true, ExternalThreading=true)]
     [System.Runtime.InteropServices.ComVisible(true)]
-#if FEATURE_REMOTING
     public sealed class Timer : MarshalByRefObject, IDisposable
-#else // FEATURE_REMOTING
-    public sealed class Timer : IDisposable
-#endif // FEATURE_REMOTING
     {
         private const UInt32 MAX_SUPPORTED_TIMEOUT = (uint)0xfffffffe;
 
index 9980c82..b8fbe48 100644 (file)
@@ -28,11 +28,7 @@ namespace System.Threading
     using Win32Native = Microsoft.Win32.Win32Native;
 
 [System.Runtime.InteropServices.ComVisible(true)]
-#if FEATURE_REMOTING
     public abstract class WaitHandle : MarshalByRefObject, IDisposable {
-#else // FEATURE_REMOTING
-    public abstract class WaitHandle : IDisposable {
-#endif // FEATURE_REMOTING
         public const int WaitTimeout = 0x102;                    
 
         private const int MAX_WAITHANDLES = 64;