Skip to content

Commit

Permalink
Remove some dead stuff (#46494)
Browse files Browse the repository at this point in the history
* Remove some dead stuff

* Remove unnecessary test

* Remove FCall alias
  • Loading branch information
danmoseley authored Jan 3, 2021
1 parent 05cb4b3 commit 144cac3
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 284 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1093,11 +1093,7 @@ private static bool AddLdapHandleRef(LdapConnection ldapConnection)
bool success = false;
if (ldapConnection != null && ldapConnection._ldapHandle != null && !ldapConnection._ldapHandle.IsInvalid)
{
try { }
finally
{
ldapConnection._ldapHandle.DangerousAddRef(ref success);
}
ldapConnection._ldapHandle.DangerousAddRef(ref success);
}

return success;
Expand All @@ -1107,11 +1103,7 @@ private static void ReleaseLdapHandleRef(LdapConnection ldapConnection)
{
if (ldapConnection != null && ldapConnection._ldapHandle != null && !ldapConnection._ldapHandle.IsInvalid)
{
try { }
finally
{
ldapConnection._ldapHandle.DangerousRelease();
}
ldapConnection._ldapHandle.DangerousRelease();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

namespace System.Security
{
// SecurityCriticalAttribute
// Indicates that the decorated code or assembly performs security critical operations (e.g. Assert, "unsafe", LinkDemand, etc.)
// The attribute can be placed on most targets, except on arguments/return values.
// Has no effect in .NET Core
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Class |
AttributeTargets.Struct |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@

namespace System.Security
{
// SecurityRulesAttribute
//
// Indicates which set of security rules an assembly was authored against, and therefore which set of
// rules the runtime should enforce on the assembly. For instance, an assembly marked with
// [SecurityRules(SecurityRuleSet.Level1)] will follow the v2.0 transparency rules, where transparent code
// can call a LinkDemand by converting it to a full demand, public critical methods are implicitly
// treat as safe, and the remainder of the v2.0 rules apply.
// Has no effect in .NET Core
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public sealed class SecurityRulesAttribute : Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@

namespace System.Security
{
// SecuritySafeCriticalAttribute:
// Indicates that the code may contain violations to the security critical rules (e.g. transitions from
// critical to non-public transparent, transparent to non-public critical, etc.), has been audited for
// security concerns and is considered security clean. Also indicates that the code is considered SecurityCritical.
// The effect of this attribute is as if the code was marked [SecurityCritical][SecurityTreatAsSafe].
// At assembly-scope, all rule checks will be suppressed within the assembly and for calls made against the assembly.
// At type-scope, all rule checks will be suppressed for members within the type and for calls made against the type.
// At member level (e.g. field and method) the code will be treated as public - i.e. no rule checks for the members.

// Has no effect in .NET Core
[AttributeUsage(AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Enum |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@

namespace System.Security
{
// SecurityTransparentAttribute:
// Indicates the assembly contains only transparent code.
// Security critical actions will be restricted or converted into less critical actions. For example,
// Assert will be restricted, SuppressUnmanagedCode, LinkDemand, unsafe, and unverifiable code will be converted
// into Full-Demands.

// Has no effect in .NET Core
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
public sealed class SecurityTransparentAttribute : Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@

namespace System.Security
{
// SecurityTreatAsSafeAttribute:
// Indicates that the code may contain violations to the security critical rules (e.g. transitions from
// critical to non-public transparent, transparent to non-public critical, etc.), has been audited for
// security concerns and is considered security clean.
// At assembly-scope, all rule checks will be suppressed within the assembly and for calls made against the assembly.
// At type-scope, all rule checks will be suppressed for members within the type and for calls made against the type.
// At member level (e.g. field and method) the code will be treated as public - i.e. no rule checks for the members.

// Has no effect in .NET Core
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Class |
AttributeTargets.Struct |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

namespace System.Security
{
// SuppressUnmanagedCodeSecurityAttribute:
// This attribute has no functional impact in CoreCLR.
// Has no effect in .NET Core
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,8 @@ public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
}
}
}
// entering the lock and incrementing waiters must not suffer a thread-abort, else we cannot
// clean up m_waitCount correctly, which may lead to deadlock due to non-woken waiters.
try { }
finally
{
Monitor.Enter(m_lockObjAndDisposed, ref lockTaken);
if (lockTaken)
{
m_waitCount++;
}
}
Monitor.Enter(m_lockObjAndDisposed, ref lockTaken);
m_waitCount++;

// If there are any async waiters, for fairness we'll get in line behind
// then by translating our synchronous wait into an asynchronous one that we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,8 @@ private void EnqueueSlow(T item, ref Segment segment)
newSegment.m_state.m_last = 1;
newSegment.m_state.m_lastCopy = 1;

try { }
finally
{
// Finally block to protect against corruption due to a thread abort
// between setting m_next and setting m_tail.
Volatile.Write(ref m_tail.m_next, newSegment); // ensure segment not published until item is fully stored
m_tail = newSegment;
}
Volatile.Write(ref m_tail.m_next, newSegment); // ensure segment not published until item is fully stored
m_tail = newSegment;
}

/// <summary>Attempts to dequeue an item from the queue.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,12 @@ private void Initialize(Func<T>? valueFactory, bool trackAllValues)
_valueFactory = valueFactory;
_trackAllValues = trackAllValues;

// Assign the ID and mark the instance as initialized. To avoid leaking IDs, we assign the ID and set _initialized
// in a finally block, to avoid a thread abort in between the two statements.
try { }
finally
{
_idComplement = ~s_idManager.GetId();
// Assign the ID and mark the instance as initialized.
_idComplement = ~s_idManager.GetId();

// As the last step, mark the instance as fully initialized. (Otherwise, if _initialized=false, we know that an exception
// occurred in the constructor.)
_initialized = true;
}
// As the last step, mark the instance as fully initialized. (Otherwise, if _initialized=false, we know that an exception
// occurred in the constructor.)
_initialized = true;
}

/// <summary>
Expand Down
Loading

0 comments on commit 144cac3

Please sign in to comment.