// Patrik Torstensson (totte_mono@yahoo.com)
//
// (C) Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Threading;
using System.Runtime.Remoting;
+using System.Security.Permissions;
+using System.Runtime.InteropServices;
namespace System
{
[Serializable]
+ [ComVisible (true)]
+ [StructLayout (LayoutKind.Sequential)]
public abstract class MarshalByRefObject
{
+ [NonSerialized]
private ServerIdentity _identity; // Holds marshalling iformation of the object
protected MarshalByRefObject ()
set { _identity = value; }
}
- public virtual ObjRef CreateObjRef (Type type)
+ [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
+ public virtual ObjRef CreateObjRef (Type requestedType)
{
// This method can only be called when this object has been marshalled
if (_identity == null)
throw new RemotingException (Locale.GetText ("No remoting information was found for the object."));
- return _identity.CreateObjRef (type);
+ return _identity.CreateObjRef (requestedType);
}
+ // corcompare says it is "virtual final", so there is likely
+ // an internal interface in .NET.
+ [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
public object GetLifetimeService ()
{
if (_identity == null)
else return _identity.Lease;
}
+ [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
public virtual object InitializeLifetimeService ()
{
- return new System.Runtime.Remoting.Lifetime.Lease();
+ if (_identity != null && _identity.Lease != null)
+ return _identity.Lease;
+ else
+ return new System.Runtime.Remoting.Lifetime.Lease();
+ }
+
+ protected MarshalByRefObject MemberwiseClone (bool cloneIdentity)
+ {
+ MarshalByRefObject mbr = (MarshalByRefObject) MemberwiseClone ();
+ if (!cloneIdentity)
+ mbr._identity = null;
+ return mbr;
}
}
}