960 references to CompareExchange
AnalyzerRunner (1)
AnalyzerRunnerMefHostServices.cs (1)
24Interlocked.CompareExchange(ref s_defaultServices, MefHostServices.Create(DefaultAssemblies), null);
Aspire.Hosting.Analyzers (1)
Infrastructure\WellKnownTypes.cs (1)
77Interlocked.CompareExchange(ref _lazyWellKnownTypes[index], result, null);
ClientSample (1)
Tcp\SocketAwaitable.cs (1)
51ReferenceEquals(Interlocked.CompareExchange(ref _callback, continuation, null), _callbackCompleted))
dotnet-svcutil-lib (8)
FrameworkFork\Microsoft.Xml\Xml\schema\FacetChecker.cs (1)
1362Interlocked.CompareExchange(ref s_languagePattern, langRegex, null);
FrameworkFork\Microsoft.Xml\Xml\schema\Preprocessor.cs (1)
488Interlocked.CompareExchange<XmlSchema>(ref s_builtInSchemaForXmlNS, tempSchema, null);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaSet.cs (1)
71Interlocked.CompareExchange<Object>(ref _internalSyncObject, o, null);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaValidator.cs (4)
2495Interlocked.CompareExchange<XmlSchemaAttribute>(ref s_xsiTypeSO, tempXsiTypeSO, null); 2503Interlocked.CompareExchange<XmlSchemaAttribute>(ref s_xsiNilSO, tempxsiNilSO, null); 2512Interlocked.CompareExchange<XmlSchemaAttribute>(ref s_xsiSLSO, tempxsiSLSO, null); 2521Interlocked.CompareExchange<XmlSchemaAttribute>(ref s_xsiNoNsSLSO, tempxsiNoNsSLSO, null);
FrameworkFork\Microsoft.Xml\Xml\XmlCharType.cs (1)
400Interlocked.CompareExchange<object>(ref s_Lock, o, null);
GenerateDocumentationAndConfigFiles (12)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
134Interlocked.CompareExchange(ref _semanticModelMap, updatedMap, originalMap);
InMemory.FunctionalTests (1)
TestTransport\InMemoryTransportConnection.cs (1)
66if (Interlocked.CompareExchange(ref _isClosed, true, false) == true)
Metrics (11)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
Metrics.Legacy (11)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
Microsoft.AspNetCore.App.Analyzers (1)
src\Shared\RoslynUtils\WellKnownTypes.cs (1)
82Interlocked.CompareExchange(ref _lazyWellKnownTypes[index], result, null);
Microsoft.AspNetCore.Components.WebAssembly (2)
.packages\microsoft.dotnet.hotreload.agent\10.0.100-preview.7.25330.103\contentFiles\cs\netstandard2.1\MetadataUpdateHandlerInvoker.cs (1)
105Interlocked.CompareExchange(ref _actions, GetUpdateHandlerActions(), null);
HotReload\WebAssemblyHotReload.cs (1)
74var existingAgent = Interlocked.CompareExchange(ref s_hotReloadAgent, agent, null);
Microsoft.AspNetCore.Cryptography.Internal (2)
UnsafeNativeMethods.cs (1)
445if (Interlocked.CompareExchange(ref safeLibraryHandle, newHandle, null) is not null)
WeakReferenceHelpers.cs (1)
44WeakReference<T>? currentWeakRef = Interlocked.CompareExchange(ref weakReference, newWeakRef, existingWeakRef);
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\XmlKeyManager.cs (1)
285return Interlocked.CompareExchange<CancellationTokenSource?>(ref _cacheExpirationTokenSource, null, null).Token;
Microsoft.AspNetCore.DataProtection.Extensions (1)
TimeLimitedDataProtector.cs (1)
43retVal = Interlocked.CompareExchange(ref _innerProtectorWithTimeLimitedPurpose, newValue, null) ?? newValue;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
src\Shared\RoslynUtils\WellKnownTypes.cs (1)
82Interlocked.CompareExchange(ref _lazyWellKnownTypes[index], result, null);
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
RedisOutputCacheStore.cs (1)
409ReleaseConnection(Interlocked.CompareExchange(ref _cache, null, cache));
Microsoft.AspNetCore.Routing (1)
EndpointRoutingMiddleware.cs (1)
254var initializationTask = Interlocked.CompareExchange(ref _initializationTask, initialization.Task, null);
Microsoft.AspNetCore.Server.HttpSys (1)
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
38Interlocked.CompareExchange(ref _extra, newDict, null);
Microsoft.AspNetCore.Server.IIS (3)
Core\IO\AsyncIOOperation.cs (2)
40var previousContinuation = Interlocked.CompareExchange(ref _continuation, continuation, null); 114var continuation = Interlocked.CompareExchange(ref _continuation, CallbackCompleted, null);
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
38Interlocked.CompareExchange(ref _extra, newDict, null);
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\Infrastructure\StreamCloseAwaitable.cs (1)
30ReferenceEquals(Interlocked.CompareExchange(ref _callback, continuation, null), _callbackCompleted))
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (2)
Internal\SocketAwaitableEventArgs.cs (2)
37if (c != null || (c = Interlocked.CompareExchange(ref _continuation, _continuationCompleted, null)) != null) 74var prevContinuation = Interlocked.CompareExchange(ref _continuation, continuation, null);
Microsoft.AspNetCore.Shared.Tests (1)
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
38Interlocked.CompareExchange(ref _extra, newDict, null);
Microsoft.AspNetCore.SignalR.Client.Core (1)
src\SignalR\common\Shared\TimerAwaitable.cs (1)
83ReferenceEquals(Interlocked.CompareExchange(ref _callback, continuation, null), _callbackCompleted))
Microsoft.Build (7)
Definition\ProjectCollection.cs (1)
437if (Interlocked.CompareExchange(ref s_globalProjectCollection, local, null) != null)
InterningBinaryReader.cs (1)
232Interlocked.CompareExchange(ref s_bufferPool, _buffer, null);
Logging\BaseConsoleLogger.cs (1)
1265StringBuilder previous = Interlocked.CompareExchange(ref _sharedStringBuilder, builder, null);
ObjectModelRemoting\LinkedObjectFactory.cs (4)
255Interlocked.CompareExchange(ref _immutableInstance, instance, null); 279Interlocked.CompareExchange(ref _immutableInstance, instance, null); 302Interlocked.CompareExchange(ref _immutableInstance, instance, null); 334Interlocked.CompareExchange(ref _immutableInstance, instance, null);
Microsoft.Build.Framework (4)
EnvironmentUtilities.cs (2)
73Interlocked.CompareExchange(ref s_processPath, currentProcess.MainModule.FileName ?? "", null); 91Interlocked.CompareExchange(ref s_processName, currentProcess.ProcessName, null);
ImmutableSegmentedDictionary`2+PrivateInterlocked.cs (1)
37var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
ImmutableSegmentedList`1+PrivateInterlocked.cs (1)
37var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
Microsoft.Build.Tasks.Core (2)
InterningBinaryReader.cs (1)
232Interlocked.CompareExchange(ref s_bufferPool, _buffer, null);
System.Design.cs (1)
109Interlocked.CompareExchange(ref s_loader, sr, null);
Microsoft.CodeAnalysis (56)
CodeGen\CompilationTestData.cs (1)
82Interlocked.CompareExchange(ref _lazyMethodsByName, methodsByName, null);
CodeGen\PrivateImplementationDetails.cs (2)
412Interlocked.CompareExchange(ref _mvidField, new ModuleVersionIdField(this, mvidType), null); 424Interlocked.CompareExchange(ref _moduleCancellationTokenField, new ModuleCancellationTokenField(this, cancellationTokenType), null);
Collections\CachingDictionary.cs (2)
158localMap = Interlocked.CompareExchange(ref _map, concurrentMap, null); 256var replacedMap = Interlocked.CompareExchange(ref _map, fullyPopulatedMap, currentMap);
Collections\SmallConcurrentSetOfInts.cs (1)
104nextSet = Interlocked.CompareExchange(ref set._next, tail, null);
Compilation\CommonModuleCompilationState.cs (1)
48Interlocked.CompareExchange(ref _lazyStateMachineTypes, new Dictionary<TMethodSymbol, TNamedTypeSymbol>(), null);
Diagnostic\CustomObsoleteDiagnosticInfo.cs (1)
47Interlocked.CompareExchange(ref _descriptor, CreateDescriptor(), null);
Diagnostic\DiagnosticBag.cs (1)
306return Interlocked.CompareExchange(ref _lazyBag, newBag, null) ?? newBag;
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
2424Interlocked.CompareExchange(ref _lazyCoreActions, createCoreActions(), null);
DiagnosticAnalyzer\AnalyzerExecutor.cs (1)
1552Interlocked.CompareExchange(ref _lazyControlFlowGraphMap, new ConcurrentDictionary<IOperation, ControlFlowGraph>(), null);
DiagnosticAnalyzer\AnalyzerFileReference.cs (1)
459Interlocked.CompareExchange(ref _lazyExtensionTypeNameMap, analyzerTypeNameMap, null);
DiagnosticAnalyzer\CompilationAnalysisValueProviderFactory.cs (1)
21Interlocked.CompareExchange(ref _lazySharedStateProviderMap, new Dictionary<object, object>(), null);
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (3)
231Interlocked.CompareExchange( 247Interlocked.CompareExchange( 269Interlocked.CompareExchange(ref _lazyGlobalSuppressions, suppressions, null);
Emit\CommonPEModuleBuilder.cs (7)
227if (Interlocked.CompareExchange(ref _lazyArrayMethods, result, null) != null) 886Interlocked.CompareExchange(ref NestedTypes, new ConcurrentQueue<Cci.INestedTypeDefinition>(), null); 978Interlocked.CompareExchange(ref defs.Methods, new ConcurrentQueue<Cci.IMethodDefinition>(), null); 991Interlocked.CompareExchange(ref defs.Properties, new ConcurrentQueue<Cci.IPropertyDefinition>(), null); 1004Interlocked.CompareExchange(ref defs.Fields, new ConcurrentQueue<Cci.IFieldDefinition>(), null); 1023Interlocked.CompareExchange(ref _lazySynthesizedNamespaceMembers, new ConcurrentDictionary<INamespaceSymbolInternal, ConcurrentQueue<INamespaceOrTypeSymbolInternal>>(), null); 1135if (Interlocked.CompareExchange(ref _lazyPrivateImplementationDetails, result, null) != null)
InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
MetadataReader\PEAssembly.cs (1)
185Interlocked.CompareExchange(ref _lazyInternalsVisibleToMap, BuildInternalsVisibleToMap(), null);
MetadataReader\PEModule.cs (3)
269Interlocked.CompareExchange(ref _lazyMetadataReader, newReader, null); 2663Interlocked.CompareExchange( 2671Interlocked.CompareExchange(
MetadataReference\AssemblyMetadata.cs (1)
345createdModulesUsed = Interlocked.CompareExchange(ref _lazyData, newData, null) == null;
MetadataReference\PortableExecutableReference.cs (1)
57Interlocked.CompareExchange(ref _lazyDocumentation, CreateDocumentationProvider(), null);
Operations\ControlFlowGraph.cs (4)
256Interlocked.CompareExchange(ref _lazyLocalFunctionsGraphs, new ControlFlowGraph[LocalFunctions.Length], null); 265Interlocked.CompareExchange(ref localFunctionGraph, graph, null); 303Interlocked.CompareExchange(ref _lazyAnonymousFunctionsGraphs, new ControlFlowGraph[_anonymousFunctionsMap.Count], null); 312Interlocked.CompareExchange(ref anonymousFlowGraph, graph, null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Symbols\Attributes\CustomAttributesBag.cs (2)
73var setOnOurThread = Interlocked.CompareExchange(ref _earlyDecodedWellKnownAttributeData, data, null) == null; 88var setOnOurThread = Interlocked.CompareExchange(ref _decodedWellKnownAttributeData, data, null) == null;
Symbols\Attributes\SecurityWellKnownAttributeData.cs (2)
37Interlocked.CompareExchange(ref _lazySecurityActions, new byte[totalSourceAttributes], null); 51Interlocked.CompareExchange(ref _lazyPathsForPermissionSetFixup, new string[totalSourceAttributes], null);
Syntax\SyntaxNode.cs (7)
146Interlocked.CompareExchange(ref field, green.CreateRed(this, this.GetChildPosition(slot)), null); 164Interlocked.CompareExchange(ref field, green.CreateRed(this, this.Position), null); 181Interlocked.CompareExchange(ref field, (T)green.CreateRed(this, this.GetChildPosition(slot)), null); 199Interlocked.CompareExchange(ref field, (T)green.CreateRed(this, this.Position), null); 222Interlocked.CompareExchange(ref element, green.CreateRed(this.Parent, this.GetChildPosition(slot)), null); 244Interlocked.CompareExchange(ref element, green.CreateRed(this.Parent, this.GetChildPosition(1)), null); 279if (Interlocked.CompareExchange(ref slot, newWeakReference, previousWeakReference) == previousWeakReference)
Text\SourceText.cs (2)
479Interlocked.CompareExchange(ref _lazyContainer, new StaticContainer(this), null); 942return info ?? Interlocked.CompareExchange(ref _lazyLineInfo, info = GetLinesCore(), null) ?? info;
Microsoft.CodeAnalysis.Analyzers (12)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
134Interlocked.CompareExchange(ref _semanticModelMap, updatedMap, originalMap);
Microsoft.CodeAnalysis.AnalyzerUtilities (12)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysisHelper.cs (1)
93Interlocked.CompareExchange(ref _lazyDisposableFieldsMap, new ConcurrentDictionary<INamedTypeSymbol, ImmutableHashSet<IFieldSymbol>>(), null);
Microsoft.CodeAnalysis.BannedApiAnalyzers (12)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
134Interlocked.CompareExchange(ref _semanticModelMap, updatedMap, originalMap);
Microsoft.CodeAnalysis.CodeStyle (11)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
134Interlocked.CompareExchange(ref _semanticModelMap, updatedMap, originalMap);
Microsoft.CodeAnalysis.Collections.Package (5)
Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Microsoft.CodeAnalysis.CSharp (181)
Binder\Binder.cs (2)
508Interlocked.CompareExchange(ref _lazyConversions, new Conversions(this), null); 522Interlocked.CompareExchange(ref _lazyOverloadResolution, new OverloadResolution(this), null);
Binder\LocalInProgressBinder.cs (1)
42Interlocked.CompareExchange(ref _localSymbol, local, null);
Binder\LockOrUsingBinder.cs (2)
71Interlocked.CompareExchange(ref _lazyLockedOrDisposedVariables, lockedOrDisposedVariables, null); 93Interlocked.CompareExchange(ref _lazyExpressionAndDiagnostics, new ExpressionAndDiagnostics(boundExpression, expressionDiagnostics.ToReadOnlyAndFree()), null);
Binder\Semantics\Conversions\ConversionsBase.cs (1)
58Interlocked.CompareExchange(ref _lazyOtherNullability, WithNullabilityCore(includeNullability), null);
Binder\SwitchBinder.cs (1)
69Interlocked.CompareExchange(ref _switchGoverningExpression, boundSwitchExpression, null);
Binder\WithExternAndUsingAliasesBinder.cs (2)
73Interlocked.CompareExchange(ref _lazyImportChain, BuildImportChain(), null); 155Interlocked.CompareExchange(ref _lazyUsingAliasesMap, _declaringSymbol.GetUsingAliasesMap(_declarationSyntax, basesBeingResolved), null);
Binder\WithUsingNamespacesAndTypesBinder.cs (2)
268Interlocked.CompareExchange(ref _lazyImportChain, importChain, null); 347Interlocked.CompareExchange(ref _lazyFullImports,
BoundTree\UnboundLambda.cs (1)
1189Interlocked.CompareExchange(ref _errorBinding, ReallyBindForErrorRecovery(), null);
Compilation\BuiltInOperators.cs (2)
241Interlocked.CompareExchange(ref _builtInUnaryOperators, allOperators, null); 672Interlocked.CompareExchange(ref _builtInOperators, allOperators, null);
Compilation\CSharpCompilation.cs (10)
87Interlocked.CompareExchange(ref _conversions, new BuckStopsHereBinder(this, associatedFileIdentifier: null).Conversions, null); 1429Interlocked.CompareExchange(ref _lazyGlobalNamespace, result, null); 1495Interlocked.CompareExchange(ref _externAliasTargets, new ConcurrentDictionary<string, NamespaceSymbol>(), null); 1540Interlocked.CompareExchange(ref _lazyScriptClass, BindScriptClass()!, ErrorTypeSymbol.UnknownResultType); 1805Interlocked.CompareExchange(ref _lazyHostObjectTypeSymbol, symbol, null); 1913Interlocked.CompareExchange(ref _lazyEntryPoint, entryPoint, null); 2594binderFactories = Interlocked.CompareExchange(ref cachedBinderFactories, binderFactories, null) ?? binderFactories; 2622if (Interlocked.CompareExchange(ref slot!, newWeakReference, previousWeakReference) == previousWeakReference) 2641if (_lazyCompilationUnitCompletedTrees == null) Interlocked.CompareExchange(ref _lazyCompilationUnitCompletedTrees, new HashSet<SyntaxTree>(), null); 3231var recent = Interlocked.CompareExchange(ref _usageOfUsingsRecordedInTrees, updated, current);
Compilation\SyntaxAndDeclarationManager.cs (1)
43Interlocked.CompareExchange(ref _lazyState, CreateState(this.ExternalSyntaxTrees, this.ScriptClassName, this.Resolver, this.MessageProvider, this.IsSubmission), null);
Compilation\SyntaxTreeSemanticModel.cs (1)
1227Interlocked.CompareExchange(ref _globalStatementLabels, new ScriptLocalScopeBinder.Labels(scriptInitializer, (CompilationUnitSyntax)parent), null);
Compiler\MethodCompiler.cs (1)
2135Interlocked.CompareExchange(ref inMethodBinder.IdentifierMap, identifierMap, null);
Declarations\DeclarationTable.Cache.cs (3)
45Interlocked.CompareExchange( 60Interlocked.CompareExchange(ref _typeNames, GetTypeNames(this.MergedRoot), comparand: null); 71Interlocked.CompareExchange(ref _namespaceNames, GetNamespaceNames(this.MergedRoot), comparand: null);
Declarations\DeclarationTable.cs (4)
109Interlocked.CompareExchange(ref _mergedRoot, CalculateMergedRoot(compilation), null); 247Interlocked.CompareExchange(ref _typeNames, GetMergedTypeNames(), comparand: null); 258Interlocked.CompareExchange(ref _namespaceNames, GetMergedNamespaceNames(), comparand: null); 269Interlocked.CompareExchange(ref _referenceDirectives, GetMergedReferenceDirectives(), comparand: null);
DocumentationComments\PEDocumentationCommentUtils.cs (1)
29Interlocked.CompareExchange(
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
27Interlocked.CompareExchange(ref lazyXmlText, xmlText, null);
Emitter\EditAndContinue\PEDeltaAssemblyBuilder.cs (1)
338Interlocked.CompareExchange(ref _lazyHotReloadExceptionType, symbol, comparand: null);
Emitter\Model\FunctionPointerTypeSymbolAdapter.cs (1)
32Interlocked.CompareExchange(ref _lazySignature, new FunctionPointerMethodSignature(AdaptedFunctionPointerTypeSymbol.Signature), null);
Emitter\Model\PEModuleBuilder.cs (2)
1467Interlocked.CompareExchange(ref _fixedImplementationTypes, new Dictionary<FieldSymbol, NamedTypeSymbol>(), null); 1855Interlocked.CompareExchange(
Emitter\NoPia\EmbeddedTypesManager.cs (1)
104if (Interlocked.CompareExchange(ref lazyMethod, symbol, ErrorMethodSymbol.UnknownMethod) == ErrorMethodSymbol.UnknownMethod)
FlowAnalysis\CSharpDataFlowAnalysis.cs (2)
85Interlocked.CompareExchange(ref _unassignedVariables, result, null); 366Interlocked.CompareExchange(ref _unassignedVariableAddressOfSyntaxes, result, null);
Parser\Directives.cs (1)
132=> Interlocked.CompareExchange(ref Unsafe.AsRef(in location._directives), value._directives, null);
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (1)
316return Interlocked.CompareExchange(ref _lazyAliasMap, map, null) ?? map;
Symbols\AliasSymbol.cs (1)
324if (Interlocked.CompareExchange(ref _aliasTarget, symbol, null) is null)
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (2)
126Interlocked.CompareExchange(ref _lazyAnonymousTypeTemplates, 148Interlocked.CompareExchange(ref _lazyAnonymousDelegates,
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TypeOrDelegateTemplateSymbol.cs (2)
82var oldValue = Interlocked.CompareExchange(ref _nameAndIndex, value, null); 108if (ReferenceEquals(Interlocked.CompareExchange(ref _smallestLocation, location, currentSmallestLocation), currentSmallestLocation))
Symbols\Attributes\PEAttributeData.cs (2)
93Interlocked.CompareExchange(ref _lazyAttributeConstructor, attributeConstructor, null); 94Interlocked.CompareExchange(ref _lazyAttributeClass, (NamedTypeSymbol?)attributeClass, ErrorTypeSymbol.UnknownResultType); // Serves as a flag, so do it last.
Symbols\Compilation_WellKnownMembers.cs (4)
95Interlocked.CompareExchange(ref _lazyWellKnownTypeMembers, wellKnownTypeMembers, null); 109Interlocked.CompareExchange(ref _lazyWellKnownTypeMembers[(int)member], result, ErrorTypeSymbol.UnknownResultType); 132Interlocked.CompareExchange(ref _lazyWellKnownTypes, new NamedTypeSymbol[(int)WellKnownTypes.Count], null); 178if (Interlocked.CompareExchange(ref _lazyWellKnownTypes[index], result, null) is object)
Symbols\Extensions\SourceExtensionImplementationMethodSymbol.cs (1)
101Interlocked.CompareExchange(ref lazyNullableContext, new StrongBox<byte?>(nullableContext), comparand: null);
Symbols\FunctionTypeSymbol.cs (1)
86var result = Interlocked.CompareExchange(ref _lazyDelegateType, delegateType, Uninitialized);
Symbols\Metadata\PE\PEFieldSymbol.cs (1)
342Interlocked.CompareExchange(ref _lazyType, new TypeWithAnnotations.Boxed(type), null);
Symbols\Metadata\PE\PEMethodSymbol.cs (1)
1410Interlocked.CompareExchange(ref AccessUncommonFields()._lazyExplicitClassOverride, uniqueClassOverride, null);
Symbols\Metadata\PE\PEModuleSymbol.cs (3)
558Interlocked.CompareExchange(ref _lazyEventRegistrationTokenSymbol, 575Interlocked.CompareExchange(ref _lazyEventRegistrationTokenTableSymbol, 592Interlocked.CompareExchange(ref _lazySystemTypeSymbol,
Symbols\Metadata\PE\PENamedTypeSymbol.cs (13)
107return Interlocked.CompareExchange(ref _lazyUncommonProperties, result, null) ?? result; 400Interlocked.CompareExchange(ref uncommon.LazyExtensionParameter, new StrongBox<ParameterSymbol?>(extensionParameter), null); 458Interlocked.CompareExchange(ref uncommon.LazyImplementationMap, new ConcurrentDictionary<MethodSymbol, MethodSymbol?>(ReferenceEqualityComparer.Instance), null); 672Interlocked.CompareExchange(ref _lazyBaseType, MakeAcyclicBaseType(), ErrorTypeSymbol.UnknownResultType); 720Interlocked.CompareExchange(ref _lazyDeclaredBaseType, baseType, ErrorTypeSymbol.UnknownResultType); 1043Interlocked.CompareExchange(ref _lazyMemberNames, CreateReadOnlyMemberNames(names), null); 1453Interlocked.CompareExchange(ref uncommon.lazyEnumUnderlyingType, underlyingType, null); 1656var exchangeResult = Interlocked.CompareExchange(ref _lazyMembersByName, membersDict, null); 2002Interlocked.CompareExchange(ref _lazyUncommonProperties, new UncommonProperties(), null); 2005Interlocked.CompareExchange(ref _lazyUncommonProperties.lazyExtensionInfo, new ExtensionInfo(markerHandle), null); 2477Interlocked.CompareExchange(ref uncommon.lazyDefaultMemberName, defaultMemberName ?? "", null); 2629Interlocked.CompareExchange(ref uncommon.lazyComImportCoClassType, coClassType, ErrorTypeSymbol.UnknownResultType); 2770Interlocked.CompareExchange(
Symbols\Metadata\PE\PENamespaceSymbol.cs (2)
270Interlocked.CompareExchange(ref this.lazyNamespaces, namespaces, null); 320Interlocked.CompareExchange(ref _lazyNoPiaLocalTypes, noPiaLocalTypes, null);
Symbols\Metadata\PE\PETypeParameterSymbol.cs (1)
694Interlocked.CompareExchange(ref _lazyBounds, bounds, TypeParameterBounds.Unset);
Symbols\MetadataOrSourceAssemblySymbol.cs (8)
90Interlocked.CompareExchange(ref _lazySpecialTypes, 94if ((object)Interlocked.CompareExchange(ref _lazySpecialTypes[(int)typeId], corType, null) != null) 141Interlocked.CompareExchange(ref _lazyNativeIntegerTypes, new NativeIntegerTypeSymbol[2], null); 153Interlocked.CompareExchange(ref _lazyNativeIntegerTypes[index], new NativeIntegerTypeSymbol(underlyingType), null); 201Interlocked.CompareExchange(ref _lazySpecialTypeMembers, specialTypeMembers, null); 213Interlocked.CompareExchange(ref _lazySpecialTypeMembers[(int)member], result, ErrorTypeSymbol.UnknownResultType); 273Interlocked.CompareExchange(ref _assembliesToWhichInternalAccessHasBeenAnalyzed, new ConcurrentDictionary<AssemblySymbol, IVTConclusion>(), null); 289Interlocked.CompareExchange(ref _lazyTypeConversions, new TypeConversions(this), null);
Symbols\MissingCorLibrarySymbol.cs (3)
48Interlocked.CompareExchange(ref _lazyTypeConversions, new TypeConversions(this), null); 71Interlocked.CompareExchange(ref _lazySpecialTypes, 79Interlocked.CompareExchange(ref _lazySpecialTypes[(int)type], corType, null);
Symbols\MissingMetadataTypeSymbol.cs (1)
277Interlocked.CompareExchange(ref _lazyContainingNamespace, container, null);
Symbols\NativeIntegerTypeSymbol.cs (1)
235Interlocked.CompareExchange(ref _lazyTypeMap, new NativeIntegerTypeMap(this), null);
Symbols\NonMissingAssemblySymbol.cs (1)
66Interlocked.CompareExchange(ref _globalNamespace, result, null);
Symbols\ParameterSignature.cs (1)
69Interlocked.CompareExchange(ref lazySignature, MakeParamTypesAndRefKinds(parameters), null);
Symbols\PublicModel\ArrayTypeSymbol.cs (1)
49Interlocked.CompareExchange(ref _lazyElementType, _underlying.ElementTypeWithAnnotations.GetPublicSymbol(), null);
Symbols\PublicModel\DiscardSymbol.cs (1)
29Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null);
Symbols\PublicModel\EventSymbol.cs (1)
31Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null);
Symbols\PublicModel\FieldSymbol.cs (1)
44Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null);
Symbols\PublicModel\LocalSymbol.cs (1)
31Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null);
Symbols\PublicModel\MethodSymbol.cs (2)
85Interlocked.CompareExchange(ref _lazyReturnType, _underlying.ReturnTypeWithAnnotations.GetPublicSymbol(), null); 179Interlocked.CompareExchange(ref _lazyReceiverType, _underlying.ReceiverType?.GetITypeSymbol(_underlying.ReceiverNullableAnnotation), null);
Symbols\PublicModel\ParameterSymbol.cs (1)
32Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null);
Symbols\PublicModel\PointerTypeSymbol.cs (1)
40Interlocked.CompareExchange(ref _lazyPointedAtType, _underlying.PointedAtTypeWithAnnotations.GetPublicSymbol(), null);
Symbols\PublicModel\PropertySymbol.cs (1)
37Interlocked.CompareExchange(ref _lazyType, _underlying.TypeWithAnnotations.GetPublicSymbol(), null);
Symbols\Retargeting\RetargetingMethodSymbol.cs (1)
135Interlocked.CompareExchange(ref _lazyReturnType,
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (3)
103Interlocked.CompareExchange(ref _lazyExtensionParameter, new StrongBox<ParameterSymbol>(extensionParameter), null); 329Interlocked.CompareExchange(ref _lazyBaseType, acyclicBase, ErrorTypeSymbol.UnknownResultType); 367Interlocked.CompareExchange(ref _lazyDeclaredBaseType, declaredBase, ErrorTypeSymbol.UnknownResultType);
Symbols\Retargeting\RetargetingParameterSymbol.cs (1)
46Interlocked.CompareExchange(ref _lazyTypeWithAnnotations,
Symbols\Retargeting\RetargetingPropertySymbol.cs (1)
74Interlocked.CompareExchange(ref _lazyType, new TypeWithAnnotations.Boxed(type), null);
Symbols\Source\GlobalExpressionVariable.cs (1)
139if (Interlocked.CompareExchange(ref _lazyType, new TypeWithAnnotations.Boxed(type), null) == null)
Symbols\Source\IndexedTypeParameterSymbol.cs (1)
71Interlocked.CompareExchange(ref s_parameterPool, newPool, initialPool);
Symbols\Source\LocalFunctionOrSourceMemberMethodSymbol.cs (1)
36Interlocked.CompareExchange(ref _lazyIteratorElementType, new TypeWithAnnotations.Boxed(elementType), TypeWithAnnotations.Boxed.Sentinel);
Symbols\Source\LocalFunctionSymbol.cs (1)
307Interlocked.CompareExchange(ref _lazyReturnType, new TypeWithAnnotations.Boxed(returnType), null);
Symbols\Source\QuickAttributeChecker.cs (1)
39Interlocked.CompareExchange(ref _lazyPredefinedQuickAttributeChecker, CreatePredefinedQuickAttributeChecker(), null);
Symbols\Source\SourceAssemblySymbol.cs (3)
199Interlocked.CompareExchange(ref lazyAssemblyIdentity, ComputeIdentity(), null); 2164Interlocked.CompareExchange(ref _optimisticallyGrantedInternalsAccess, new ConcurrentDictionary<AssemblySymbol, bool>(), null); 2306Interlocked.CompareExchange(ref lazyInternalsVisibleToMap,
Symbols\Source\SourceEventSymbol.cs (2)
219bagCreatedOnThisThread = Interlocked.CompareExchange(ref _lazyCustomAttributesBag, bag, null) == null; 717Interlocked.CompareExchange(ref _lazyOverriddenOrHiddenMembers, this.MakeOverriddenOrHiddenMembers(), null);
Symbols\Source\SourceLocalSymbol.cs (2)
402Interlocked.CompareExchange(ref _type, new TypeWithAnnotations.Boxed(newType), null); 589Interlocked.CompareExchange(ref _constantTuple, new EvaluatedConstant(value, diagnostics.ToReadOnlyAndFree()), null);
Symbols\Source\SourceMemberContainerSymbol.cs (5)
1313if (Interlocked.CompareExchange(ref _lazyTypeMembers, MakeTypeMembers(diagnostics), null) == null) 1608Interlocked.CompareExchange(ref _lazyEarlyAttributeDecodingMembersDictionary, membersByName, null); 1669var alreadyKnown = Interlocked.CompareExchange(ref _lazyMembersAndInitializers, membersAndInitializers, null); 1782if (Interlocked.CompareExchange(ref _lazyMembersDictionary, membersDictionary, null) == null) 3537var alreadyKnown = Interlocked.CompareExchange(ref _lazyDeclaredMembersAndInitializers, declaredMembersAndInitializers, DeclaredMembersAndInitializers.UninitializedSentinel);
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (1)
52if (Interlocked.CompareExchange(
Symbols\Source\SourceMemberFieldSymbol.cs (1)
600if (Interlocked.CompareExchange(ref _lazyTypeAndRefKind, new TypeAndRefKind(refKind, type.WithModifiers(this.RequiredCustomModifiers)), null) == null)
Symbols\Source\SourceMemberMethodSymbol.cs (2)
850Interlocked.CompareExchange(ref _lazyThisParameter, new ThisParameterSymbol(this), null); 871Interlocked.CompareExchange(ref _lazyOverriddenOrHiddenMembers, this.MakeOverriddenOrHiddenMembers(), null);
Symbols\Source\SourceModuleSymbol.cs (1)
203if (Interlocked.CompareExchange(ref _globalNamespace, globalNS, null) == null)
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (2)
51if (ReferenceEquals(Interlocked.CompareExchange(ref _lazyBaseType, acyclicBase, ErrorTypeSymbol.UnknownResultType), ErrorTypeSymbol.UnknownResultType)) 260if (Interlocked.CompareExchange(ref _lazyDeclaredBases, MakeDeclaredBases(basesBeingResolved, diagnostics), null) == null)
Symbols\Source\SourceNamedTypeSymbol_Enum.cs (2)
31if ((object)Interlocked.CompareExchange(ref _lazyEnumUnderlyingType, this.GetEnumUnderlyingType(diagnostics), ErrorTypeSymbol.UnknownResultType) == 97Interlocked.CompareExchange(ref _lazyEnumValueField, new SynthesizedEnumValueFieldSymbol(this), null);
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (5)
79Interlocked.CompareExchange(ref _lazyExtensionInfo.LazyExtensionParameter, new ReceiverParameterSymbol(this, parameter), null); 101Interlocked.CompareExchange(ref _lazyExtensionInfo, new ExtensionInfo(), null); 112Interlocked.CompareExchange(ref _lazyExtensionInfo.LazyImplementationMap, builder.ToImmutable(), null); 130Interlocked.CompareExchange(ref _lazyExtensionInfo, new ExtensionInfo(), null); 135Interlocked.CompareExchange(ref _lazyExtensionInfo.LazyExtensionMarker, tryCreateExtensionMarker(), ErrorMethodSymbol.UnknownMethod);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (5)
377Interlocked.CompareExchange(ref _lazyMergedGlobalAliasesAndUsings, 456Interlocked.CompareExchange( 610Interlocked.CompareExchange(ref usings, result, null); 902Interlocked.CompareExchange(ref _lazyImports, 1138Interlocked.CompareExchange(ref _lazyImports,
Symbols\Source\SourceNamespaceSymbol.cs (1)
229if (Interlocked.CompareExchange(ref _nameToMembersMap, MakeNameToMembersMap(diagnostics), null) == null)
Symbols\Source\SourcePropertySymbolBase.cs (5)
785Interlocked.CompareExchange(ref _lazyMergedBackingField, new StrongBox<SynthesizedBackingFieldSymbol?>(backingField), null); 798Interlocked.CompareExchange(ref _lazyDeclaredBackingField, CreateBackingField(), null); 806Interlocked.CompareExchange(ref _lazyMergedBackingField, new StrongBox<SynthesizedBackingFieldSymbol?>(backingField), null); 1217Interlocked.CompareExchange(ref _lazyOverriddenOrHiddenMembers, this.MakeOverriddenOrHiddenMembers(), null); 1243Interlocked.CompareExchange(ref _lazySynthesizedSealedAccessor, MakeSynthesizedSealedAccessor(), null);
Symbols\Source\SourceTypeParameterSymbol.cs (3)
232if (ReferenceEquals(Interlocked.CompareExchange(ref _lazyBounds, bounds, TypeParameterBounds.Unset), TypeParameterBounds.Unset)) 832Interlocked.CompareExchange(ref _lazyTypeMap, typeMap, null); 846Interlocked.CompareExchange(ref _lazyOverriddenMethod, this.GetOverriddenMethod(_overridingMethod), ErrorMethodSymbol.UnknownMethod);
Symbols\SubstitutedEventSymbol.cs (2)
31Interlocked.CompareExchange(ref _lazyType, new TypeWithAnnotations.Boxed(type), null); 122Interlocked.CompareExchange(ref _lazyOverriddenOrHiddenMembers, this.MakeOverriddenOrHiddenMembers(), null);
Symbols\SubstitutedFieldSymbol.cs (1)
32Interlocked.CompareExchange(ref _lazyType, new TypeWithAnnotations.Boxed(type), null);
Symbols\SubstitutedMethodSymbol.cs (3)
114var prevMap = Interlocked.CompareExchange(ref _lazyMap, newMap, null); 235Interlocked.CompareExchange(ref _lazyReturnType, new TypeWithAnnotations.Boxed(returnType), null); 296Interlocked.CompareExchange(ref _lazyOverriddenOrHiddenMembers, this.MakeOverriddenOrHiddenMembers(), null);
Symbols\SubstitutedNamedTypeSymbol.cs (3)
114var prevMap = Interlocked.CompareExchange(ref _lazyMap, newMap, null); 171Interlocked.CompareExchange(ref _lazyBaseType, baseType, ErrorTypeSymbol.UnknownResultType); 502Interlocked.CompareExchange(ref _lazyExtensionParameter, new StrongBox<ParameterSymbol?>(substituteParameter()), null);
Symbols\SubstitutedPropertySymbol.cs (2)
32Interlocked.CompareExchange(ref _lazyType, new TypeWithAnnotations.Boxed(type), null); 140Interlocked.CompareExchange(ref _lazyOverriddenOrHiddenMembers, this.MakeOverriddenOrHiddenMembers(), null);
Symbols\Symbol.cs (1)
1830Interlocked.CompareExchange(ref _lazyISymbol, CreateISymbol(), null);
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
137Interlocked.CompareExchange(ref _capturedParameters, Binder.CapturedParametersFinder.GetCapturedParameters(this), null);
Symbols\Synthesized\SynthesizedMethodSymbol.cs (1)
57Interlocked.CompareExchange(ref _lazyThisParameter, new ThisParameterSymbol(this), null);
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (1)
247if (Interlocked.CompareExchange(ref weakBinder, new WeakReference<ExecutableCodeBinder>(newBinder), previousWeakReference) == previousWeakReference)
Symbols\Tuples\TupleTypeSymbol.cs (1)
542Interlocked.CompareExchange(ref _lazyTupleData, new TupleExtraData(this), null);
Symbols\TypeSymbol.cs (4)
74return Interlocked.CompareExchange(ref _implementationForInterfaceMemberMap, map, null) ?? map; 116return Interlocked.CompareExchange(ref _lazyInterfaceInfo, info, null) ?? info; 2337Interlocked.CompareExchange(ref info.synthesizedMethodImplMap, makeSynthesizedMethodImplMap(), null); 2402Interlocked.CompareExchange(ref _lazyAbstractMembers, ComputeAbstractMembers(), null);
Syntax\CSharpSyntaxNode.cs (1)
75Interlocked.CompareExchange(ref node._syntaxTree, CSharpSyntaxTree.CreateWithoutClone(node, CSharpParseOptions.Default), null);
Syntax\CSharpSyntaxTree.cs (2)
632Interlocked.CompareExchange(ref _lazyLineDirectiveMap, new CSharpLineDirectiveMap(this), null); 708Interlocked.CompareExchange(ref _lazyPragmaWarningStateMap, new CSharpPragmaWarningStateMap(this), null);
Syntax\CSharpSyntaxTree.LazySyntaxTree.cs (1)
73Interlocked.CompareExchange(ref _lazyRoot, root, null);
Syntax\CSharpSyntaxTree.ParsedSyntaxTree.cs (1)
66Interlocked.CompareExchange(ref _lazyText, this.GetRoot(cancellationToken).GetText(_encodingOpt, _checksumAlgorithm), null);
Syntax\SyntaxTokenParser.cs (1)
36var lexer = Interlocked.CompareExchange(ref _lexer!, null, _lexer);
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (1)
39Interlocked.CompareExchange(ref _spans, ImmutableArray.CreateBuilder<TextSpan>(), null);
Microsoft.CodeAnalysis.CSharp.Features (2)
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (1)
67Interlocked.CompareExchange(ref _diagnostics, ImmutableArray.CreateBuilder<Diagnostic>(), null);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (1)
39Interlocked.CompareExchange(ref _spans, ImmutableArray.CreateBuilder<TextSpan>(), null);
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.ParsedSyntaxTree.cs (1)
49Interlocked.CompareExchange(ref _lazyText, GetRoot(cancellationToken).GetText(Encoding, _checksumAlgorithm), null);
Microsoft.CodeAnalysis.Debugging.Package (2)
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Microsoft.CodeAnalysis.EditorFeatures (2)
EditAndContinue\ActiveStatementTrackingService.cs (1)
72if (Interlocked.CompareExchange(ref _session, newSession, null) != null)
Tagging\AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs (1)
257if (oldTagTrees != Interlocked.CompareExchange(ref _cachedTagTrees_mayChangeFromAnyThread, newTagTrees, oldTagTrees))
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (2)
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (3)
Debugger\Engine\DkmClrType.cs (1)
131Interlocked.CompareExchange(ref _lazyGenericArguments, genericArgs, null);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Microsoft.CodeAnalysis.Extensions.Package (5)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Microsoft.CodeAnalysis.Features (4)
CodeFixes\Service\CodeFixService.cs (2)
372Interlocked.CompareExchange(ref _lazyWorkspaceFixersMap, workspaceFixersMap, null); 398Interlocked.CompareExchange(ref _lazyFixerPriorityMap, fixersPriorityByLanguageMap, null);
Completion\CompletionDescription.cs (1)
68Interlocked.CompareExchange(ref _text, string.Concat(TaggedParts.Select(p => p.Text)), null);
QuickInfo\QuickInfoSection.cs (1)
57Interlocked.CompareExchange(ref _text, string.Concat(TaggedParts.Select(t => t.Text)), null);
Microsoft.CodeAnalysis.InteractiveHost (7)
Interactive\Core\InteractiveHost.cs (1)
239var previousService = Interlocked.CompareExchange(ref _lazyRemoteService, newService, currentRemoteService);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (12)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
134Interlocked.CompareExchange(ref _semanticModelMap, updatedMap, originalMap);
Microsoft.CodeAnalysis.PooledObjects.Package (2)
ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Microsoft.CodeAnalysis.PublicApiAnalyzers (11)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Host\RemoteServiceBrokerProvider.cs (1)
27Interlocked.CompareExchange(ref s_instance, serviceBroker, null);
Microsoft.CodeAnalysis.ResxSourceGenerator (11)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
Microsoft.CodeAnalysis.Scripting (2)
Script.cs (2)
149Interlocked.CompareExchange(ref _lazyCompilation, compilation, null); 391Interlocked.CompareExchange(ref _lazyExecutor, Builder.CreateExecutor<T>(Compiler, GetCompilation(), Options.EmitDebugInformation, cancellationToken), null);
Microsoft.CodeAnalysis.Test.Utilities (4)
Metadata\ILValidation.cs (4)
200Interlocked.CompareExchange( 216Interlocked.CompareExchange( 231Interlocked.CompareExchange( 251Interlocked.CompareExchange(
Microsoft.CodeAnalysis.Threading.Package (6)
CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Microsoft.CodeAnalysis.VisualBasic (69)
Binding\BlockBaseBinder.vb (1)
39Interlocked.CompareExchange(Me._lazyLocalsMap, BuildMap(Me.Locals), Nothing)
Binding\DescendantBinderFactory.vb (2)
87Interlocked.CompareExchange(_lazyNodeToBinderMap, builder.NodeToBinderMap, Nothing) 88Interlocked.CompareExchange(_lazyStmtListToBinderMap, builder.StmtListToBinderMap, Nothing)
Declarations\DeclarationTable.vb (1)
153Interlocked.CompareExchange(_mergedRoot, CalculateMergedRoot(compilation), Nothing)
Declarations\MergedTypeDeclaration.vb (1)
165Interlocked.CompareExchange(Me._children, MakeChildren(), Nothing)
DocumentationComments\SourceDocumentationCommentUtils.vb (1)
20Interlocked.CompareExchange(lazyXmlText, xmlText, Nothing)
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousTypeOrDelegateTemplateSymbol.vb (2)
305Dim oldValue = Interlocked.CompareExchange(Me._nameAndIndex, value, Nothing) 363If Interlocked.CompareExchange(Me._adjustedPropertyNames, newAdjustedNames, currentAdjustedNames) Is currentAdjustedNames Then
Symbols\Attributes\PEAttributeData.vb (5)
134Interlocked.CompareExchange(Of KeyValuePair(Of String, TypedConstant)())( 139Interlocked.CompareExchange(Of TypedConstant())( 155Interlocked.CompareExchange(Of NamedTypeSymbol)( 170Interlocked.CompareExchange(Of MethodSymbol)( 175Interlocked.CompareExchange(Of NamedTypeSymbol)(
Symbols\EmbeddedSymbols\EmbeddedSymbolManager.vb (3)
57Interlocked.CompareExchange(s_embeddedSyntax, ParseResourceText(EmbeddedResources.Embedded), Nothing) 72Interlocked.CompareExchange(s_vbCoreSyntax, ParseResourceText(EmbeddedResources.VbCoreSourceText), Nothing) 84Interlocked.CompareExchange(s_internalXmlHelperSyntax, ParseResourceText(EmbeddedResources.InternalXmlHelper), Nothing)
Symbols\IndexedTypeParameterSymbol.vb (1)
57Interlocked.CompareExchange(s_parameterPool, newPool, initialPool)
Symbols\Metadata\PE\PEFieldSymbol.vb (1)
381Interlocked.CompareExchange(_lazyType, type, Nothing)
Symbols\Metadata\PE\PENamedTypeSymbol.vb (2)
1075Interlocked.CompareExchange(_lazyCoClassType, 1103Interlocked.CompareExchange(_lazyDefaultPropertyName, If(memberName, String.Empty), Nothing)
Symbols\Metadata\PE\PENamespaceSymbol.vb (3)
222Interlocked.CompareExchange(m_lazyMembers, members, Nothing) 273Interlocked.CompareExchange(_lazyNoPiaLocalTypes, noPiaLocalTypes, Nothing) 276If Interlocked.CompareExchange(m_lazyTypes, typesDict, Nothing) Is Nothing Then
Symbols\Metadata\PE\PEPropertySymbol.vb (1)
233Interlocked.CompareExchange(_lazyOverloadResolutionPriority, New StrongBox(Of Integer)(priority), Nothing)
Symbols\MetadataOrSourceAssemblySymbol.vb (1)
172Interlocked.CompareExchange(_assembliesToWhichInternalAccessHasBeenAnalyzed, New ConcurrentDictionary(Of AssemblySymbol, IVTConclusion), Nothing)
Symbols\MissingMetadataTypeSymbol.vb (1)
174Interlocked.CompareExchange(_lazyContainingNamespace, container, Nothing)
Symbols\NamedTypeSymbol.vb (1)
770Interlocked.CompareExchange(variable, value, comparand)
Symbols\NonMissingAssemblySymbol.vb (1)
57Interlocked.CompareExchange(_lazyGlobalNamespace, MergedNamespaceSymbol.CreateGlobalNamespace(Me), Nothing)
Symbols\ReducedExtensionMethodSymbol.vb (2)
398Interlocked.CompareExchange(_lazyReturnType, type, Nothing) 867Interlocked.CompareExchange(_lazyType, paramType, Nothing)
Symbols\Retargeting\RetargetingNamedTypeSymbol.vb (1)
170Interlocked.CompareExchange(_lazyCoClass, coClass, DirectCast(ErrorTypeSymbol.UnknownResultType, TypeSymbol))
Symbols\Source\LocalSymbol.vb (2)
126Interlocked.CompareExchange(_lazyType, ComputeType(), Nothing) 154Interlocked.CompareExchange(_lazyType, type, Nothing)
Symbols\Source\SourceAssemblySymbol.vb (2)
142Interlocked.CompareExchange(m_lazyIdentity, ComputeIdentity(), Nothing) 1651Interlocked.CompareExchange(_optimisticallyGrantedInternalsAccess, New ConcurrentDictionary(Of AssemblySymbol, Boolean), Nothing)
Symbols\Source\SourceDeclareMethodSymbol.vb (1)
68Dim old = Interlocked.CompareExchange(_lazyMetadataName, metadataName, Nothing)
Symbols\Source\SourceFile.vb (1)
100Interlocked.CompareExchange(_lazyQuickAttributeChecker, CreateQuickAttributeChecker(), Nothing)
Symbols\Source\SourceMemberFieldSymbol.vb (1)
68Interlocked.CompareExchange(Of ParameterSymbol)(_lazyMeParameter, New MeParameterSymbol(Me), Nothing)
Symbols\Source\SourceMemberMethodSymbol.vb (1)
125Dim old = Interlocked.CompareExchange(_lazyMetadataName, metadataName, Nothing)
Symbols\Source\SourceMethodSymbol.vb (2)
2182Interlocked.CompareExchange(_lazyOverriddenMethods, overriddenMembers, Nothing) 2184Interlocked.CompareExchange(_lazyReturnType, retType, Nothing)
Symbols\Source\SourceModuleSymbol.vb (5)
187Interlocked.CompareExchange(_lazyGlobalNamespace, globalNS, Nothing) 262Interlocked.CompareExchange(_lazyQuickAttributeChecker, CreateQuickAttributeChecker(), Nothing) 353If Interlocked.CompareExchange(_lazyBoundImports, BindImports(cancellationToken), Nothing) Is Nothing Then 828Return Interlocked.CompareExchange(variable, value, comparand) Is comparand AndAlso comparand Is Nothing 834stored = Interlocked.CompareExchange(variable, value, comparand) Is comparand
Symbols\Source\SourceNamedTypeSymbol.vb (5)
1807If Interlocked.CompareExchange(Me._lazyEnumUnderlyingType, underlyingType, Nothing) Is Nothing Then 1986Interlocked.CompareExchange(_lazyCoClassType, Nothing, DirectCast(ErrorTypeSymbol.UnknownResultType, TypeSymbol)) 1992Interlocked.CompareExchange(_lazyCoClassType, Nothing, 2277Interlocked.CompareExchange(Me._lazyCoClassType, 2647Interlocked.CompareExchange(Me._lazyWithEventsOverrides,
Symbols\Source\SourcePropertyAccessorSymbol.vb (2)
158Interlocked.CompareExchange(_lazyMetadataName, overriddenMethod.MetadataName, Nothing) 160Interlocked.CompareExchange(_lazyMetadataName, _name, Nothing)
Symbols\Source\SourcePropertySymbol.vb (4)
425Dim old = Interlocked.CompareExchange(_lazyMetadataName, metadataName, Nothing) 842Interlocked.CompareExchange(_lazyOverriddenProperties, overriddenMembers, Nothing) 844Interlocked.CompareExchange(_lazyType, retType, Nothing) 904Interlocked.CompareExchange(Of ParameterSymbol)(_lazyMeParameter, New MeParameterSymbol(Me), Nothing)
Symbols\SpecialMembers.vb (1)
63Interlocked.CompareExchange(_lazySpecialTypeMembers, specialTypeMembers, Nothing)
Symbols\SubstitutedEventSymbol.vb (2)
69Interlocked.CompareExchange(Me._lazyType, 216Interlocked.CompareExchange(Me._lazyOverriddenOrHiddenMembers,
Symbols\SynthesizedSymbols\SynthesizedAccessor.vb (1)
34Interlocked.CompareExchange(_lazyMetadataName, GenerateMetadataName(), Nothing)
Symbols\TypeSymbol.vb (1)
677Return If(Interlocked.CompareExchange(_lazyImplementationForInterfaceMemberMap, map, Nothing), map)
Symbols\UnboundGenericType.vb (3)
409Interlocked.CompareExchange(_lazyContainingSymbol, result, Nothing) 431Interlocked.CompareExchange(_lazyConstructedFrom, result, Nothing) 491Interlocked.CompareExchange(_lazyTypeSubstitution, result, Nothing)
Symbols\WellKnownMembers.vb (1)
322Interlocked.CompareExchange(_lazyWellKnownTypeMembers, wellKnownTypeMembers, Nothing)
Syntax\VisualBasicSyntaxTree.LazySyntaxTree.vb (1)
78Interlocked.CompareExchange(_lazyRoot, root, Nothing)
Syntax\VisualBasicSyntaxTree.ParsedSyntaxTree.vb (1)
78Interlocked.CompareExchange(_lazyText, treeText, Nothing)
Syntax\VisualBasicSyntaxTree.vb (1)
579Interlocked.CompareExchange(_lazySymbolsMap, ConditionalSymbolsMap.Create(Me.GetRoot(CancellationToken.None), Options), ConditionalSymbolsMap.Uninitialized)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.vb (1)
121Interlocked.CompareExchange(Me._lineContinuations(indentation), triviaInfo, Nothing)
Microsoft.CodeAnalysis.VisualBasic.Features (1)
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.vb (1)
63Interlocked.CompareExchange(_diagnostics, ImmutableArray.CreateBuilder(Of Diagnostic)(), Nothing)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.vb (1)
121Interlocked.CompareExchange(Me._lineContinuations(indentation), triviaInfo, Nothing)
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.ParsedSyntaxTree.vb (1)
44Interlocked.CompareExchange(_lazyText, GetRoot(cancellationToken).GetText(Encoding, _checksumAlgorithm), Nothing)
Microsoft.CodeAnalysis.Workspaces (28)
FindSymbols\FindReferences\FindReferenceCache.cs (1)
101Interlocked.CompareExchange(ref _aliasNameSet, set, null);
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
134Interlocked.CompareExchange(ref _semanticModelMap, updatedMap, originalMap);
Workspace\Host\Mef\MefHostServices.cs (1)
84Interlocked.CompareExchange(ref s_defaultHost, host, null);
Workspace\Host\TemporaryStorage\LegacyTemporaryStorageService.cs (3)
62var existingValue = Interlocked.CompareExchange(ref _stream, newStream, null); 77var existingValue = Interlocked.CompareExchange(ref _stream, newStream, null); 103var existingValue = Interlocked.CompareExchange(ref _sourceText, text, null);
Workspace\Solution\Document.cs (4)
96Interlocked.CompareExchange(ref _syntaxTreeResultTask, result, null); 188Interlocked.CompareExchange(ref _syntaxTreeResultTask, Task.FromResult(tree), null); 357var original = Interlocked.CompareExchange(ref disableNullableAnalysis ? ref _nullableDisabledModel : ref _model, new WeakReference<SemanticModel>(result), null); 609Interlocked.CompareExchange(ref _cachedOptions, newAsyncLazy, comparand: null);
Workspace\Solution\Project.cs (1)
264Interlocked.CompareExchange(ref idMap, new Dictionary<DocumentId, TDocument>(), null);
Workspace\Solution\ProjectState.cs (2)
161Interlocked.CompareExchange( 177Interlocked.CompareExchange(
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (2)
1027Interlocked.CompareExchange( 1066Interlocked.CompareExchange(
Workspace\Solution\SolutionCompilationState.WithFrozenSourceGeneratedDocumentsCompilationTracker.cs (1)
148Interlocked.CompareExchange(ref _compilationWithReplacements, newCompilation, null);
Workspace\Solution\VersionSource\RecoverableTextAndVersion.cs (1)
198Interlocked.CompareExchange(ref _storageHandle, handle, null);
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (10)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (4)
MEF\ExportProviderCache.cs (3)
142var expectedCatalog = Interlocked.CompareExchange(ref _scope.ExpectedCatalog, _catalog, null) ?? _catalog; 178expected = Interlocked.CompareExchange(ref _scope.ExpectedProviderForCatalog, expected, null) ?? expected; 179Interlocked.CompareExchange(ref _scope.CurrentExportProvider, expected, null);
MEF\UseExportProviderAttribute.cs (1)
195Interlocked.CompareExchange(
Microsoft.Extensions.Caching.Hybrid (1)
Internal\RecyclableArrayBufferWriter.cs (1)
70if (Interlocked.CompareExchange(ref _spare, this, null) != null)
Microsoft.Extensions.Caching.Memory (1)
CacheEntry.cs (1)
320return Interlocked.CompareExchange(ref _tokens, result, null) ?? result;
Microsoft.Extensions.Caching.StackExchangeRedis (1)
RedisCache.cs (1)
676var tmp = Interlocked.CompareExchange(ref _cache, null, cache);
Microsoft.Extensions.Diagnostics.Testing (1)
Metrics\MetricCollector.cs (1)
278if (Interlocked.CompareExchange(ref _instrument, instrument, null) is null)
Microsoft.Extensions.ObjectPool (2)
DefaultObjectPool.cs (2)
51if (item == null || Interlocked.CompareExchange(ref _fastItem, null, item) != item) 84if (_fastItem != null || Interlocked.CompareExchange(ref _fastItem, obj, null) != null)
Microsoft.Extensions.Primitives (1)
ChangeToken.cs (1)
125IDisposable? previous = Interlocked.CompareExchange(ref _disposable, disposable, current);
Microsoft.Extensions.ServiceDiscovery (2)
Http\HttpServiceEndpointResolver.cs (1)
234Interlocked.CompareExchange(ref _onDisposed, new(TaskCreationOptions.RunContinuationsAsynchronously), null);
ServiceEndpointResolver.cs (1)
226Interlocked.CompareExchange(ref _onDisposed, new(TaskCreationOptions.RunContinuationsAsynchronously), null);
Microsoft.Extensions.Validation.ValidationsGenerator (1)
src\Shared\RoslynUtils\WellKnownTypes.cs (1)
82Interlocked.CompareExchange(ref _lazyWellKnownTypes[index], result, null);
Microsoft.Maui.Controls (1)
ImageSource.cs (1)
58 TaskCompletionSource<bool> original = Interlocked.CompareExchange(ref _completionSource, new TaskCompletionSource<bool>(), null);
Microsoft.ML.CodeAnalyzer.Tests (1)
Helpers\TestUtils.cs (1)
22Interlocked.CompareExchange(ref source, loadedSource, null);
Microsoft.ML.Core (6)
Data\AnnotationUtils.cs (1)
170Interlocked.CompareExchange(ref _scoreColumnSetIdType, new KeyDataViewType(typeof(uint), int.MaxValue), null) ??
Utilities\CharUtils.cs (2)
22Interlocked.CompareExchange(ref _lowerInvariantChars, lower, null); 31Interlocked.CompareExchange(ref _upperInvariantChars, upper, null);
Utilities\PathUtils.cs (1)
30Interlocked.CompareExchange(ref _dllDir, directory, null);
Utilities\ResourceManagerUtils.cs (1)
31Interlocked.CompareExchange(ref _instance, new ResourceManagerUtils(), null) ??
Utilities\Stream.cs (1)
803Interlocked.CompareExchange(ref _utf8NoBom, new UTF8Encoding(false), null);
Microsoft.ML.Data (17)
Data\Combiner.cs (5)
28Interlocked.CompareExchange(ref _instance, new TextCombiner(), null) ?? 54Interlocked.CompareExchange(ref _instance, new FloatAdder(), null) ?? 76Interlocked.CompareExchange(ref _instance, new R4Adder(), null); 98Interlocked.CompareExchange(ref _instance, new R8Adder(), null) ?? 121Interlocked.CompareExchange(ref _instance, new U4Adder(), null) ??
Data\Conversion.cs (1)
64Interlocked.CompareExchange(ref _defaultInstance, new Conversions(), null) ??
DataLoadSave\Binary\MemoryStreamPool.cs (1)
65Interlocked.CompareExchange(ref _pools[index], new MemoryStreamPool(), null);
DataLoadSave\Text\TextLoaderParser.cs (1)
40Interlocked.CompareExchange(ref _defaultInstance, new ValueCreatorCache(), null) ??
DataLoadSave\Transpose\TransposeLoader.cs (1)
190var view = Interlocked.CompareExchange(ref _view, loader, null);
DataView\CacheDataView.cs (1)
1298Interlocked.CompareExchange(ref _pipeConstructorTypes,
Evaluators\EvaluatorUtils.cs (1)
51Interlocked.CompareExchange(ref _knownEvaluatorFactories, tmp, null);
Evaluators\RankingEvaluator.cs (1)
983Interlocked.CompareExchange(ref _discountMapFixed, discountMap, null);
Scorers\MulticlassClassificationScorer.cs (1)
273Interlocked.CompareExchange(ref _bindable,
Transforms\LabelConvertTransform.cs (1)
191Interlocked.CompareExchange(ref _slotType, new VectorDataViewType(NumberDataViewType.Single, srcSlotType.Dimensions), null);
Transforms\RowShufflingTransformer.cs (1)
387Interlocked.CompareExchange(ref _pipeConstructorTypes, new Type[] { typeof(int), typeof(Delegate) }, null);
Transforms\ValueToKeyMappingTransformer.cs (2)
189Interlocked.CompareExchange(ref _codecFactoryPool, new MemoryStreamPool(), null); 190Interlocked.CompareExchange(ref _codecFactory, new CodecFactory(Host, _codecFactoryPool), null);
Microsoft.ML.DataView (16)
DataViewType.cs (16)
100Interlocked.CompareExchange(ref _instance, new TextDataViewType(), null) ?? 141Interlocked.CompareExchange(ref _instSByte, new NumberDataViewType(typeof(sbyte)), null) ?? 155Interlocked.CompareExchange(ref _instByte, new NumberDataViewType(typeof(byte)), null) ?? 169Interlocked.CompareExchange(ref _instInt16, new NumberDataViewType(typeof(short)), null) ?? 183Interlocked.CompareExchange(ref _instUInt16, new NumberDataViewType(typeof(ushort)), null) ?? 197Interlocked.CompareExchange(ref _instInt32, new NumberDataViewType(typeof(int)), null) ?? 211Interlocked.CompareExchange(ref _instUInt32, new NumberDataViewType(typeof(uint)), null) ?? 225Interlocked.CompareExchange(ref _instInt64, new NumberDataViewType(typeof(long)), null) ?? 239Interlocked.CompareExchange(ref _instUInt64, new NumberDataViewType(typeof(ulong)), null) ?? 253Interlocked.CompareExchange(ref _instSingle, new NumberDataViewType(typeof(float)), null) ?? 267Interlocked.CompareExchange(ref _instDouble, new NumberDataViewType(typeof(double)), null) ?? 298Interlocked.CompareExchange(ref _instance, new RowIdDataViewType(), null) ?? 337Interlocked.CompareExchange(ref _instance, new BooleanDataViewType(), null) ?? 376Interlocked.CompareExchange(ref _instance, new DateTimeDataViewType(), null) ?? 412Interlocked.CompareExchange(ref _instance, new DateTimeOffsetDataViewType(), null) ?? 448Interlocked.CompareExchange(ref _instance, new TimeSpanDataViewType(), null) ??
Microsoft.ML.FastTree (2)
BinFile\BinFinder.cs (1)
30Interlocked.CompareExchange(ref _trivialBinUpperBounds, new double[] { double.PositiveInfinity }, null) ??
Utils\Timer.cs (1)
203Interlocked.CompareExchange(ref _state, new TimerState(), null);
Microsoft.ML.Tests (2)
ExpressionLanguageTests\ExpressionLanguageTests.cs (2)
436Interlocked.CompareExchange(ref _instance, new TestFuncs1(), null); 620Interlocked.CompareExchange(ref _instance, new TestFuncs2(), null);
Microsoft.ML.Tokenizers (3)
Model\CodeGenTokenizer.cs (1)
270Interlocked.CompareExchange(ref _vocabOriginal, vocab, null);
Model\EnglishRobertaTokenizer.cs (1)
245Interlocked.CompareExchange(ref _vocabOriginal, vocab, null);
Model\SentencePieceBpeModel.cs (1)
57Interlocked.CompareExchange(ref _publicVocab, new ReadOnlyDictionary<string, int>(vocab), null);
Microsoft.ML.Transforms (5)
Expression\BuiltinFunctions.cs (1)
121Interlocked.CompareExchange(ref _instance, new BuiltinFunctions(), null);
Text\StopWordsRemovingTransformer.cs (1)
156Interlocked.CompareExchange(ref _stopWords, stopWords, null);
Text\TextNormalizing.cs (1)
318Interlocked.CompareExchange(ref _combinedDiacriticsMap, combinedDiacriticsMap, null);
Text\TokenizingByCharacters.cs (2)
316Interlocked.CompareExchange(ref _keyValuesBoundaries, boundaries, null); 317Interlocked.CompareExchange(ref _keyValuesStr, bldr.ToString(), null);
Microsoft.VisualBasic.Tests (1)
Microsoft\VisualBasic\ApplicationServices\SingleInstanceTests.cs (1)
27Interlocked.CompareExchange(ref _received, null, received);
Microsoft.VisualStudio.LanguageServices.CSharp (2)
SemanticSearch\SemanticSearchToolWindowImpl.cs (2)
102Interlocked.CompareExchange(ref _lazyContent, new WpfControlWrapper(element), null); 405Interlocked.CompareExchange(ref _pendingExecutionCancellationSource, value: null, cancellationSource);
MSBuild (1)
InterningBinaryReader.cs (1)
232Interlocked.CompareExchange(ref s_bufferPool, _buffer, null);
MSBuildTaskHost (3)
EnvironmentUtilities.cs (2)
73Interlocked.CompareExchange(ref s_processPath, currentProcess.MainModule.FileName ?? "", null); 91Interlocked.CompareExchange(ref s_processName, currentProcess.ProcessName, null);
InterningBinaryReader.cs (1)
232Interlocked.CompareExchange(ref s_bufferPool, _buffer, null);
PresentationCore (4)
System\Windows\EventHelper.cs (2)
30if (Interlocked.CompareExchange(ref field, newTuple, oldTuple) == oldTuple) 47if (Interlocked.CompareExchange(ref field, newTuple, oldTuple) == oldTuple)
System\Windows\Media\MediaSystem.cs (1)
152if (Interlocked.CompareExchange(ref s_disableDirtyRectangles, disableDirtyRectangles, oldValue) == oldValue)
System\Windows\Media\textformatting\TextFormatterContext.cs (1)
460System.Threading.Interlocked.CompareExchange<Dictionary<char,bool>>(ref _specialCharacters, dict, null);
PresentationFramework (12)
MS\Internal\Data\CollectionViewProxy.cs (1)
1055Interlocked.CompareExchange(ref _indexer, newIndexer, null);
MS\Internal\PtsHost\FlowDocumentPage.cs (1)
800if (!Interlocked.CompareExchange(ref _disposed, true, false))
MS\Internal\PtsHost\PageBreakRecord.cs (1)
133if (!Interlocked.CompareExchange(ref _disposed, true, false))
MS\Internal\PtsHost\PtsCache.cs (2)
165if (!Interlocked.CompareExchange(ref _disposed, true, false)) 294if (!Interlocked.CompareExchange(ref _disposed, true, false))
MS\Internal\PtsHost\PtsContext.cs (1)
74if (!Interlocked.CompareExchange(ref _disposed, true, false))
MS\Internal\PtsHost\PtsPage.cs (1)
707if (!Interlocked.CompareExchange(ref _disposed, true, false))
MS\Win32\UxThemeWrapper.cs (1)
215ThemeState currentState = System.Threading.Interlocked.CompareExchange(ref _themeState, newState, themeState);
System\Windows\Data\BindingOperations.cs (2)
563Interlocked.CompareExchange<ExceptionLogger>(ref _exceptionLogger, newLogger, null); 587Interlocked.CompareExchange<ExceptionLogger>(ref _exceptionLogger, null, this);
System\Windows\Data\CollectionView.cs (1)
1737Interlocked.CompareExchange(ref _enumerableWrapper, newWrapper, null);
System\Windows\SystemResources.cs (1)
829string currentName = System.Threading.Interlocked.CompareExchange(ref _themedResourceName, themedResourceName, null);
Roslyn.Diagnostics.Analyzers (12)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
134Interlocked.CompareExchange(ref _semanticModelMap, updatedMap, originalMap);
Roslyn.Diagnostics.VisualBasic.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.vb (1)
121Interlocked.CompareExchange(Me._lineContinuations(indentation), triviaInfo, Nothing)
System.Collections.Concurrent (5)
System\Collections\Concurrent\ConcurrentStack.cs (5)
282if (Interlocked.CompareExchange(ref _head, newNode, newNode._next) == newNode._next) 351if (Interlocked.CompareExchange(ref _head, head, tail._next) == tail._next) 378while (Interlocked.CompareExchange( 468if (Interlocked.CompareExchange(ref _head, head._next, head) == head) 611if (Interlocked.CompareExchange(ref _head, next._next, head) == head)
System.Collections.Immutable (19)
System\Collections\Immutable\ImmutableDictionary_2.Builder.cs (1)
260Threading.Interlocked.CompareExchange<object?>(ref _syncRoot, new object(), null);
System\Collections\Immutable\ImmutableInterlocked.cs (15)
49T interlockedResult = Interlocked.CompareExchange(ref location, newValue, oldValue); 96T interlockedResult = Interlocked.CompareExchange(ref location, newValue, oldValue); 138T[]? interlockedResult = Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), newImmutableArray.array, oldArray); 185T[]? interlockedResult = Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), newImmutableArray.array, oldArray); 219return new ImmutableArray<T>(Interlocked.CompareExchange(ref Unsafe.AsRef(in location.array), value.array, comparand.array)); 323ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 371ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 418ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 452ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 487ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 518ImmutableDictionary<TKey, TValue> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 552ImmutableStack<T> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 575ImmutableStack<T> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 607ImmutableQueue<T> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection); 630ImmutableQueue<T> interlockedResult = Interlocked.CompareExchange(ref location, updatedCollection, priorCollection);
System\Collections\Immutable\ImmutableList_1.Builder.cs (1)
1168System.Threading.Interlocked.CompareExchange<object?>(ref _syncRoot, new object(), null);
System\Collections\Immutable\ImmutableSortedDictionary_2.Builder.cs (1)
271Threading.Interlocked.CompareExchange<object?>(ref _syncRoot, new object(), null);
System\Collections\Immutable\ImmutableSortedSet_1.Builder.cs (1)
514Threading.Interlocked.CompareExchange<object?>(ref _syncRoot, new object(), null);
System.ComponentModel.Composition (1)
System\ComponentModel\Composition\Primitives\ComposablePartCatalog.cs (1)
61Interlocked.CompareExchange(ref _queryableParts, p, null);
System.ComponentModel.TypeConverter (2)
System\ComponentModel\LicenseManager.cs (2)
89Interlocked.CompareExchange(ref s_providers, new Hashtable(), null); 101Interlocked.CompareExchange(ref s_providerInstances, new Hashtable(), null);
System.Configuration.ConfigurationManager (1)
System\Configuration\BaseConfigurationRecord.cs (1)
2825Interlocked.CompareExchange(ref s_appConfigPath, appConfigPath, null);
System.Console (1)
System\ConsolePal.Unix.cs (1)
92Interlocked.CompareExchange(ref s_stdInReader, reader, null);
System.Data.Common (1)
System\Data\DataTable.cs (1)
1260view = Interlocked.CompareExchange(ref _defaultView, view, null);
System.Data.Odbc (2)
System\Data\Odbc\OdbcConnectionHelper.cs (2)
143Interlocked.CompareExchange(ref _innerConnection, DbConnectionClosedPreviouslyOpened.SingletonInstance, innerConnection); 251bool result = (from == Interlocked.CompareExchange<DbConnectionInternal>(ref _innerConnection, to, from));
System.Diagnostics.DiagnosticSource (25)
System\Diagnostics\Activity.cs (13)
251Interlocked.CompareExchange(ref _id, id, null); 283Interlocked.CompareExchange(ref _parentId, parentId, null); 287Interlocked.CompareExchange(ref _parentId, Parent.Id, null); 322Interlocked.CompareExchange(ref _rootId, rootId, null); 490if (_tags != null || Interlocked.CompareExchange(ref _tags, new TagsLinkedList(kvp), null) != null) 514if (_tags != null || Interlocked.CompareExchange(ref _tags, new TagsLinkedList(kvp, set: true), null) != null) 529if (_events != null || Interlocked.CompareExchange(ref _events, new DiagLinkedList<ActivityEvent>(e), null) != null) 614if (_links != null || Interlocked.CompareExchange(ref _links, new DiagLinkedList<ActivityLink>(link), null) != null) 635if (_baggage != null || Interlocked.CompareExchange(ref _baggage, new BaggageLinkedList(kvp), null) != null) 659if (_baggage != null || Interlocked.CompareExchange(ref _baggage, new BaggageLinkedList(kvp, set: true), null) != null) 915Interlocked.CompareExchange(ref _spanId, spanId, null); 995Interlocked.CompareExchange(ref _parentSpanId, parentSpanId, null); 1136Interlocked.CompareExchange(ref _customProperties, new Dictionary<string, object>(), null);
System\Diagnostics\ActivitySource.cs (1)
369Interlocked.CompareExchange(ref _listeners, new SynchronizedList<ActivityListener>(), null);
System\Diagnostics\DiagnosticListener.cs (3)
44Interlocked.CompareExchange(ref s_allListenerObservable, new AllListenerObservable(), null) ?? 295if (Interlocked.CompareExchange(ref Owner._subscriptions, newSubscriptions, subscriptions) == subscriptions) 449while (Interlocked.CompareExchange(ref _subscriptions, newSubscription, newSubscription.Next) != newSubscription.Next)
System\Diagnostics\DsesFilterAndTransform.cs (2)
456Interlocked.CompareExchange(ref _firstImplicitTransformsEntry, 467Interlocked.CompareExchange(ref _implicitTransformsTable,
System\Diagnostics\Metrics\AggregatorStore.cs (5)
250Interlocked.CompareExchange(ref NoLabelAggregator, aggregator, null); 266Interlocked.CompareExchange(ref Label1, new FixedSizeLabelNameDictionary<StringSequence1, ObjectSequence1, TAggregator>(), null); 273Interlocked.CompareExchange(ref Label2, new FixedSizeLabelNameDictionary<StringSequence2, ObjectSequence2, TAggregator>(), null); 280Interlocked.CompareExchange(ref Label3, new FixedSizeLabelNameDictionary<StringSequence3, ObjectSequence3, TAggregator>(), null); 287Interlocked.CompareExchange(ref LabelMany, new FixedSizeLabelNameDictionary<StringSequenceMany, ObjectSequenceMany, TAggregator>(), null);
System\Diagnostics\Metrics\MetricsEventSource.cs (1)
93Interlocked.CompareExchange(ref _handler, new CommandHandler(this), null);
System.Diagnostics.TraceSource (2)
System\Diagnostics\Switch.cs (1)
41Interlocked.CompareExchange<object?>(ref _initializedLock, o, null);
System\Diagnostics\Trace.cs (1)
26Interlocked.CompareExchange(ref s_correlationManager, new CorrelationManager(), null) ??
System.IO.Pipes (1)
Microsoft\Win32\SafeHandles\SafePipeHandle.Unix.cs (1)
113Socket? current = Interlocked.CompareExchange(ref _pipeSocket, socket, null);
System.Linq.Expressions (4)
System\Dynamic\Utils\ExpressionUtils.cs (1)
46Interlocked.CompareExchange(ref collection, value.ToReadOnly(), value);
System\Linq\Expressions\Compiler\AssemblyGen.cs (1)
28Interlocked.CompareExchange(ref s_assembly, new AssemblyGen(), comparand: null);
System\Linq\Expressions\Expression.cs (1)
66Interlocked.CompareExchange(
System\Runtime\CompilerServices\CallSiteBinder.cs (1)
207Interlocked.CompareExchange(ref Cache, new Dictionary<Type, object>(), null);
System.Net.Http (7)
System\Net\Http\HttpClientHandler.cs (1)
378Interlocked.CompareExchange(ref s_dangerousAcceptAnyServerCertificateValidator, delegate { return true; }, null) ??
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (1)
416Interlocked.CompareExchange(ref _sslOptionsHttp3, sslOptionsHttp3, null);
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (2)
187Interlocked.CompareExchange(ref _initialSettingsReceived, new(), null) ?? 915Interlocked.CompareExchange(ref _initialSettingsReceived, s_settingsReceivedSingleton, null);
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (1)
365Exception? firstException = Interlocked.CompareExchange(ref _abortException, abortException, null);
System\Net\Http\SocketsHttpHandler\HttpConnectionPoolManager.cs (1)
173if (Interlocked.CompareExchange(ref _networkChangeCleanup, cleanup, null) != null)
System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs (1)
555if (Interlocked.CompareExchange(ref _handler, handler, null) != null)
System.Net.HttpListener (6)
System\Net\Managed\HttpEndPointListener.cs (6)
332} while (Interlocked.CompareExchange(ref _unhandledPrefixes, future, current) != current); 344} while (Interlocked.CompareExchange(ref _allPrefixes, future, current) != current); 358} while (Interlocked.CompareExchange(ref _prefixes, p2, prefs) != prefs); 373} while (Interlocked.CompareExchange(ref _unhandledPrefixes, future, current) != current); 387} while (Interlocked.CompareExchange(ref _allPrefixes, future, current) != current); 401} while (Interlocked.CompareExchange(ref _prefixes, p2, prefs) != prefs);
System.Net.Quic (3)
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeHandleCache.cs (1)
29T? currentHandle = Interlocked.CompareExchange(ref s_invalidHandle, newHandle, null);
System\Net\Quic\QuicStream.cs (2)
428Interlocked.CompareExchange(ref _sendException, exception, null); 495Interlocked.CompareExchange(ref _sendException, exception, null);
System.Net.Security (5)
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeHandleCache.cs (1)
29T? currentHandle = Interlocked.CompareExchange(ref s_invalidHandle, newHandle, null);
System\Net\Security\SslStream.IO.cs (4)
152bool connectionOpen = Interlocked.CompareExchange(ref _connectionOpenedStatus, ConnectionStatus.HandshakeCompleted, ConnectionStatus.NoHandshake) == ConnectionStatus.NoHandshake; 194if (Interlocked.CompareExchange(ref _nestedAuth, NestedState.StreamInUse, NestedState.StreamNotInUse) != NestedState.StreamNotInUse) 200if (Interlocked.CompareExchange(ref _nestedRead, NestedState.StreamInUse, NestedState.StreamNotInUse) != NestedState.StreamNotInUse) 828if (Interlocked.CompareExchange(ref _nestedRead, NestedState.StreamInUse, NestedState.StreamNotInUse) != NestedState.StreamNotInUse)
System.Net.Sockets (11)
System\Net\Sockets\SafeSocketHandle.Unix.cs (1)
110Interlocked.CompareExchange(ref _asyncContext, new SocketAsyncContext(this), null) ??
System\Net\Sockets\Socket.Tasks.cs (2)
945if (Interlocked.CompareExchange(ref cache, saea, null) != null) 1033if (Interlocked.CompareExchange(ref cache, this, null) != null)
System\Net\Sockets\SocketAsyncContext.Unix.cs (3)
157State oldState = Interlocked.CompareExchange(ref _state, State.Running, State.Waiting); 185if (state == Interlocked.CompareExchange(ref _state, newState, state)) 221if (state == Interlocked.CompareExchange(ref _state, newState, state))
System\Net\Sockets\SocketAsyncEngine.Unix.cs (2)
264Interlocked.CompareExchange( 303Interlocked.CompareExchange(
System\Net\Sockets\SocketAsyncEventArgs.cs (3)
503if (Interlocked.CompareExchange(ref _operating, OperationState.Disposed, OperationState.Free) != OperationState.Free) 530OperationState status = Interlocked.CompareExchange(ref _operating, OperationState.Configuring, OperationState.Free); 549OperationState status = Interlocked.CompareExchange(ref _operating, OperationState.InProgress, OperationState.Free);
System.Net.WebClient (3)
src\libraries\Common\src\System\Threading\Tasks\RendezvousAwaitable.cs (2)
106Action? c = _continuation ?? Interlocked.CompareExchange(ref _continuation, s_completionSentinel, null); 127Action? c = _continuation ?? Interlocked.CompareExchange(ref _continuation, continuation, null);
System\Net\WebClient.cs (1)
1183if (Interlocked.CompareExchange(ref _asyncOp, null, asyncOp) == asyncOp)
System.Net.WebSockets.Client (3)
System\Net\WebSockets\ClientWebSocket.cs (2)
108switch (Interlocked.CompareExchange(ref _state, InternalState.Connecting, InternalState.Created)) 138if (Interlocked.CompareExchange(ref _state, InternalState.Connected, InternalState.Connecting) != InternalState.Connecting)
System\Net\WebSockets\WebSocketHandle.Managed.cs (1)
269if (Interlocked.CompareExchange(ref invokerRef, invoker, null) is not null)
System.Private.CoreLib (83)
src\libraries\System.Private.CoreLib\src\System\AppContext.cs (2)
64Interlocked.CompareExchange(ref s_dataStore, new Dictionary<string, object?>(), null); 156Interlocked.CompareExchange(ref s_switches, new Dictionary<string, bool>(), null);
src\libraries\System.Private.CoreLib\src\System\AppDomain.cs (2)
38Interlocked.CompareExchange(ref s_domain, new AppDomain(), null); 280if (Interlocked.CompareExchange(ref _defaultPrincipal, principal, null) is not null)
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (1)
44return Interlocked.CompareExchange(ref _buckets[bucketIndex], inst, null) ?? inst;
src\libraries\System.Private.CoreLib\src\System\Collections\HashHelpers.SerializationInfoTable.cs (1)
22Interlocked.CompareExchange(ref s_serializationInfoTable, new ConditionalWeakTable<object, SerializationInfo>(), null);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (2)
2528Interlocked.CompareExchange(ref _traceLoggingEventTypes, tlet, null); 4564Interlocked.CompareExchange(ref s_EventSources, new List<WeakReference<EventSource>>(2), null);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\ConcurrentSet.cs (1)
107newItems = Interlocked.CompareExchange(ref this.items, newItems, oldItems)!;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\SimpleEventTypes.cs (1)
32Interlocked.CompareExchange(ref instance, newInstance, null);
src\libraries\System.Private.CoreLib\src\System\Environment.cs (2)
200Interlocked.CompareExchange(ref s_processPath, GetProcessPath() ?? "", null); 223Interlocked.CompareExchange(ref s_osVersion, GetOSVersion(), null);
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureInfo.cs (9)
146Interlocked.CompareExchange(ref s_userDefaultCulture, GetUserDefaultCulture(), null); 152Interlocked.CompareExchange(ref s_userDefaultUICulture, GetUserDefaultUICulture(), null); 378Interlocked.CompareExchange(ref s_asyncLocalCurrentCulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentCulture), null); 400Interlocked.CompareExchange(ref s_asyncLocalCurrentUICulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentUICulture), null); 519Interlocked.CompareExchange<CultureInfo?>(ref _parent, culture, null); 715Interlocked.CompareExchange(ref _numInfo, temp, null); 741Interlocked.CompareExchange(ref _dateTimeInfo, temp, null); 1128cache = Interlocked.CompareExchange(ref s_cachedCulturesByName, cache, null) ?? cache; 1143cache = Interlocked.CompareExchange(ref s_cachedCulturesByLcid, cache, null) ?? cache;
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (1)
1037Interlocked.CompareExchange(ref _buffer, GC.AllocateUninitializedArray<byte>(_bufferSize), null);
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (1)
26Interlocked.CompareExchange(ref _asyncActiveSemaphore, new SemaphoreSlim(1, 1), null) ??
src\libraries\System.Private.CoreLib\src\System\Lazy.cs (1)
353LazyHelper? previous = Interlocked.CompareExchange(ref _state, LazyHelper.PublicationOnlyWaitForOtherThreadToPublish, publicationOnly);
src\libraries\System.Private.CoreLib\src\System\Reflection\ModifiedFunctionPointerType.cs (2)
30Interlocked.CompareExchange(ref _returnType, GetTypeParameter(UnmodifiedType.GetFunctionPointerReturnType(), 0), null); 46Interlocked.CompareExchange(ref _parameterTypes, parameterTypes, null);
src\libraries\System.Private.CoreLib\src\System\Reflection\ModifiedGenericType.cs (1)
30Interlocked.CompareExchange(ref _genericArguments, genericArguments, null);
src\libraries\System.Private.CoreLib\src\System\Reflection\ModifiedHasElementType.cs (1)
28Interlocked.CompareExchange(ref _elementType, GetTypeParameter(UnmodifiedType.GetElementType()!, 0), null);
src\libraries\System.Private.CoreLib\src\System\Runtime\ExceptionServices\ExceptionHandling.cs (1)
36if (Interlocked.CompareExchange(ref s_handler, handler, null) != null)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\ComWrappers.cs (2)
1390if (null != Interlocked.CompareExchange(ref s_globalInstanceForTrackerSupport, instance, null)) 1414if (null != Interlocked.CompareExchange(ref s_globalInstanceForMarshalling, instance, null))
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NativeLibrary.cs (1)
211Interlocked.CompareExchange(ref s_nativeDllResolveMap,
src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (2)
39Interlocked.CompareExchange(ref s_allContexts, new Dictionary<long, WeakReference<AssemblyLoadContext>>(), null) ?? 531Interlocked.CompareExchange<AsyncLocal<AssemblyLoadContext?>?>(ref s_asyncLocalCurrent, new AsyncLocal<AssemblyLoadContext?>(), null);
src\libraries\System.Private.CoreLib\src\System\Text\EncodingProvider.cs (2)
55Interlocked.CompareExchange(ref s_providers, [provider], null) is null) 73if (Interlocked.CompareExchange(ref s_providers, newProviders, providers) == providers)
src\libraries\System.Private.CoreLib\src\System\Text\EncodingTable.cs (2)
180Interlocked.CompareExchange<CodePageDataItem?[]?>(ref s_codePageToCodePageData, new CodePageDataItem[MappedCodePages.Length], null); 218Interlocked.CompareExchange<CodePageDataItem?>(ref s_codePageToCodePageData[index], InternalGetCodePageDataItem(codePage, index), null);
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (4)
104if (Interlocked.CompareExchange(ref _kernelEvent, mre, null) != null) 448ITimer? currentTimer = Interlocked.CompareExchange(ref _timer, timer, null); 609registrations = Interlocked.CompareExchange(ref _registrations, registrations, null) ?? registrations; 711Interlocked.CompareExchange(ref _state, States.NotifyingState, States.NotCanceledState) == States.NotCanceledState)
src\libraries\System.Private.CoreLib\src\System\Threading\LazyInitializer.cs (2)
63Interlocked.CompareExchange(ref target, Activator.CreateInstance<T>(), null!); 115Interlocked.CompareExchange(ref target, value, null!);
src\libraries\System.Private.CoreLib\src\System\Threading\Lock.cs (1)
614AutoResetEvent? waitEventBeforeUpdate = Interlocked.CompareExchange(ref _waitEvent, newWaitEvent, null);
src\libraries\System.Private.CoreLib\src\System\Threading\ManualResetEventSlim.cs (1)
227if (Interlocked.CompareExchange(ref m_eventObj, newEventObj, null) != null)
src\libraries\System.Private.CoreLib\src\System\Threading\RegisteredWaitHandle.Portable.cs (1)
83if (Interlocked.CompareExchange(ref s_cachedEvent, resetEvent, null) != null)
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs (1)
154Interlocked.CompareExchange(ref m_completionState, new CompletionState(), null);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Future.cs (1)
478Interlocked.CompareExchange(ref s_Factory, new TaskFactory<TResult>(), null) ??
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs (2)
165storedContinuation = Interlocked.CompareExchange(ref _continuation, continuation, null); 220Interlocked.CompareExchange(ref _continuation, ManualResetValueTaskSourceCoreShared.s_sentinel, null);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (7)
189Interlocked.CompareExchange(ref s_currentActiveTasks, new Dictionary<int, Task>(), null) ?? 967if (Interlocked.CompareExchange(ref m_taskScheduler, scheduler, null) != null) 1067if (Interlocked.CompareExchange(ref m_taskScheduler, scheduler, null) != null) 1335Interlocked.CompareExchange(ref m_contingentProperties, new ContingentProperties(), null); 1485if (Interlocked.CompareExchange(ref contingentProps.m_completionEvent, newMre, null) != null) 1771if (Interlocked.CompareExchange(ref props.m_exceptionsHolder, holder, null) != null) 2166Interlocked.CompareExchange(ref props.m_exceptionalChildren, new List<Task>(), null);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskScheduler.cs (1)
282Interlocked.CompareExchange(ref s_activeTaskSchedulers, new ConditionalWeakTable<TaskScheduler, object?>(), null);
src\libraries\System.Private.CoreLib\src\System\Threading\Thread.cs (2)
362Interlocked.CompareExchange(ref s_asyncLocalPrincipal, new AsyncLocal<IPrincipal?>(), null); 673return Interlocked.CompareExchange(ref s_nameToSlotMap, nameToSlotMap, null) ?? nameToSlotMap;
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (5)
51if (Interlocked.CompareExchange(ref s_queues, newQueues, oldQueues) == oldQueues) 91if (Interlocked.CompareExchange(ref s_queues, newQueues, oldQueues) == oldQueues) 798Interlocked.CompareExchange(ref _mayHaveHighPriorityWorkItems, false, true) && 1006Interlocked.CompareExchange( 1064Interlocked.CompareExchange(
src\libraries\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolNativeOverlapped.cs (1)
93if (Interlocked.CompareExchange(ref s_dataArray, newDataArray, dataArray) != dataArray)
src\libraries\System.Private.CoreLib\src\System\TimeZone.cs (1)
26Interlocked.CompareExchange<object?>(ref s_InternalSyncObject, o, null);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (3)
158Interlocked.CompareExchange(ref _displayName, PopulateDisplayName(), null); 169Interlocked.CompareExchange(ref _standardDisplayName, PopulateStandardDisplayName(), null); 180Interlocked.CompareExchange(ref _daylightDisplayName, PopulateDaylightDisplayName(), null);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.FullGlobalizationData.Unix.cs (1)
83Interlocked.CompareExchange(ref _uiCulture, uiCulture, null);
src\libraries\System.Private.CoreLib\src\System\Type.cs (1)
728Interlocked.CompareExchange(ref s_defaultBinder, new DefaultBinder(), null) ??
src\System\MulticastDelegate.CoreCLR.cs (1)
147if (a[index] == null && Threading.Interlocked.CompareExchange<object?>(ref a[index], o, null) == null)
src\System\Reflection\RuntimeAssembly.cs (2)
61Interlocked.CompareExchange<object?>(ref m_syncRoot, new object(), null); 163Interlocked.CompareExchange(ref m_fullname, s, null);
src\System\RuntimeType.CoreCLR.cs (1)
1459existingCache = Interlocked.CompareExchange(ref m_cache, newCache, null);
src\System\RuntimeType.GenericCache.cs (6)
106if (Interlocked.CompareExchange(ref genericCache, newEntry, existing) == existing) 119if (Interlocked.CompareExchange(ref genericCache, compositeCache, existing) != existing) 124if (Interlocked.CompareExchange(ref TCache.GetStorageRef(compositeCache), newEntry, existingEntry) == existingEntry) 142if (Interlocked.CompareExchange(ref genericCache, newEntry, null) == null) 155if (Interlocked.CompareExchange(ref genericCache, compositeCache, existing) != existing) 161TCache? currentEntry = Interlocked.CompareExchange(ref TCache.GetStorageRef(compositeCache), newEntry, null);
System.Private.Uri (3)
System\Uri.cs (3)
171Interlocked.CompareExchange(ref _moreInfo, new MoreInfo(), null); 2400Interlocked.CompareExchange(ref _info, info, null!); 2405Flags oldValue = Interlocked.CompareExchange(ref _flags, (current & ~Flags.IndexMask) | cF, current);
System.Private.Xml (6)
System\Xml\Schema\Preprocessor.cs (1)
470Interlocked.CompareExchange<XmlSchema?>(ref s_builtInSchemaForXmlNS, tempSchema, null);
System\Xml\Schema\XmlSchemaSet.cs (1)
67Interlocked.CompareExchange<object?>(ref _internalSyncObject, o, null);
System\Xml\Schema\XmlSchemaValidator.cs (4)
2480Interlocked.CompareExchange<XmlSchemaAttribute?>(ref s_xsiTypeSO, tempXsiTypeSO, null); 2488Interlocked.CompareExchange<XmlSchemaAttribute?>(ref s_xsiNilSO, tempxsiNilSO, null); 2497Interlocked.CompareExchange<XmlSchemaAttribute?>(ref s_xsiSLSO, tempxsiSLSO, null); 2506Interlocked.CompareExchange<XmlSchemaAttribute?>(ref s_xsiNoNsSLSO, tempxsiNoNsSLSO, null);
System.Private.Xml.Linq (4)
System\Xml\Linq\XContainer.cs (1)
78Interlocked.CompareExchange<object>(ref content, t, s);
System\Xml\Linq\XNamespace.cs (2)
242Interlocked.CompareExchange(ref s_namespaces, new XHashtable<WeakReference<XNamespace>>(ExtractNamespace, NamespacesCapacity), null); 310Interlocked.CompareExchange(ref refNmsp, new WeakReference<XNamespace>(new XNamespace(namespaceName)), refOld);
System\Xml\XPath\XNodeNavigator.cs (1)
843System.Threading.Interlocked.CompareExchange(ref s_XmlNamespaceDeclaration, new XAttribute(XNamespace.Xmlns.GetName("xml"), xmlPrefixNamespace), null);
System.Reflection.Metadata (9)
System\Reflection\Internal\MemoryBlocks\ByteArrayMemoryProvider.cs (1)
45if (Interlocked.CompareExchange(ref _pinned, newPinned, null) != null)
System\Reflection\Internal\Utilities\ObjectPool`1.cs (1)
78if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
System\Reflection\Metadata\Internal\VirtualHeap.cs (1)
115Interlocked.CompareExchange(ref lazyHeap, new VirtualHeap(), null);
System\Reflection\Metadata\MetadataReaderProvider.cs (1)
289if (Interlocked.CompareExchange(ref _lazyMetadataBlock, newBlock, null) != null)
System\Reflection\PortableExecutable\PEReader.cs (5)
333Interlocked.CompareExchange(ref _lazyPEHeaders, headers, null); 345if (Interlocked.CompareExchange(ref _lazyImageBlock, newBlock, null) != null) 367if (Interlocked.CompareExchange(ref _lazyMetadataBlock, newBlock, null) != null) 387Interlocked.CompareExchange(ref _lazyPESectionBlocks, new AbstractMemoryBlock[PEHeaders.SectionHeaders.Length], null); 421if (Interlocked.CompareExchange(ref _lazyPESectionBlocks[index], newBlock, null) != null)
System.Reflection.MetadataLoadContext (7)
System\Reflection\TypeLoading\Assemblies\RoAssembly.Modules.cs (2)
84return Interlocked.CompareExchange(ref _loadedModules[loadedModulesIndex], newModule, null) ?? newModule; 112Interlocked.CompareExchange(ref _loadedModules[loadedModuleIndex], newModule, null);
System\Reflection\TypeLoading\General\Ecma\MetadataTable.cs (1)
40return Interlocked.CompareExchange(ref table[index], newValue, null) ?? newValue;
System\Reflection\TypeLoading\Modules\Ecma\EcmaModule.MetadataTables.cs (4)
20Interlocked.CompareExchange(ref _lazyTypeDefTable, CreateTable<EcmaDefinitionType>(TableIndex.TypeDef), null) ?? 44Interlocked.CompareExchange(ref _lazyTypeRefTable, CreateTable<RoDefinitionType>(TableIndex.TypeRef), null) ?? 55Interlocked.CompareExchange(ref _lazyGenericParamTable, CreateTable<EcmaGenericParameterType>(TableIndex.GenericParam), null) ?? 66Interlocked.CompareExchange(ref _lazyAssemblyRefTable, CreateTable<RoAssembly>(TableIndex.AssemblyRef), null) ??
System.Runtime.Caching (8)
System\Runtime\Caching\CacheExpires.cs (1)
874if (timerHandleRef != null && Interlocked.CompareExchange(ref _timerHandleRef, null, timerHandleRef) == timerHandleRef)
System\Runtime\Caching\CacheMemoryMonitor.cs (2)
136if (sref != null && Interlocked.CompareExchange(ref _sizedRefMultiple, null, sref) == sref) 261Interlocked.CompareExchange(ref s_memoryCacheManager, memoryCacheManager, null);
System\Runtime\Caching\ChangeMonitor.cs (1)
226if (Interlocked.CompareExchange(ref _onChangedCallback, onChangedCallback, null) != null)
System\Runtime\Caching\Counters.cs (1)
80if (counters != null && Interlocked.CompareExchange(ref _counters, null, counters) == counters)
System\Runtime\Caching\HostFileChangeMonitor.cs (1)
111Interlocked.CompareExchange(ref s_fcn, fcn, null);
System\Runtime\Caching\MemoryCacheStatistics.cs (1)
342if (timerHandleRef != null && Interlocked.CompareExchange(ref _timerHandleRef, null, timerHandleRef) == timerHandleRef)
System\Runtime\Caching\ObjectCache.cs (1)
33if (Interlocked.CompareExchange(ref s_host, value, null) != null)
System.Security.Cryptography (1)
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeHandleCache.cs (1)
29T? currentHandle = Interlocked.CompareExchange(ref s_invalidHandle, newHandle, null);
System.ServiceModel.UnixDomainSocket (2)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (2)
69if (c != null || (c = Interlocked.CompareExchange(ref _continuation, _continuationCompleted, null)) != null) 116var prevContinuation = Interlocked.CompareExchange(ref _continuation, continuation, null);
System.Text.Encoding.CodePages (4)
System\Text\DBCSCodePageEncoding.cs (1)
236Interlocked.CompareExchange<object?>(ref s_InternalSyncObject, o, null);
System\Text\DecoderBestFitFallback.cs (1)
58Interlocked.CompareExchange<object?>(ref s_InternalSyncObject, o, null);
System\Text\EncoderBestFitFallback.cs (1)
58Interlocked.CompareExchange<object?>(ref s_InternalSyncObject, o, null);
System\Text\SBCSCodePageEncoding.cs (1)
140Interlocked.CompareExchange<object?>(ref s_InternalSyncObject, o, null);
System.Text.Json (5)
System\Text\Json\Serialization\JsonSerializerOptions.Caching.cs (1)
33return Interlocked.CompareExchange(ref _cachingContext, ctx, null) ?? ctx;
System\Text\Json\Serialization\JsonSerializerOptions.cs (1)
1188return Interlocked.CompareExchange(ref location, options, null) ?? options;
System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.cs (1)
132return Interlocked.CompareExchange(ref s_defaultInstance, newInstance, comparand: null) ?? newInstance;
System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.Helpers.cs (1)
36return Interlocked.CompareExchange(ref s_memberAccessor, value, null) ?? value;
System\Text\Json\Serialization\Metadata\JsonTypeInfo.cs (1)
265JsonPropertyInfoList? result = Interlocked.CompareExchange(ref _properties, list, null);
System.Text.RegularExpressions (8)
System\Text\RegularExpressions\Regex.cs (1)
400Interlocked.CompareExchange(ref _replref, new WeakReference<RegexReplacement?>(null), null) ??
System\Text\RegularExpressions\RegexCharClass.cs (1)
1306uint[]? cache = asciiLazyCache ?? Interlocked.CompareExchange(ref asciiLazyCache, new uint[CacheArrayLength], null) ?? asciiLazyCache;
System\Text\RegularExpressions\Symbolic\CharSetSolver.cs (2)
44Interlocked.CompareExchange(ref s_nonAscii, CreateBDDFromRange('\x80', '\uFFFF'), null) ?? 56Interlocked.CompareExchange(ref ascii[c], CreateBdd(c), null) ??
System\Text\RegularExpressions\Symbolic\UnicodeCategoryConditions.cs (4)
37Interlocked.CompareExchange(ref s_categories[(int)category], BDD.Deserialize(UnicodeCategoryRanges.GetSerializedCategory(category)), null) ?? 43Interlocked.CompareExchange(ref s_whiteSpace, BDD.Deserialize(UnicodeCategoryRanges.SerializedWhitespaceBDD), null) ?? 50Interlocked.CompareExchange(ref s_wordLetter, 72Interlocked.CompareExchange(ref s_wordLetterForAnchors, solver.Or(WordLetter(solver), solver.CreateBDDFromRange('\u200C', '\u200D')), null) ??
System.Text.RegularExpressions.Generator (1)
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexCharClass.cs (1)
1306uint[]? cache = asciiLazyCache ?? Interlocked.CompareExchange(ref asciiLazyCache, new uint[CacheArrayLength], null) ?? asciiLazyCache;
System.Threading (2)
System\Threading\ReaderWriterLock.cs (2)
1026ManualResetEventSlim? previousEvent = Interlocked.CompareExchange(ref _readerEvent, currentEvent, null); 1047AutoResetEvent? previousEvent = Interlocked.CompareExchange(ref _writerEvent, currentEvent, null);
System.Threading.Channels (3)
System\Threading\Channels\AsyncOperation.cs (3)
207if (_continuation is not null || Interlocked.CompareExchange(ref _continuation, s_completedSentinel, null) is not null) 351Action<object?>? prevContinuation = Interlocked.CompareExchange(ref _continuation, continuation, null); 520if (ReferenceEquals(Interlocked.CompareExchange(ref _continuation, null, s_availableSentinel), s_availableSentinel))
System.Threading.RateLimiting (1)
System\Threading\RateLimiting\TimerAwaitable.cs (1)
96ReferenceEquals(Interlocked.CompareExchange(ref _callback, continuation, null), _callbackCompleted))
System.Threading.Tasks.Dataflow (7)
Base\DataflowBlock.cs (2)
1086IDisposable? disposableUnlink = Interlocked.CompareExchange<IDisposable?>(ref target._unlink, null, unlink); 1237IDisposable? disposableUnlink = Interlocked.CompareExchange(ref _unlink, null, unlink);
Blocks\WriteOnceBlock.cs (2)
190if (Interlocked.CompareExchange(ref _lazyCompletionTaskSource, Common.CompletedVoidResultTaskCompletionSource, null) != null) 490Interlocked.CompareExchange(ref _lazyCompletionTaskSource, new TaskCompletionSource<VoidResult>(TaskCreationOptions.RunContinuationsAsynchronously), null);
Internal\ActionOnDispose.cs (2)
90Interlocked.CompareExchange(ref _action, null, toRun) == toRun) 132Interlocked.CompareExchange(ref _action, null, toRun) == toRun)
Internal\SpscTargetCore.cs (1)
169if (Interlocked.CompareExchange(ref _activeConsumer, newConsumer, null) == null)
System.Threading.Tasks.Parallel (3)
System\Threading\Tasks\Parallel.ForEachAsync.cs (1)
119if (Interlocked.CompareExchange(ref state.NextAvailable, element + T.One, element) != element)
System\Threading\Tasks\ParallelLoopState.cs (1)
214while (Interlocked.CompareExchange(ref pflags._lowestBreakIteration, iteration, oldLBI) != oldLBI)
System\Threading\Tasks\ParallelRangeManager.cs (1)
109Interlocked.CompareExchange(ref _indexRanges[_nCurrentIndexRange]._nSharedCurrentIndexOffset, new StrongBox<long>(0), null);
System.Transactions.Local (1)
System\Transactions\TransactionTable.cs (1)
642Bucket oldBucket = Interlocked.CompareExchange(ref _owningSet.headBucket, newBucket, this);
System.Xaml (17)
System\Xaml\Schema\TypeReflector.cs (4)
179Interlocked.CompareExchange(ref _attachableMemberCache, 251Interlocked.CompareExchange(ref _nonAttachableMemberCache, 305Interlocked.CompareExchange(ref _positionalParameterTypes, 379Interlocked.CompareExchange(ref _aliasedProperties, dict, null);
System\Xaml\Schema\XamlValueConverter.cs (1)
47Interlocked.CompareExchange(ref _instance, CreateInstance(), null);
System\Xaml\XamlMember.cs (1)
903Interlocked.CompareExchange(ref _reflector, reflector, null);
System\Xaml\XamlSchemaContext.cs (10)
374Interlocked.CompareExchange(ref _xmlNsCompatDict, CreateDictionary<string, string>(), null); 503Interlocked.CompareExchange(ref _masterBracketCharacterCache, CreateDictionary<XamlType, Dictionary<string, SpecialBracketCharacters>>(), null); 514Interlocked.CompareExchange(ref _masterTypeList, CreateDictionary<Type, XamlType>(ReferenceEqualityComparer.Instance), null); 525Interlocked.CompareExchange(ref _masterValueConverterList, CreateDictionary<ReferenceEqualityTuple<Type, XamlType, Type>, object>(), null); 536Interlocked.CompareExchange(ref _masterMemberList, CreateDictionary<ReferenceEqualityTuple<MemberInfo, MemberInfo>, XamlMember>(), null); 731Interlocked.CompareExchange(ref _xmlnsInfo, CreateDictionary<Assembly, XmlNsInfo>(ReferenceEqualityComparer.Instance), null); 742Interlocked.CompareExchange(ref _xmlnsInfoForDynamicAssemblies, CreateDictionary<WeakRefKey, XmlNsInfo>(), null); 754Interlocked.CompareExchange(ref _namespaceByUriList, CreateDictionary<string, XamlNamespace>(), null); 769Interlocked.CompareExchange(ref _xmlnsInfoForUnreferencedAssemblies, CreateDictionary<Assembly, XmlNsInfo>(ReferenceEqualityComparer.Instance), null); 1270Interlocked.CompareExchange(ref _referenceAssemblyNames, asmNames, null);
System\Xaml\XamlType.cs (1)
1498Interlocked.CompareExchange(ref _reflector, reflector, null);
Test.Utilities (11)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
Text.Analyzers (12)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
17=> Interlocked.CompareExchange(ref target, value, null) ?? value; 117/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 135/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/> 141T oldValue = Interlocked.CompareExchange(ref target, initializedValue, uninitializedValue); 152/// nearly always more useful than the usual return from <see cref="Interlocked.CompareExchange{T}(ref T, T, T)"/>
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
40var dictionary = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._dictionary), value._dictionary, comparand._dictionary);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (1)
40var set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
40var list = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._list), value._list, comparand._list);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
152if (inst == null || inst != Interlocked.CompareExchange(ref _firstItem, null, inst)) 181if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst))
src\Dependencies\Threading\CancellationSeries.cs (1)
83var candidate = Interlocked.CompareExchange(ref _cts, nextSource, priorSource);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
134Interlocked.CompareExchange(ref _semanticModelMap, updatedMap, originalMap);