summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/MulticastDelegate.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/MulticastDelegate.cs')
-rw-r--r--src/mscorlib/src/System/MulticastDelegate.cs40
1 files changed, 5 insertions, 35 deletions
diff --git a/src/mscorlib/src/System/MulticastDelegate.cs b/src/mscorlib/src/System/MulticastDelegate.cs
index f59db16850..a7b244cdae 100644
--- a/src/mscorlib/src/System/MulticastDelegate.cs
+++ b/src/mscorlib/src/System/MulticastDelegate.cs
@@ -9,6 +9,7 @@ namespace System
using System.Runtime;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
+ using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Reflection.Emit;
@@ -20,9 +21,7 @@ namespace System
// 1. Multicast delegate
// 2. Secure/Wrapper delegate
// 3. Inner delegate of secure delegate where the secure delegate security context is a collectible method
- [System.Security.SecurityCritical]
private Object _invocationList;
- [System.Security.SecurityCritical]
private IntPtr _invocationCount;
// This constructor is called from the class generated by the
@@ -39,19 +38,16 @@ namespace System
{
}
- [System.Security.SecuritySafeCritical]
internal bool IsUnmanagedFunctionPtr()
{
return (_invocationCount == (IntPtr)(-1));
}
- [System.Security.SecuritySafeCritical]
internal bool InvocationListLogicallyNull()
{
return (_invocationList == null) || (_invocationList is LoaderAllocator) || (_invocationList is DynamicResolver);
}
- [System.Security.SecurityCritical]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
int targetIndex = 0;
@@ -101,7 +97,6 @@ namespace System
// equals returns true IIF the delegate is not null and has the
// same target, method and invocation list as this object
- [System.Security.SecuritySafeCritical] // auto-generated
public override sealed bool Equals(Object obj)
{
if (obj == null)
@@ -114,7 +109,7 @@ namespace System
// Since this is a MulticastDelegate and we know
// the types are the same, obj should also be a
// MulticastDelegate
- Contract.Assert(obj is MulticastDelegate, "Shouldn't have failed here since we already checked the types are the same!");
+ Debug.Assert(obj is MulticastDelegate, "Shouldn't have failed here since we already checked the types are the same!");
var d = JitHelpers.UnsafeCast<MulticastDelegate>(obj);
if (_invocationCount != (IntPtr)0)
@@ -151,7 +146,7 @@ namespace System
}
else
{
- Contract.Assert((_invocationList as Object[]) != null, "empty invocation list on multicast delegate");
+ Debug.Assert((_invocationList as Object[]) != null, "empty invocation list on multicast delegate");
return InvocationListEquals(d);
}
}
@@ -180,10 +175,9 @@ namespace System
}
// Recursive function which will check for equality of the invocation list.
- [System.Security.SecuritySafeCritical]
private bool InvocationListEquals(MulticastDelegate d)
{
- Contract.Assert(d != null && (_invocationList as Object[]) != null, "bogus delegate in multicast list comparison");
+ Debug.Assert(d != null && (_invocationList as Object[]) != null, "bogus delegate in multicast list comparison");
Object[] invocationList = _invocationList as Object[];
if (d._invocationCount != _invocationCount)
return false;
@@ -199,7 +193,6 @@ namespace System
return true;
}
- [System.Security.SecurityCritical]
private bool TrySetSlot(Object[] a, int index, Object o)
{
if (a[index] == null && System.Threading.Interlocked.CompareExchange<Object>(ref a[index], o, null) == null)
@@ -222,7 +215,6 @@ namespace System
return false;
}
- [System.Security.SecurityCritical]
private MulticastDelegate NewMulticastDelegate(Object[] invocationList, int invocationCount, bool thisIsMultiCastAlready)
{
// First, allocate a new multicast delegate just like this one, i.e. same type as the this object
@@ -247,18 +239,16 @@ namespace System
return result;
}
- [System.Security.SecurityCritical]
internal MulticastDelegate NewMulticastDelegate(Object[] invocationList, int invocationCount)
{
return NewMulticastDelegate(invocationList, invocationCount, false);
}
- [System.Security.SecurityCritical]
internal void StoreDynamicMethod(MethodInfo dynamicMethod)
{
if (_invocationCount != (IntPtr)0)
{
- Contract.Assert(!IsUnmanagedFunctionPtr(), "dynamic method and unmanaged fntptr delegate combined");
+ Debug.Assert(!IsUnmanagedFunctionPtr(), "dynamic method and unmanaged fntptr delegate combined");
// must be a secure/wrapper one, unwrap and save
MulticastDelegate d = (MulticastDelegate)_invocationList;
d._methodBase = dynamicMethod;
@@ -270,7 +260,6 @@ namespace System
// This method will combine this delegate with the passed delegate
// to form a new delegate.
- [System.Security.SecuritySafeCritical] // auto-generated
protected override sealed Delegate CombineImpl(Delegate follow)
{
if ((Object)follow == null) // cast to object for a more efficient test
@@ -356,7 +345,6 @@ namespace System
}
}
- [System.Security.SecurityCritical]
private Object[] DeleteFromInvocationList(Object[] invocationList, int invocationCount, int deleteIndex, int deleteCount)
{
Object[] thisInvocationList = _invocationList as Object[];
@@ -390,7 +378,6 @@ namespace System
// look at the invocation list.) If this is found we remove it from
// this list and return a new delegate. If its not found a copy of the
// current list is returned.
- [System.Security.SecuritySafeCritical] // auto-generated
protected override sealed Delegate RemoveImpl(Delegate value)
{
// There is a special case were we are removing using a delegate as
@@ -464,7 +451,6 @@ namespace System
}
// This method returns the Invocation list of this multicast delegate.
- [System.Security.SecuritySafeCritical]
public override sealed Delegate[] GetInvocationList()
{
Contract.Ensures(Contract.Result<Delegate[]>() != null);
@@ -505,7 +491,6 @@ namespace System
return !d1.Equals(d2);
}
- [System.Security.SecuritySafeCritical]
public override sealed int GetHashCode()
{
if (IsUnmanagedFunctionPtr())
@@ -528,7 +513,6 @@ namespace System
}
}
- [System.Security.SecuritySafeCritical]
internal override Object GetTarget()
{
if (_invocationCount != (IntPtr)0)
@@ -562,7 +546,6 @@ namespace System
return base.GetTarget();
}
- [System.Security.SecuritySafeCritical]
protected override MethodInfo GetMethodImpl()
{
if (_invocationCount != (IntPtr)0 && _invocationList != null)
@@ -613,7 +596,6 @@ namespace System
throw new ArgumentException(Environment.GetResourceString("Arg_DlgtNullInst"));
}
- [System.Security.SecurityCritical]
[System.Diagnostics.DebuggerNonUserCode]
private void CtorClosed(Object target, IntPtr methodPtr)
{
@@ -623,7 +605,6 @@ namespace System
this._methodPtr = methodPtr;
}
- [System.Security.SecurityCritical]
[System.Diagnostics.DebuggerNonUserCode]
private void CtorClosedStatic(Object target, IntPtr methodPtr)
{
@@ -631,7 +612,6 @@ namespace System
this._methodPtr = methodPtr;
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorRTClosed(Object target, IntPtr methodPtr)
{
@@ -639,7 +619,6 @@ namespace System
this._methodPtr = AdjustTarget(target, methodPtr);
}
- [System.Security.SecurityCritical]
[System.Diagnostics.DebuggerNonUserCode]
private void CtorOpened(Object target, IntPtr methodPtr, IntPtr shuffleThunk)
{
@@ -648,7 +627,6 @@ namespace System
this._methodPtrAux = methodPtr;
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorSecureClosed(Object target, IntPtr methodPtr, IntPtr callThunk, IntPtr creatorMethod)
{
@@ -661,7 +639,6 @@ namespace System
this._invocationCount = GetInvokeMethod();
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorSecureClosedStatic(Object target, IntPtr methodPtr, IntPtr callThunk, IntPtr creatorMethod)
{
@@ -674,7 +651,6 @@ namespace System
this._invocationCount = GetInvokeMethod();
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorSecureRTClosed(Object target, IntPtr methodPtr, IntPtr callThunk, IntPtr creatorMethod)
{
@@ -687,7 +663,6 @@ namespace System
this._invocationCount = GetInvokeMethod();
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorSecureOpened(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr callThunk, IntPtr creatorMethod)
{
@@ -700,7 +675,6 @@ namespace System
this._invocationCount = GetInvokeMethod();
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorVirtualDispatch(Object target, IntPtr methodPtr, IntPtr shuffleThunk)
{
@@ -709,7 +683,6 @@ namespace System
this._methodPtrAux = GetCallStub(methodPtr);
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorSecureVirtualDispatch(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr callThunk, IntPtr creatorMethod)
{
@@ -722,7 +695,6 @@ namespace System
this._invocationCount = GetInvokeMethod();
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorCollectibleClosedStatic(Object target, IntPtr methodPtr, IntPtr gchandle)
{
@@ -731,7 +703,6 @@ namespace System
this._methodBase = System.Runtime.InteropServices.GCHandle.InternalGet(gchandle);
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorCollectibleOpened(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr gchandle)
{
@@ -741,7 +712,6 @@ namespace System
this._methodBase = System.Runtime.InteropServices.GCHandle.InternalGet(gchandle);
}
- [System.Security.SecurityCritical] // auto-generated
[System.Diagnostics.DebuggerNonUserCode]
private void CtorCollectibleVirtualDispatch(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr gchandle)
{