Skip to content

Commit 144cac3

Browse files
authored
Remove some dead stuff (#46494)
* Remove some dead stuff * Remove unnecessary test * Remove FCall alias
1 parent 05cb4b3 commit 144cac3

File tree

11 files changed

+149
-284
lines changed

11 files changed

+149
-284
lines changed

src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,11 +1093,7 @@ private static bool AddLdapHandleRef(LdapConnection ldapConnection)
10931093
bool success = false;
10941094
if (ldapConnection != null && ldapConnection._ldapHandle != null && !ldapConnection._ldapHandle.IsInvalid)
10951095
{
1096-
try { }
1097-
finally
1098-
{
1099-
ldapConnection._ldapHandle.DangerousAddRef(ref success);
1100-
}
1096+
ldapConnection._ldapHandle.DangerousAddRef(ref success);
11011097
}
11021098

11031099
return success;
@@ -1107,11 +1103,7 @@ private static void ReleaseLdapHandleRef(LdapConnection ldapConnection)
11071103
{
11081104
if (ldapConnection != null && ldapConnection._ldapHandle != null && !ldapConnection._ldapHandle.IsInvalid)
11091105
{
1110-
try { }
1111-
finally
1112-
{
1113-
ldapConnection._ldapHandle.DangerousRelease();
1114-
}
1106+
ldapConnection._ldapHandle.DangerousRelease();
11151107
}
11161108
}
11171109
}

src/libraries/System.Private.CoreLib/src/System/Security/SecurityCriticalAttribute.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
namespace System.Security
55
{
6-
// SecurityCriticalAttribute
7-
// Indicates that the decorated code or assembly performs security critical operations (e.g. Assert, "unsafe", LinkDemand, etc.)
8-
// The attribute can be placed on most targets, except on arguments/return values.
6+
// Has no effect in .NET Core
97
[AttributeUsage(AttributeTargets.Assembly |
108
AttributeTargets.Class |
119
AttributeTargets.Struct |

src/libraries/System.Private.CoreLib/src/System/Security/SecurityRulesAttribute.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33

44
namespace System.Security
55
{
6-
// SecurityRulesAttribute
7-
//
8-
// Indicates which set of security rules an assembly was authored against, and therefore which set of
9-
// rules the runtime should enforce on the assembly. For instance, an assembly marked with
10-
// [SecurityRules(SecurityRuleSet.Level1)] will follow the v2.0 transparency rules, where transparent code
11-
// can call a LinkDemand by converting it to a full demand, public critical methods are implicitly
12-
// treat as safe, and the remainder of the v2.0 rules apply.
6+
// Has no effect in .NET Core
137
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
148
public sealed class SecurityRulesAttribute : Attribute
159
{

src/libraries/System.Private.CoreLib/src/System/Security/SecuritySafeCriticalAttribute.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@
33

44
namespace System.Security
55
{
6-
// SecuritySafeCriticalAttribute:
7-
// Indicates that the code may contain violations to the security critical rules (e.g. transitions from
8-
// critical to non-public transparent, transparent to non-public critical, etc.), has been audited for
9-
// security concerns and is considered security clean. Also indicates that the code is considered SecurityCritical.
10-
// The effect of this attribute is as if the code was marked [SecurityCritical][SecurityTreatAsSafe].
11-
// At assembly-scope, all rule checks will be suppressed within the assembly and for calls made against the assembly.
12-
// At type-scope, all rule checks will be suppressed for members within the type and for calls made against the type.
13-
// At member level (e.g. field and method) the code will be treated as public - i.e. no rule checks for the members.
14-
6+
// Has no effect in .NET Core
157
[AttributeUsage(AttributeTargets.Class |
168
AttributeTargets.Struct |
179
AttributeTargets.Enum |

src/libraries/System.Private.CoreLib/src/System/Security/SecurityTransparentAttribute.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33

44
namespace System.Security
55
{
6-
// SecurityTransparentAttribute:
7-
// Indicates the assembly contains only transparent code.
8-
// Security critical actions will be restricted or converted into less critical actions. For example,
9-
// Assert will be restricted, SuppressUnmanagedCode, LinkDemand, unsafe, and unverifiable code will be converted
10-
// into Full-Demands.
11-
6+
// Has no effect in .NET Core
127
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
138
public sealed class SecurityTransparentAttribute : Attribute
149
{

src/libraries/System.Private.CoreLib/src/System/Security/SecurityTreatAsSafeAttribute.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33

44
namespace System.Security
55
{
6-
// SecurityTreatAsSafeAttribute:
7-
// Indicates that the code may contain violations to the security critical rules (e.g. transitions from
8-
// critical to non-public transparent, transparent to non-public critical, etc.), has been audited for
9-
// security concerns and is considered security clean.
10-
// At assembly-scope, all rule checks will be suppressed within the assembly and for calls made against the assembly.
11-
// At type-scope, all rule checks will be suppressed for members within the type and for calls made against the type.
12-
// At member level (e.g. field and method) the code will be treated as public - i.e. no rule checks for the members.
13-
6+
// Has no effect in .NET Core
147
[AttributeUsage(AttributeTargets.Assembly |
158
AttributeTargets.Class |
169
AttributeTargets.Struct |

src/libraries/System.Private.CoreLib/src/System/Security/SuppressUnmanagedCodeSecurityAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
namespace System.Security
55
{
6-
// SuppressUnmanagedCodeSecurityAttribute:
7-
// This attribute has no functional impact in CoreCLR.
6+
// Has no effect in .NET Core
87
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
98
public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute
109
{

src/libraries/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,8 @@ public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
341341
}
342342
}
343343
}
344-
// entering the lock and incrementing waiters must not suffer a thread-abort, else we cannot
345-
// clean up m_waitCount correctly, which may lead to deadlock due to non-woken waiters.
346-
try { }
347-
finally
348-
{
349-
Monitor.Enter(m_lockObjAndDisposed, ref lockTaken);
350-
if (lockTaken)
351-
{
352-
m_waitCount++;
353-
}
354-
}
344+
Monitor.Enter(m_lockObjAndDisposed, ref lockTaken);
345+
m_waitCount++;
355346

356347
// If there are any async waiters, for fairness we'll get in line behind
357348
// then by translating our synchronous wait into an asynchronous one that we

src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,8 @@ private void EnqueueSlow(T item, ref Segment segment)
181181
newSegment.m_state.m_last = 1;
182182
newSegment.m_state.m_lastCopy = 1;
183183

184-
try { }
185-
finally
186-
{
187-
// Finally block to protect against corruption due to a thread abort
188-
// between setting m_next and setting m_tail.
189-
Volatile.Write(ref m_tail.m_next, newSegment); // ensure segment not published until item is fully stored
190-
m_tail = newSegment;
191-
}
184+
Volatile.Write(ref m_tail.m_next, newSegment); // ensure segment not published until item is fully stored
185+
m_tail = newSegment;
192186
}
193187

194188
/// <summary>Attempts to dequeue an item from the queue.</summary>

src/libraries/System.Private.CoreLib/src/System/Threading/ThreadLocal.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,12 @@ private void Initialize(Func<T>? valueFactory, bool trackAllValues)
122122
_valueFactory = valueFactory;
123123
_trackAllValues = trackAllValues;
124124

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

132-
// As the last step, mark the instance as fully initialized. (Otherwise, if _initialized=false, we know that an exception
133-
// occurred in the constructor.)
134-
_initialized = true;
135-
}
128+
// As the last step, mark the instance as fully initialized. (Otherwise, if _initialized=false, we know that an exception
129+
// occurred in the constructor.)
130+
_initialized = true;
136131
}
137132

138133
/// <summary>

0 commit comments

Comments
 (0)