287 references to TryAdd
Aspire.Dashboard (3)
Components\Pages\ConsoleLogs.razor.cs (1)
198var added = _resourceByName.TryAdd(resource.Name, resource);
Components\Pages\Resources.razor.cs (1)
326added = _resourceByName.TryAdd(resource.Name, resource);
Model\ResourceOutgoingPeerResolver.cs (1)
36var added = _resourceByName.TryAdd(resource.Name, resource);
Aspire.Hosting (5)
Dcp\DcpExecutor.cs (1)
675map.TryAdd(resource.Metadata.Name, resource);
Dcp\DcpExecutorEvents.cs (1)
22var success = _eventSubscriptionListLookup.TryAdd(typeof(T), (obj) => callback((T)obj));
Eventing\DistributedApplicationEventing.cs (1)
91if (!_eventSubscriptionListLookup.TryAdd(typeof(T), new List<DistributedApplicationEventSubscription> { subscription }))
Publishing\PublishingActivityReporter.cs (1)
39_steps.TryAdd(step.Id, step);
Publishing\PublishingStep.cs (1)
68_tasks.TryAdd(task.Id, task);
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
69modelNameOperations.TryAdd(ModelNameOperation.Create(invocation, modelTypes, token), value: default);
Aspire.Microsoft.Data.SqlClient (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\SqlClientTraceInstrumentationOptions.cs (1)
268ConnectionDetailCache.TryAdd(dataSource, connectionDetails);
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\SqlClientTraceInstrumentationOptions.cs (1)
268ConnectionDetailCache.TryAdd(dataSource, connectionDetails);
Aspire.StackExchange.Redis (1)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\StackExchangeRedisConnectionInstrumentation.cs (1)
90this.Cache.TryAdd(cacheKey, session);
dotnet-svcutil-lib (1)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TimeoutHelper.cs (1)
305if (s_tokenCache.TryAdd(targetTime, tcs.Task))
GenerateDocumentationAndConfigFiles (5)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Interop.FunctionalTests (1)
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (1)
51_pools.TryAdd(pool, true);
Metrics (5)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Metrics.Legacy (5)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Microsoft.AspNetCore.App.Analyzers (1)
RouteHandlers\RouteHandlerAnalyzer.cs (1)
103mapOperations.TryAdd(MapOperation.Create(invocation, routeUsage), value: default);
Microsoft.AspNetCore.Components (7)
BindConverter.cs (2)
1797_cache.TryAdd(typeof(T), formatter); 2004_cache.TryAdd(typeof(T), parser);
ComponentFactory.cs (1)
43_cachedComponentTypeInfo.TryAdd(componentType, cacheEntry);
DefaultComponentActivator.cs (1)
37_cachedComponentTypeInfo.TryAdd(componentType, factory);
Reflection\ComponentProperties.cs (1)
379_referenceEqualityWritersCache.TryAdd(parameterName, writer);
Routing\RouteTableFactory.cs (1)
43_cache.TryAdd(routeKey, routeTable);
Routing\UrlValueConstraint.cs (1)
29_cachedInstances.TryAdd(targetType, result);
Microsoft.AspNetCore.Components.Endpoints (3)
src\Shared\PropertyHelper\PropertyHelper.cs (3)
436visiblePropertiesCache?.TryAdd(type, result); 478visiblePropertiesCache?.TryAdd(type, result); 516cache?.TryAdd(type, result);
Microsoft.AspNetCore.Components.Server (3)
Circuits\CircuitRegistry.cs (2)
79if (!ConnectedCircuits.TryAdd(circuitHost.CircuitId, circuitHost)) 252ConnectedCircuits.TryAdd(circuitId, disconnectedEntry.CircuitHost);
Circuits\RemoteJSRuntime.cs (1)
178if (!_pendingDotNetToJSStreams.TryAdd(streamId, cancelableStreamReference))
Microsoft.AspNetCore.Components.WebAssembly (1)
.packages\microsoft.dotnet.hotreload.agent\10.0.100-preview.7.25358.102\contentFiles\cs\net6.0\HotReloadAgent.cs (1)
100if (_deltas.TryGetValue(moduleId.Value, out var updateDeltas) && _appliedAssemblies.TryAdd(loadedAssembly, loadedAssembly))
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\XmlKeyManager.cs (1)
333if (!_knownKeyMap.TryAdd(key.KeyId, key))
Microsoft.AspNetCore.Http.Abstractions (5)
Routing\EndpointMetadataCollection.cs (1)
125_cache.TryAdd(typeof(T), results);
Routing\RouteValueDictionary.cs (1)
894_propertyCache.TryAdd(type, Properties);
src\Shared\PropertyHelper\PropertyHelper.cs (3)
436visiblePropertiesCache?.TryAdd(type, result); 478visiblePropertiesCache?.TryAdd(type, result); 516cache?.TryAdd(type, result);
Microsoft.AspNetCore.Http.Connections (1)
Internal\HttpConnectionManager.cs (1)
83_connections.TryAdd(connectionToken, connection);
Microsoft.AspNetCore.Mvc.Core (9)
ActionConstraints\ActionConstraintCache.cs (1)
89cache.Entries.TryAdd(action, entry);
Infrastructure\AsyncEnumerableReader.cs (2)
61_asyncEnumerableConverters.TryAdd(type, reader); 72_asyncEnumerableConverters.TryAdd(type, reader);
ModelBinding\ModelBinderFactory.cs (1)
184_cache.TryAdd(new Key(metadata, cacheToken), binder);
ModelBinding\Validation\ClientValidatorCache.cs (1)
71_cacheEntries.TryAdd(metadata, entry);
ModelBinding\Validation\ValidatorCache.cs (1)
61_cacheEntries.TryAdd(metadata, entry);
src\Shared\PropertyHelper\PropertyHelper.cs (3)
436visiblePropertiesCache?.TryAdd(type, result); 478visiblePropertiesCache?.TryAdd(type, result); 516cache?.TryAdd(type, result);
Microsoft.AspNetCore.Mvc.Formatters.Xml (4)
XmlDataContractSerializerInputFormatter.cs (1)
244_serializerCache.TryAdd(type, serializer);
XmlDataContractSerializerOutputFormatter.cs (1)
300_serializerCache.TryAdd(type, serializer);
XmlSerializerInputFormatter.cs (1)
249_serializerCache.TryAdd(type, serializer);
XmlSerializerOutputFormatter.cs (1)
289_serializerCache.TryAdd(type, serializer);
Microsoft.AspNetCore.Mvc.NewtonsoftJson (2)
src\Mvc\Mvc.Core\src\Infrastructure\AsyncEnumerableReader.cs (2)
61_asyncEnumerableConverters.TryAdd(type, reader); 72_asyncEnumerableConverters.TryAdd(type, reader);
Microsoft.AspNetCore.Mvc.TagHelpers (1)
Cache\DistributedCacheTagHelperService.cs (1)
79_workers.TryAdd(key, tcs.Task);
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
ExpressionHelper.cs (2)
135expressionTextCache?.TryAdd(expression, string.Empty); 191expressionTextCache.TryAdd(expression, expressionText);
ViewComponents\ViewComponentInvokerCache.cs (1)
65cache.Entries.TryAdd(viewComponentDescriptor, executor);
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiDocumentService.cs (1)
282_operationTransformerContextCache.TryAdd(description.ActionDescriptor.Id, operationContext);
Microsoft.AspNetCore.OutputCaching (2)
DispatcherExtensions.cs (2)
26if (_workers.TryAdd(key, tcs.Task)) 65if (_workers.TryAdd(key, tcs.Task))
Microsoft.AspNetCore.Routing (3)
src\Shared\PropertyHelper\PropertyHelper.cs (3)
436visiblePropertiesCache?.TryAdd(type, result); 478visiblePropertiesCache?.TryAdd(type, result); 516cache?.TryAdd(type, result);
Microsoft.AspNetCore.Routing.Abstractions (3)
src\Shared\PropertyHelper\PropertyHelper.cs (3)
436visiblePropertiesCache?.TryAdd(type, result); 478visiblePropertiesCache?.TryAdd(type, result); 516cache?.TryAdd(type, result);
Microsoft.AspNetCore.Server.HttpSys (1)
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (1)
51_pools.TryAdd(pool, true);
Microsoft.AspNetCore.Server.IIS (1)
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (1)
51_pools.TryAdd(pool, true);
Microsoft.AspNetCore.Server.Kestrel.Core (6)
Internal\Infrastructure\ConnectionManager.cs (1)
48if (!_connectionReferences.TryAdd(id, connectionReference))
Internal\Infrastructure\TransportConnectionManager.cs (1)
27if (!_connectionReferences.TryAdd(id, connectionReference))
Internal\PinnedBlockMemoryPoolFactory.cs (1)
32_pools.TryAdd(pool, nuint.Zero);
Internal\WebTransport\WebTransportSession.cs (2)
135var success = _openStreams.TryAdd(stream.StreamId, stream); 153var addedToOpenStreams = _openStreams.TryAdd(stream.StreamId, stream);
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (1)
51_pools.TryAdd(pool, true);
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (1)
51_pools.TryAdd(pool, true);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
src\Shared\Buffers.MemoryPool\DefaultMemoryPoolFactory.cs (1)
51_pools.TryAdd(pool, true);
Microsoft.AspNetCore.Shared.Tests (3)
src\Shared\PropertyHelper\PropertyHelper.cs (3)
436visiblePropertiesCache?.TryAdd(type, result); 478visiblePropertiesCache?.TryAdd(type, result); 516cache?.TryAdd(type, result);
Microsoft.AspNetCore.SignalR.Core (4)
HubConnectionStore.cs (1)
45_connections.TryAdd(connection.ConnectionId, connection);
Internal\DefaultHubDispatcher.cs (1)
529if (!connection.ActiveRequestCancellationSources.TryAdd(invocationId, streamCts))
src\SignalR\common\Shared\ClientResultsManager.cs (2)
21var result = _pendingInvocations.TryAdd(invocationId, (typeof(T), connectionId, tcs, static (state, completionMessage) => 43var result = _pendingInvocations.TryAdd(invocationId, invocationInfo);
Microsoft.AspNetCore.SignalR.StackExchangeRedis (2)
src\SignalR\common\Shared\ClientResultsManager.cs (2)
21var result = _pendingInvocations.TryAdd(invocationId, (typeof(T), connectionId, tcs, static (state, completionMessage) => 43var result = _pendingInvocations.TryAdd(invocationId, invocationInfo);
Microsoft.Build.Framework (2)
FileClassifier.cs (1)
242if (_knownImmutableDirectories.TryAdd(d, d))
ImmutableFilesTimestampCache.cs (1)
33public void TryAdd(string fullPath, DateTime lastModified) => _cache.TryAdd(fullPath, lastModified);
Microsoft.CodeAnalysis (8)
CodeGen\PrivateImplementationDetails.cs (2)
456return _synthesizedMethods.TryAdd(method.Name, method); 504return _synthesizedTopLevelTypes.TryAdd(type.Name, type);
CodeGen\TokenMap.cs (1)
64referenceAdded = _itemIdentityToToken.TryAdd(item, token);
DiagnosticAnalyzer\AnalyzerDriver.cs (2)
2303GeneratedCodeFilesMap.TryAdd(tree, isGenerated); 2350_lazyTreesWithHiddenRegionsMap.TryAdd(tree, hasHiddenRegions);
InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
MetadataReader\PEModule.cs (1)
2664_lazyTypeDefToTypeIdentifierMap.TryAdd(typeDef, new AttributeInfo(customAttribute, signatureIndex));
Microsoft.CodeAnalysis.Analyzers (7)
MetaAnalyzers\DiagnosticAnalyzerAPIUsageAnalyzer.cs (1)
105var added = namedTypesToAccessedTypesMap.TryAdd(namedType, usedTypes);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (1)
298symbolToResourceMap.TryAdd(field, (nameOfLocalizableResource, resourceFileName));
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Microsoft.CodeAnalysis.AnalyzerUtilities (6)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\WebInputSources.cs (1)
106classCache.TryAdd(typeSymbol, isController);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Microsoft.CodeAnalysis.BannedApiAnalyzers (5)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Microsoft.CodeAnalysis.CodeStyle (6)
src\Analyzers\Core\Analyzers\IDEDiagnosticIdToOptionMappingHelper.cs (2)
90map.TryAdd(diagnosticId, options); 102s_diagnosticIdToFadingOptionMap.TryAdd(diagnosticId, fadingOption);
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
154cache.TryAdd(symbol.Name, failureReason);
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Microsoft.CodeAnalysis.CSharp (14)
Compilation\CSharpCompilation.cs (1)
2801TryAdd(new ImportInfo(syntax.SyntaxTree, syntax.Kind(), syntax.Span), default);
Emitter\Model\PEModuleBuilder.cs (1)
898AssemblyOrModuleSymbolToModuleRefMap.TryAdd(assembly.Modules[0], cachedAsmRef);
Emitter\NoPia\EmbeddedTypesManager.cs (2)
193_assemblyGuidMap.TryAdd(t.UnderlyingNamedType.AdaptedSymbol.ContainingAssembly, null); 331if (optTypeManager == null || optTypeManager._reportedSymbolsMap.TryAdd(symbol.OriginalDefinition, true))
FlowAnalysis\NullableWalker.cs (1)
1913state.TryAdd(key, new Data(_variables.GetTotalVariableCount(), requiredAnalysis));
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (1)
108_sourceLocationsSeen.TryAdd(location, true);
Symbols\Metadata\PE\PEModuleSymbol.cs (1)
490added = TypeHandleToTypeMap.TryAdd(type.Handle, type);
Symbols\MetadataOrSourceAssemblySymbol.cs (1)
260AssembliesToWhichInternalAccessHasBeenDetermined.TryAdd(potentialGiverOfAccess, result);
Symbols\Source\SourceAssemblySymbol.cs (5)
2166_optimisticallyGrantedInternalsAccess.TryAdd(potentialGiverOfAccess, true); 2330keys.TryAdd(identity.PublicKey, locationAndValue); 2335keys.TryAdd(identity.PublicKey, locationAndValue); 2336lazyInternalsVisibleToMap.TryAdd(identity.Name, keys); 2653_unassignedFieldsMap.TryAdd(field, isInternal);
Symbols\TypeSymbol.cs (1)
774map.TryAdd(interfaceMember, result);
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
251namedTypeToAnalyzer.TryAdd(namedType, analyzer);
Microsoft.CodeAnalysis.CSharp.Features (1)
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
251namedTypeToAnalyzer.TryAdd(namedType, analyzer);
Microsoft.CodeAnalysis.EditorFeatures (2)
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (1)
299includedDefaults.TryAdd(matchResult.CompletionItem.FilterText, matchResult);
Lightup\LightupHelpers.cs (1)
37wrappedObject.TryAdd(obj.GetType(), canCast);
Microsoft.CodeAnalysis.Features (6)
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (2)
315documentIdToFinalText.TryAdd(document.Id, finalText); 337documentIdToFinalText.TryAdd(oldDocument.Id, newText);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (1)
91_higherPriorityDocumentsNotProcessed.TryAdd(id, /*unused*/null);
src\Analyzers\Core\Analyzers\IDEDiagnosticIdToOptionMappingHelper.cs (2)
90map.TryAdd(diagnosticId, options); 102s_diagnosticIdToFadingOptionMap.TryAdd(diagnosticId, fadingOption);
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
154cache.TryAdd(symbol.Name, failureReason);
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Handler\InlineCompletions\XmlSnippetParser.cs (1)
61_parsedSnippetsCache.TryAdd(matchingSnippetInfo.Title, parsedSnippet);
Protocol\Internal\Efficiency\OptimizedVSCompletionListJsonConverter.cs (1)
107IconRawJson.TryAdd(vsCompletionItem.Icon.ImageId, jsonString);
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\RequestExecutionQueue.cs (1)
387if (!concurrentlyExecutingTasks.TryAdd(currentWorkTask, currentWorkCts))
Microsoft.CodeAnalysis.LanguageServer.UnitTests (1)
LspFileChangeWatcherTests.cs (1)
124Assert.True(Registrations.TryAdd(registration.Id, registration));
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (5)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Microsoft.CodeAnalysis.PublicApiAnalyzers (9)
DeclarePublicApiAnalyzer.Impl.cs (4)
232_visitedApiList.TryAdd(publicApiName.Name, default); 233_visitedApiList.TryAdd(WithObliviousMarker(publicApiName.Name), default); 234_visitedApiList.TryAdd(publicApiName.NameWithNullability, default); 235_visitedApiList.TryAdd(WithObliviousMarker(publicApiName.NameWithNullability), default);
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Microsoft.CodeAnalysis.Remote.Workspaces (2)
Serialization\MessagePackFormatters.cs (2)
83_projectIds.TryAdd(id, projectId); 115var serializeDebugName = _projectIds.TryAdd(value.Id, value);
Microsoft.CodeAnalysis.ResxSourceGenerator (5)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Microsoft.CodeAnalysis.Test.Utilities (1)
TargetFrameworkUtil.cs (1)
433_ = s_dynamicReferenceMap.TryAdd(assemblyName, references);
Microsoft.CodeAnalysis.VisualBasic (8)
Compilation\VisualBasicCompilation.vb (1)
1823LazyInitializer.EnsureInitialized(_lazyImportClauseDependencies).TryAdd((syntaxTree, importsClausePosition), dependencies)
Emit\NoPia\EmbeddedTypesManager.vb (1)
279typeManagerOpt._reportedSymbolsMap.TryAdd(symbol.OriginalDefinition, True) Then
Symbols\AnonymousTypes\AnonymousTypeManager_Templates.vb (1)
39Me._sourceLocationsSeen.TryAdd(location, True)
Symbols\EmbeddedSymbols\EmbeddedSymbolManager.SymbolsCollection.vb (1)
318_symbols.TryAdd(symbol, True)
Symbols\Metadata\PE\PEModuleSymbol.vb (1)
280added = TypeHandleToTypeMap.TryAdd(t.Handle, t)
Symbols\Source\SourceAssemblySymbol.vb (2)
1004_lazyInternalsVisibleToMap.TryAdd(identity.Name, keys) 1654_optimisticallyGrantedInternalsAccess.TryAdd(potentialGiverOfAccess, True)
Symbols\TypeSymbol.vb (1)
664map.TryAdd(interfaceMember, result)
Microsoft.CodeAnalysis.Workspaces (7)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Storage\SQLite\v2\SQLitePersistentStorage_DocumentIds.cs (1)
47_documentIdToPrimaryKeyMap.TryAdd(documentKey.Id, existingId);
Storage\SQLite\v2\SQLitePersistentStorage_ProjectIds.cs (1)
48_projectIdToPrimaryKeyMap.TryAdd(projectKey.Id, existingId);
Storage\SQLite\v2\SQLitePersistentStorage_StringIds.cs (1)
185_stringToIdMap.TryAdd(value, id);
Storage\StorageDatabaseLogger.cs (1)
35if (_set.Count > 10 || !_set.TryAdd(ex.GetType(), ex))
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
Rpc\RpcClient.cs (1)
151while (!_outstandingRequests.TryAdd(requestId, (requestCompletionSource, expectedReturnType)));
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (3)
Rpc\RpcServer.cs (1)
51if (_rpcTargets.TryAdd(nextIndex, rpcTarget))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
src\Workspaces\MSBuild\BuildHost\Rpc\RpcServer.cs (1)
51if (_rpcTargets.TryAdd(nextIndex, rpcTarget))
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Remote\TestSerializerService.cs (1)
88_sharedTestGeneratorReferences.TryAdd(generatorReference.Guid, generatorReference);
Microsoft.CommonLanguageServerProtocol.Framework.Package (1)
RequestExecutionQueue.cs (1)
387if (!concurrentlyExecutingTasks.TryAdd(currentWorkTask, currentWorkCts))
Microsoft.DotNet.Build.Tasks.Feed (1)
src\PublishArtifactsInManifestBase.cs (1)
327return NewAssetLocations.TryAdd((assetRecord.Id, feedConfig.SafeTargetURL, assetLocationType), ValueTuple.Create());
Microsoft.Extensions.AI.Evaluation.Safety (1)
ContentSafetyService.cs (1)
186_ = _serviceUrlCache.TryAdd(key, serviceUrl);
Microsoft.Extensions.Caching.Hybrid (4)
Internal\DefaultHybridCache.Stampede.cs (1)
32if (_currentOperations.TryAdd(stampedeKey, stampedeState))
Internal\DefaultHybridCache.TagInvalidation.cs (3)
120_ = _tagInvalidationTimes.TryAdd(tag, pending); 176_ = _tagInvalidationTimes.TryAdd(tag, pending); 238_ = _tagInvalidationTimes.TryAdd(tag, SafeReadTagInvalidationAsync(tag));
Microsoft.Extensions.Caching.Memory (2)
MemoryCache.cs (2)
747=> key is string s ? _stringEntries.TryAdd(s, entry) : _nonStringEntries.TryAdd(key, entry);
Microsoft.Extensions.Diagnostics.Testing (1)
Logging\FakeLogger.cs (1)
89public void ControlLevel(LogLevel logLevel, bool enabled) => _ = enabled ? _disabledLevels.TryRemove(logLevel, out _) : _disabledLevels.TryAdd(logLevel, false);
Microsoft.Extensions.FileProviders.Physical (2)
PhysicalFilesWatcher.cs (2)
195PollingChangeTokens.TryAdd(pollingChangeToken, pollingChangeToken); 232PollingChangeTokens.TryAdd(pollingChangeToken, pollingChangeToken);
Microsoft.Extensions.Localization (1)
ResourceManagerStringLocalizer.cs (1)
178_missingManifestCache.TryAdd(cacheKey, null);
Microsoft.Extensions.Logging.Console (4)
ConsoleLoggerProvider.cs (4)
109cd.TryAdd(formatter.Name, formatter); 116cd.TryAdd(ConsoleFormatterNames.Simple, new SimpleConsoleFormatter(new FormatterOptionsMonitor<SimpleConsoleFormatterOptions>(new SimpleConsoleFormatterOptions()))); 117cd.TryAdd(ConsoleFormatterNames.Systemd, new SystemdConsoleFormatter(new FormatterOptionsMonitor<ConsoleFormatterOptions>(new ConsoleFormatterOptions()))); 118cd.TryAdd(ConsoleFormatterNames.Json, new JsonConsoleFormatter(new FormatterOptionsMonitor<JsonConsoleFormatterOptions>(new JsonConsoleFormatterOptions())));
Microsoft.Extensions.Options (1)
OptionsCache.cs (1)
100return _cache.TryAdd(name ?? Options.DefaultName, new Lazy<TOptions>(
Microsoft.Maui (1)
Handlers\HybridWebView\HybridWebViewTaskManager.cs (1)
21 if (!_asyncTaskCallbacks.TryAdd(taskIdString, tcs))
Microsoft.ML.Core (3)
Data\Repository.cs (2)
324if (!PathMap.TryAdd(pathEnt, pathTemp)) 532if (!PathMap.TryAdd(pathLower, pathTemp))
Environment\HostEnvironmentBase.cs (1)
472&& !ListenerDict.TryAdd(typeof(TMessage), dispatcher = new Dispatcher<TMessage>()))
Microsoft.ML.Tokenizers (1)
Model\TiktokenTokenizer.cs (1)
1251_tiktokenCache.TryAdd(tiktokenConfiguration.VocabFile, cache);
Microsoft.NET.StringTools (2)
WeakStringCache.Concurrent.cs (2)
84if (stringsByHashCode.TryAdd(hashCode, handle)) 139if (!removedHandle.IsUsed || !_weakHandlesByHashCode.TryAdd(entry.Key, removedHandle))
Microsoft.VisualStudio.LanguageServices (2)
DesignerAttribute\VisualStudioDesignerAttributeService.cs (1)
289_cpsProjects.TryAdd(projectId, updateService);
Venus\ContainedDocument.cs (1)
125s_containedDocuments.TryAdd(documentId, this);
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Implementation\XamlProjectService.cs (1)
87_documentIds.TryAdd(filePath, documentId);
PresentationFramework (3)
System\Windows\Markup\Baml2006\WpfXamlType.cs (3)
278if (Members.TryAdd(name, xamlMember)) 359if (Members.TryAdd(xamlMember.Name, xamlMember)) 370if (AttachableMembers.TryAdd(xamlMember.Name, xamlMember))
PresentationFramework.Aero (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\KnownTypeHelper.cs (1)
271if (Members.TryAdd(name, member))
PresentationFramework.Aero2 (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\KnownTypeHelper.cs (1)
271if (Members.TryAdd(name, member))
PresentationFramework.AeroLite (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\KnownTypeHelper.cs (1)
271if (Members.TryAdd(name, member))
PresentationFramework.Classic (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\KnownTypeHelper.cs (1)
285if (Members.TryAdd(name, member))
PresentationFramework.Luna (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\KnownTypeHelper.cs (1)
271if (Members.TryAdd(name, member))
PresentationFramework.Royale (1)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\KnownTypeHelper.cs (1)
271if (Members.TryAdd(name, member))
Roslyn.Diagnostics.Analyzers (7)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
SymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (2)
144_typesWithSymbolDeclaredEventInvoked.TryAdd(namedType, default); 161_sourceSymbolsToCheck.TryAdd(namedType, default);
SignalRSamples (1)
ConnectionList.cs (1)
30_connections.TryAdd(connection.ConnectionId, connection);
SocialWeather (1)
ConnectionList.cs (1)
31_connections.TryAdd(connection.ConnectionId, connection);
System.Collections.Concurrent (1)
System\Collections\Concurrent\ConcurrentDictionary.cs (1)
1547if (!TryAdd(key, value))
System.ComponentModel.Annotations (3)
System\ComponentModel\DataAnnotations\AssociatedMetadataTypeTypeDescriptor.cs (3)
112s_validatedMetadataTypeCache.TryAdd(typeTuple, true); 130s_metadataTypeCache.TryAdd(type, associatedMetadataType); 194s_typeMemberCache.TryAdd(memberTuple, attributes);
System.ComponentModel.TypeConverter (2)
System\ComponentModel\TypeDescriptor.cs (2)
374s_defaultProviderInitialized.TryAdd(type, null); 1702s_providerTypeTable.TryAdd(searchType, node);
System.Data.Odbc (2)
src\libraries\Common\src\System\Data\ProviderBase\DbConnectionPoolGroup.cs (2)
180bool addResult = _poolCollection.TryAdd(currentIdentity, newPool); 261newPoolCollection.TryAdd(entry.Key, entry.Value);
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Metrics\AggregationManager.cs (1)
351_instrumentStates.TryAdd(instrument, instrumentState);
System.Private.Windows.Core.TestUtilities (1)
NoAssertContext.cs (1)
73s_suppressedThreads.TryAdd(currentThread, --count);
System.Runtime.InteropServices (1)
System\Runtime\InteropServices\Marshalling\DefaultCaching.cs (1)
35return _cache.TryAdd(handle, info);
System.Text.Json (5)
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (4)
74_nameCacheForWriting.TryAdd(fieldInfo.Key, encodedName); 75_nameCacheForReading.TryAdd(fieldInfo.JsonName, fieldInfo.Key); 153_nameCacheForWriting.TryAdd(key, formatted); 214_nameCacheForWriting.TryAdd(key, formatted);
System\Text\Json\Serialization\Metadata\PolymorphicTypeResolver.cs (1)
48if (!_typeToDiscriminatorId.TryAdd(derivedType, derivedTypeInfoHolder))
System.Text.RegularExpressions (1)
System\Text\RegularExpressions\Regex.Cache.cs (1)
269s_cacheDictionary.TryAdd(key, node);
System.Windows.Forms (1)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\CategoryGridEntry.cs (1)
21s_categoryStates.TryAdd(name, true);
System.Xaml (3)
System\Xaml\MS\Impl\XmlNsInfo.cs (1)
221result.TryAdd(nsDef.ClrNamespace, xmlNamespaceList);
System\Xaml\Schema\TypeReflector.cs (1)
382_aliasedProperties.TryAdd(directive, member);
System\Xaml\XamlSchemaContext.cs (1)
1217if (dictionary.TryAdd(key, value))
Templates.Blazor.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
34if (!_projects.TryAdd(projectKey, project))
Templates.Blazor.WebAssembly.Auth.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
34if (!_projects.TryAdd(projectKey, project))
Templates.Blazor.WebAssembly.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
34if (!_projects.TryAdd(projectKey, project))
Templates.Mvc.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
34if (!_projects.TryAdd(projectKey, project))
Templates.Tests (1)
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
34if (!_projects.TryAdd(projectKey, project))
Test.Utilities (5)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
Text.Analyzers (5)
src\Compilers\Core\Portable\InternalUtilities\ConcurrentDictionaryExtensions.cs (1)
22if (!dict.TryAdd(key, value))
src\Compilers\Core\Portable\InternalUtilities\ConcurrentSet.cs (1)
84return _dictionary.TryAdd(value, 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (1)
81var added = instance.TryAdd(kvp.Key, kvp.Value);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentSet.cs (1)
68public bool Add(T value) => _dictionary.TryAdd(value, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AliasSymbolCache.cs (1)
70treeMap.TryAdd(key, builder.ToImmutable());
xunit.console (2)
ConsoleRunner.cs (2)
384completionMessages.TryAdd(Path.GetFileName(assembly.AssemblyFilename), new ExecutionSummary()); 393IExecutionSink resultsSink = new DelegatingExecutionSummarySink(reporterMessageHandler, () => cancel, (path, summary) => completionMessages.TryAdd(path, summary));