return _list.IndexOf(value);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int IndexOf(object? value, int startIndex)
{
return IndexOf(value, startIndex, _list.Count - startIndex);
return LastIndexOf(value, _list.Count - 1, _list.Count);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex)
{
return LastIndexOf(value, startIndex, startIndex + 1);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex, int count)
{
if (_list.Count == 0)
return _list.Capacity;
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
set
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int BinarySearch(int index, int count, object? value, IComparer? comparer)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void CopyTo(int index, Array array, int arrayIndex, int count)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override IEnumerator GetEnumerator(int index, int count)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int IndexOf(object? value, int startIndex)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int IndexOf(object? value, int startIndex, int count)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void InsertRange(int index, ICollection c)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex, int count)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void RemoveRange(int index, int count)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void Reverse(int index, int count)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void SetRange(int index, ICollection c)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override ArrayList GetRange(int index, int count)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void Sort(int index, int count, IComparer? comparer)
{
lock (_root)
}
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override Array ToArray(Type type)
{
lock (_root)
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int BinarySearch(int index, int count, object? value, IComparer? comparer)
{
return _list.BinarySearch(index, count, value, comparer);
public override int Capacity
{
get => _list.Capacity;
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
set => throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
_list.CopyTo(array, index);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void CopyTo(int index, Array array, int arrayIndex, int count)
{
_list.CopyTo(index, array, arrayIndex, count);
return _list.GetEnumerator();
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override IEnumerator GetEnumerator(int index, int count)
{
return _list.GetEnumerator(index, count);
return _list.IndexOf(value);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int IndexOf(object? value, int startIndex)
{
return _list.IndexOf(value, startIndex);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int IndexOf(object? value, int startIndex, int count)
{
return _list.IndexOf(value, startIndex, count);
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void InsertRange(int index, ICollection c)
{
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
return _list.LastIndexOf(value);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex)
{
return _list.LastIndexOf(value, startIndex);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex, int count)
{
return _list.LastIndexOf(value, startIndex, count);
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void RemoveRange(int index, int count)
{
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void SetRange(int index, ICollection c)
{
_list.SetRange(index, c);
return new Range(this, index, count);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void Reverse(int index, int count)
{
_list.Reverse(index, count);
_version = _list._version;
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void Sort(int index, int count, IComparer? comparer)
{
_list.Sort(index, count, comparer);
return _list.ToArray();
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override Array ToArray(Type type)
{
return _list.ToArray(type);
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int BinarySearch(int index, int count, object? value, IComparer? comparer)
{
return _list.BinarySearch(index, count, value, comparer);
public override int Capacity
{
get => _list.Capacity;
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
set => throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
_list.CopyTo(array, index);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void CopyTo(int index, Array array, int arrayIndex, int count)
{
_list.CopyTo(index, array, arrayIndex, count);
return _list.GetEnumerator();
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override IEnumerator GetEnumerator(int index, int count)
{
return _list.GetEnumerator(index, count);
return _list.IndexOf(value);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int IndexOf(object? value, int startIndex)
{
return _list.IndexOf(value, startIndex);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int IndexOf(object? value, int startIndex, int count)
{
return _list.IndexOf(value, startIndex, count);
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void InsertRange(int index, ICollection c)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
return _list.LastIndexOf(value);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex)
{
return _list.LastIndexOf(value, startIndex);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex, int count)
{
return _list.LastIndexOf(value, startIndex, count);
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void RemoveRange(int index, int count)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void SetRange(int index, ICollection c)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
return new Range(this, index, count);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void Reverse(int index, int count)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void Sort(int index, int count, IComparer? comparer)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
return _list.ToArray();
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override Array ToArray(Type type)
{
return _list.ToArray(type);
return -1;
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex)
{
return LastIndexOf(value, startIndex, startIndex + 1);
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int LastIndexOf(object? value, int startIndex, int count)
{
InternalUpdateRange();
InternalUpdateVersion();
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void SetRange(int index, ICollection c)
{
InternalUpdateRange();
/// <summary>
/// Specifies the default value for a property.
/// </summary>
- [SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
- [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
[AttributeUsage(AttributeTargets.All)]
public class DefaultValueAttribute : Attribute
{
private const int s_etwAPIMaxRefObjCount = 8;
private const int s_traceEventMaximumSize = 65482;
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
public enum WriteEventErrorCode : int
{
// check mapping to runtime codes
return false;
}
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
public static WriteEventErrorCode GetLastWriteEventError()
{
return s_returnCode;
// <UsesUnsafeCode Name="Local v7 of type: Char*" />
// <ReferencesCritical Name="Method: EncodeObject(Object&, EventData*, Byte*):String" Ring="1" />
// </SecurityKernel>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Performance-critical code")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr eventHandle, Guid* activityID, Guid* childActivityID, params object?[] eventPayload)
{
WriteEventErrorCode status = WriteEventErrorCode.NoError;
// <SecurityKernel Critical="True" Ring="0">
// <CallsSuppressUnmanagedCode Name="Interop.Advapi32.EventWrite(System.Int64,EventDescriptor&,System.UInt32,System.Void*):System.UInt32" />
// </SecurityKernel>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
protected internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr eventHandle, Guid* activityID, Guid* childActivityID, int dataCount, IntPtr data)
{
if (childActivityID != null)
return true;
}
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
internal unsafe bool WriteEventRaw(
ref EventDescriptor eventDescriptor,
IntPtr eventHandle,
/// Returns true if the eventSource has been enabled at all. This is the preferred test
/// to be performed before a relatively expensive EventSource operation.
/// </summary>
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
public bool IsEnabled()
{
return m_eventSourceEnabled;
/// positives (but is always accurate when returning false). EventSources are free to
/// have additional filtering.
/// </summary>
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
public bool IsEnabled(EventLevel level, EventKeywords keywords)
{
return IsEnabled(level, keywords, EventChannel.None);
/// positives (but is always accurate when returning false). EventSources are free to
/// have additional filtering.
/// </summary>
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
public bool IsEnabled(EventLevel level, EventKeywords keywords, EventChannel channel)
{
if (!m_eventSourceEnabled)
#pragma warning disable 1591
// optimized for common signatures (no args)
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId)
{
WriteEventCore(eventId, 0, null);
}
// optimized for common signatures (ints)
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, int arg1)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, int arg1, int arg2)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, int arg1, int arg2, int arg3)
{
if (m_eventSourceEnabled)
}
// optimized for common signatures (longs)
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, long arg1)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, long arg1, long arg2)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, long arg1, long arg2, long arg3)
{
if (m_eventSourceEnabled)
}
// optimized for common signatures (strings)
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, string? arg1)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, string? arg1, string? arg2)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3)
{
if (m_eventSourceEnabled)
}
// optimized for common signatures (string and ints)
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, string? arg1, int arg2)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, string? arg1, int arg2, int arg3)
{
if (m_eventSourceEnabled)
}
// optimized for common signatures (string and longs)
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, string? arg1, long arg2)
{
if (m_eventSourceEnabled)
}
// optimized for common signatures (long and string)
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, long arg1, string? arg2)
{
if (m_eventSourceEnabled)
}
// optimized for common signatures (int and string)
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, int arg1, string? arg2)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, byte[]? arg1)
{
if (m_eventSourceEnabled)
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, long arg1, byte[]? arg2)
{
if (m_eventSourceEnabled)
/// method signature. Even if you use this for rare events, this call should be guarded by an <see cref="IsEnabled()"/>
/// check so that the varargs call is not made when the EventSource is not active.
/// </summary>
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
protected unsafe void WriteEvent(int eventId, params object?[] args)
{
WriteEventVarargs(eventId, null, args);
/// "Log", such an exception would become a cached exception for the initialization of the static
/// member, and any future access to the "Log" would throw the cached exception).
/// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "guid")]
private unsafe void Initialize(Guid eventSourceGuid, string eventSourceName, string[]? traits)
{
try
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
private unsafe void WriteEventString(EventLevel level, long keywords, string msgString)
{
#if FEATURE_MANAGED_ETW
/// </summary>
/// <param name="method">The method to probe.</param>
/// <returns>The literal value or -1 if the value could not be determined. </returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Switch statement is clearer than alternatives")]
private static int GetHelperCallFirstArg(MethodInfo method)
{
#if (!ES_BUILD_PCL && !ES_BUILD_PN)
/// It will do this even if the EventSource is not enabled.
/// TODO remove flush parameter it is not used.
/// </summary>
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
internal void ReportOutOfBandMessage(string msg, bool flush)
{
try
/// call Dispose when they are done with their logging.
/// </summary>
#if ES_BUILD_STANDALONE
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
#endif
public virtual void Dispose()
{
/// <summary>
/// EventChannel. Custom values must be in the range from 16 through 255. Currently only predefined values allowed.
/// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32", Justification = "Backwards compatibility")]
public enum EventChannel : byte
{
/// <summary>
return -1;
}
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override int Read(char[] buffer, int index, int count)
{
return 0;
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Diagnostics.CodeAnalysis;
using System.Threading;
namespace System
internal ThreadLocal<object?> Data { get; private set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA1821", Justification = "Finalizer preserved for compat, it is suppressed by the constructor.")]
+ [SuppressMessage("Microsoft.Security", "CA1821", Justification = "Finalizer preserved for compat, it is suppressed by the constructor.")]
~LocalDataStoreSlot()
{
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
// Allow an object to free resources before the object is reclaimed by the GC.
// This method's virtual slot number is hardcoded in runtimes. Do not add any virtual methods ahead of this.
[NonVersionable]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")]
+ [SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")]
~Object()
{
}
/// Gets the strongly typed value associated with the <see cref = "StrongBox{T}"></see>
/// <remarks>This is explicitly exposed as a field instead of a property to enable loading the address of the field.</remarks>
/// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
[MaybeNull] public T Value = default!;
/// <summary>
**
===========================================================*/
+using System.Diagnostics.CodeAnalysis;
+
namespace System.Runtime.ConstrainedExecution
{
public abstract class CriticalFinalizerObject
{
}
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")]
+ [SuppressMessage("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")]
~CriticalFinalizerObject()
{
}
// manipulating _state.
/// <summary>Specifies the handle to be wrapped.</summary>
- [SuppressMessage("Microsoft.Security", "CA2111:PointersShouldNotBeVisible")]
protected IntPtr handle;
/// <summary>Combined ref count and closed/disposed flags (so we can atomically modify them).</summary>
private volatile int _state;
/// <summary>Gets the number of tasks waiting to run concurrently.</summary>
/// <remarks>This does not take the necessary lock, as it's only called from under the debugger.</remarks>
- [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
private int ConcurrentTaskCountForDebugger => m_concurrentTaskScheduler.m_tasks.Count;
/// <summary>Gets the number of tasks waiting to run exclusively.</summary>
/// <remarks>This does not take the necessary lock, as it's only called from under the debugger.</remarks>
- [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
private int ExclusiveTaskCountForDebugger => m_exclusiveTaskScheduler.m_tasks.Count;
/// <summary>Notifies the pair that new work has arrived to be processed.</summary>
/// <param name="fairly">Whether tasks should be scheduled fairly with regards to other tasks.</param>
/// <remarks>Must only be called while holding the lock.</remarks>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
- [SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals")]
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
private void ProcessAsyncIfNecessary(bool fairly = false)
{
ContractAssertMonitorStatus(ValueLock, held: true);
/// state in one of those conditions or if the user explicitly asks for
/// the Completion.
/// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
private sealed class CompletionState : Task
{
/// <summary>Whether the scheduler has had completion requested.</summary>
/// </summary>
/// <param name="task">The task to execute inline if possible.</param>
/// <returns>true if the task was inlined successfully; otherwise, false.</returns>
- [SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "ignored")]
private bool TryExecuteTaskInlineOnTargetScheduler(Task task)
{
// We'd like to simply call TryExecuteTaskInline here, but we can't.
protected override IEnumerable<Task> GetScheduledTasks() { return m_tasks; }
/// <summary>Gets the number of tasks queued to this scheduler.</summary>
- [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
private int CountForDebugger => m_tasks.Count;
/// <summary>Provides a debug view for ConcurrentExclusiveTaskScheduler.</summary>
}
}
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
public bool LocalFindAndPop(object obj)
{
// Fast path: check the tail. If equal, we can skip the lock.
public object? LocalPop() => m_headIndex < m_tailIndex ? LocalPopCore() : null;
- [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
private object? LocalPopCore()
{
while (true)