Skip to content

Commit c38f37a

Browse files
stephentoubCopilot
andauthored
Remove unnecessary volatile from fields in Libraries (#125274)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 388a7c4 commit c38f37a

95 files changed

Lines changed: 177 additions & 177 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/libraries/Common/src/Interop/Unix/System.Native/Interop.MemfdCreate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal static partial class Sys
1515
[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_IsMemfdSupported", SetLastError = true)]
1616
private static partial int MemfdSupportedImpl();
1717

18-
private static volatile NullableBool s_memfdSupported;
18+
private static NullableBool s_memfdSupported;
1919

2020
internal static bool IsMemfdSupported
2121
{

src/libraries/Common/src/System/Console/ConsoleUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace System
66
internal static partial class ConsoleUtils
77
{
88
/// <summary>Whether to output ansi color strings.</summary>
9-
private static volatile NullableBool s_emitAnsiColorCodes;
9+
private static NullableBool s_emitAnsiColorCodes;
1010

1111
/// <summary>Get whether to emit ANSI color codes.</summary>
1212
public static bool EmitAnsiColorCodes

src/libraries/Common/src/System/Security/Cryptography/Pkcs/Pkcs9ContentType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ public override void CopyFrom(AsnEncodedData asnEncodedData)
6262
return new Oid(contentTypeValue);
6363
}
6464

65-
private volatile Oid? _lazyContentType;
65+
private Oid? _lazyContentType;
6666
}
6767
}

src/libraries/Common/src/System/Security/Cryptography/Pkcs/Pkcs9DocumentDescription.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ private static byte[] Encode(string documentDescription)
8181
return PkcsHelpers.EncodeOctetString(octets);
8282
}
8383

84-
private volatile string? _lazyDocumentDescription;
84+
private string? _lazyDocumentDescription;
8585
}
8686
}

src/libraries/Common/src/System/Security/Cryptography/Pkcs/Pkcs9DocumentName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ private static byte[] Encode(string documentName)
8181
return PkcsHelpers.EncodeOctetString(octets);
8282
}
8383

84-
private volatile string? _lazyDocumentName;
84+
private string? _lazyDocumentName;
8585
}
8686
}

src/libraries/Common/src/System/Security/Cryptography/Pkcs/Pkcs9MessageDigest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ public override void CopyFrom(AsnEncodedData asnEncodedData)
6060
return PkcsHelpers.DecodeOctetString(rawData);
6161
}
6262

63-
private volatile byte[]? _lazyMessageDigest;
63+
private byte[]? _lazyMessageDigest;
6464
}
6565
}

src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/ApplicationCatalog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace System.ComponentModel.Composition.Hosting
1515
public partial class ApplicationCatalog : ComposablePartCatalog, ICompositionElement
1616
{
1717
private bool _isDisposed;
18-
private volatile AggregateCatalog? _innerCatalog;
18+
private AggregateCatalog? _innerCatalog;
1919
private readonly object _thisLock = new object();
2020
private readonly ICompositionElement? _definitionOrigin;
2121
private readonly ReflectionContext? _reflectionContext;

src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public class AssemblyCatalog : ComposablePartCatalog, ICompositionElement
2424
{
2525
private readonly object _thisLock = new object();
2626
private readonly ICompositionElement _definitionOrigin;
27-
private volatile Assembly _assembly;
28-
private volatile ComposablePartCatalog? _innerCatalog;
27+
private Assembly _assembly;
28+
private ComposablePartCatalog? _innerCatalog;
2929
private int _isDisposed;
3030

3131
private readonly ReflectionContext? _reflectionContext;

src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/TypeCatalog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class TypeCatalog : ComposablePartCatalog, ICompositionElement
2626
{
2727
private readonly object _thisLock = new object();
2828
private Type[]? _types;
29-
private volatile List<ComposablePartDefinition>? _parts;
29+
private List<ComposablePartDefinition>? _parts;
3030
private volatile bool _isDisposed;
3131
private readonly ICompositionElement _definitionOrigin;
3232
private readonly Lazy<Dictionary<string, List<ComposablePartDefinition>>> _contractPartIndex;

src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace System.ComponentModel.Composition.Primitives
2222
public abstract class ComposablePartCatalog : IEnumerable<ComposablePartDefinition>, IDisposable
2323
{
2424
private bool _isDisposed;
25-
private volatile IQueryable<ComposablePartDefinition>? _queryableParts;
25+
private IQueryable<ComposablePartDefinition>? _queryableParts;
2626

2727
internal static readonly List<Tuple<ComposablePartDefinition, ExportDefinition>> _EmptyExportsList = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
2828

0 commit comments

Comments
 (0)