64 instantiations of StrongBox
Microsoft.CodeAnalysis (6)
DiagnosticAnalyzer\AnalyzerExecutor.cs (1)
1215StrongBox<long> totalTicks = _analyzerExecutionTimeMap.GetOrAdd(analyzer, _ => new StrongBox<long>(0));
DiagnosticAnalyzer\DiagnosticStartAnalysisScope.cs (1)
642return InterlockedOperations.Initialize(ref _analyzerActions, static () => new StrongBox<AnalyzerActions>(AnalyzerActions.Empty));
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
233new StrongBox<ISymbol?>(_compilation.GetTypeByMetadataName("System.Diagnostics.CodeAnalysis.SuppressMessageAttribute")), 249new StrongBox<ISymbol?>(_compilation.GetTypeByMetadataName("System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute")),
InternalUtilities\InterlockedOperations.cs (2)
87var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory())); 105var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory(arg)));
Microsoft.CodeAnalysis.CodeStyle (4)
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
229var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.CodeBlock.SyntaxTree, _ => (new StrongBox<bool>(false), new TextSpanMutableIntervalTree())); 273var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.SemanticModel.SyntaxTree, syntaxTree => (new StrongBox<bool>(true), null));
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
87var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory())); 105var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory(arg)));
Microsoft.CodeAnalysis.CSharp (7)
CodeGen\EmitStatement.cs (2)
427var destBox = new StrongBox<object?>(dest); 453var fallThrough = new StrongBox<object?>();
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
400Interlocked.CompareExchange(ref uncommon.LazyExtensionParameter, new StrongBox<ParameterSymbol?>(extensionParameter), null);
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (1)
105Interlocked.CompareExchange(ref _lazyExtensionParameter, new StrongBox<ParameterSymbol>(extensionParameter), null);
Symbols\Source\SourcePropertySymbolBase.cs (2)
784Interlocked.CompareExchange(ref _lazyMergedBackingField, new StrongBox<SynthesizedBackingFieldSymbol?>(backingField), null); 805Interlocked.CompareExchange(ref _lazyMergedBackingField, new StrongBox<SynthesizedBackingFieldSymbol?>(backingField), null);
Symbols\SubstitutedNamedTypeSymbol.cs (1)
502Interlocked.CompareExchange(ref _lazyExtensionParameter, new StrongBox<ParameterSymbol?>(substituteParameter()), null);
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (3)
InteractiveSessionTests.cs (3)
2028var globals = new StrongBox<CancellationTokenSource>(); 2062var globals = new StrongBox<CancellationTokenSource>(); 2096var globals = new StrongBox<CancellationTokenSource>();
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
200hasAliases = new StrongBox<bool>(ComputeHasUsingAliases(semanticModel, cancellationToken));
Microsoft.CodeAnalysis.EditorFeatures (1)
IntelliSense\AsyncCompletion\CompletionSource.cs (1)
552s_roslynItemToVsItemData.Add(roslynItem, new StrongBox<VSCompletionItemData>(itemData));
Microsoft.CodeAnalysis.Features (5)
AddImport\AbstractAddImportFeatureService.cs (1)
403static reference => new StrongBox<bool>(ComputeIsInPackagesDirectory(reference))).Value;
Common\AbstractProjectExtensionProvider.cs (1)
63=> s_referencesToExtensionsMap.GetValue(analyzerReferences, _ => new(ComputeExtensions(language, analyzerReferences))).Value;
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (1)
47box = new(await ComputeForceAnalyzeProjectAsync().ConfigureAwait(false));
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
229var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.CodeBlock.SyntaxTree, _ => (new StrongBox<bool>(false), new TextSpanMutableIntervalTree())); 273var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.SemanticModel.SyntaxTree, syntaxTree => (new StrongBox<bool>(true), null));
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\RequestContext.cs (1)
187_lspSolution = new StrongBox<(Workspace Workspace, Solution Solution, TextDocument? Document)>((workspace, solution, document));
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\SourceGeneration\RemoteSourceGenerationService.cs (1)
84return new(generators.Any());
Microsoft.CodeAnalysis.Scripting (1)
Script.cs (1)
582var exceptionOpt = (catchExceptionOpt != null) ? new StrongBox<Exception>() : null;
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Metadata\PE\PEPropertySymbol.vb (1)
233Interlocked.CompareExchange(_lazyOverloadResolutionPriority, New StrongBox(Of Integer)(priority), Nothing)
Microsoft.CodeAnalysis.Workspaces (7)
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (1)
51tuple = new((checksum, AsyncLazy.Create(CreateIndexAsync, project)));
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (1)
125new StrongBox<Checksum>(CodeAnalysis.Checksum.Create(parseOptions.PreprocessorSymbolNames)));
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
87var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory())); 105var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory(arg)));
Workspace\Solution\FileTextLoader.cs (1)
68GetType(), _ => new StrongBox<bool>(new Func<Stream, Workspace, SourceText>(CreateText).Method.DeclaringType != typeof(FileTextLoader))).Value;
Workspace\Solution\StateChecksums.cs (1)
602=> s_objectToChecksumCollectionCache.GetValue(value, _ => new StrongBox<TResult>(checksumCreator(value, arg))).Value;
Workspace\Solution\TextLoader.cs (1)
65_ => new StrongBox<bool>(new Func<Workspace, DocumentId, CancellationToken, Task<TextAndVersion>>(LoadTextAndVersionAsync).Method.DeclaringType != typeof(TextLoader))).Value)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
87var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory())); 105var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory(arg)));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
TestExportJoinableTaskContext+DenyExecutionSynchronizationContext.cs (1)
60_failedTransfer = failedTransfer ?? new StrongBox<ExceptionDispatchInfo>();
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SolutionTests\SolutionTests.cs (1)
98=> OnceEnumerableImpl(new StrongBox<int>(), items);
Microsoft.VisualStudio.LanguageServices.CSharp (4)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (2)
51var spaceBetweenParenthesesValue = new StrongBox<SpacePlacementWithinParentheses>(); 77var newLineBeforeOpenBraceValue = new StrongBox<NewLineBeforeOpenBracePlacement>();
Options\Formatting\NewLinesViewModel.cs (1)
209var newLineBeforeOpenBraceValue = new StrongBox<NewLineBeforeOpenBracePlacement>();
Options\Formatting\SpacingViewModel.cs (1)
126var spaceBetweenParenthesesStorage = new StrongBox<SpacePlacementWithinParentheses>();
System.Collections.Concurrent (2)
System\Collections\Concurrent\PartitionerStatic.cs (2)
419_localOffset = new StrongBox<int>(-1); 420_currentChunkSize = new StrongBox<int>(0);
System.Console (3)
System\Console.cs (3)
263Volatile.Write(ref _isStdInRedirected, new StrongBox<bool>(ConsolePal.IsInputRedirectedCore())); 278Volatile.Write(ref _isStdOutRedirected, new StrongBox<bool>(ConsolePal.IsOutputRedirectedCore())); 293Volatile.Write(ref _isStdErrRedirected, new StrongBox<bool>(ConsolePal.IsErrorRedirectedCore()));
System.Linq.Expressions (6)
System\Linq\Expressions\Compiler\LambdaCompiler.cs (1)
291return Utils.GetStrongBoxValueField(Expression.Constant(new StrongBox<T>()));
System\Linq\Expressions\Interpreter\LightCompiler.cs (1)
1679var nullCase = new StrongBox<int>(1);
System\Linq\Expressions\Interpreter\LocalAccess.cs (4)
305frame.Data[_index] = new StrongBox<object>(_defaultValue); 322frame.Data[_index] = new StrongBox<object>(); 338frame.Data[_index] = new StrongBox<object?>(frame.Data[_index]); 439frame.Data[_index] = new StrongBox<object?>(value);
System.Private.CoreLib (2)
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (1)
163m_lockObjAndDisposed = new StrongBox<bool>();
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (1)
654props.m_cancellationRegistration = new StrongBox<CancellationTokenRegistration>(ctr);
System.Text.Encodings.Web (1)
System\Text\Encodings\Web\TextEncoderSettings.cs (1)
227StrongBox<AllowedBmpCodePointsBitmap> newBitmap = new StrongBox<AllowedBmpCodePointsBitmap>();
System.Threading.Tasks.Dataflow (1)
Base\DataflowBlock.cs (1)
1918var boxedCompleted = new StrongBox<Task>();
System.Threading.Tasks.Parallel (1)
System\Threading\Tasks\ParallelRangeManager.cs (1)
109Interlocked.CompareExchange(ref _indexRanges[_nCurrentIndexRange]._nSharedCurrentIndexOffset, new StrongBox<long>(0), null);
System.Windows.Forms (1)
System\Windows\Forms\PropertyStore.cs (1)
229_values[key] = Value.Create(new StrongBox<T>(value));
System.Windows.Forms.UI.IntegrationTests (1)
Infra\DenyExecutionSynchronizationContext.cs (1)
24_failedTransfer = failedTransfer ?? new StrongBox<ExceptionDispatchInfo>();
172 references to StrongBox
Microsoft.CodeAnalysis (12)
DiagnosticAnalyzer\AnalyzerExecutor.cs (4)
51private readonly ConcurrentDictionary<DiagnosticAnalyzer, StrongBox<long>>? _analyzerExecutionTimeMap; 122var analyzerExecutionTimeMap = logExecutionTime ? new ConcurrentDictionary<DiagnosticAnalyzer, StrongBox<long>>() : null; 145ConcurrentDictionary<DiagnosticAnalyzer, StrongBox<long>>? analyzerExecutionTimeMap, 1215StrongBox<long> totalTicks = _analyzerExecutionTimeMap.GetOrAdd(analyzer, _ => new StrongBox<long>(0));
DiagnosticAnalyzer\DiagnosticStartAnalysisScope.cs (2)
486private StrongBox<AnalyzerActions>? _analyzerActions; 640protected StrongBox<AnalyzerActions> GetOrCreateAnalyzerActions()
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
41private StrongBox<ISymbol?>? _lazySuppressMessageAttribute; 42private StrongBox<ISymbol?>? _lazyUnconditionalSuppressMessageAttribute;
InternalUtilities\InterlockedOperations.cs (4)
85public static T? Initialize<T>([NotNull] ref StrongBox<T?>? target, Func<T?> valueFactory) 87var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory())); 103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg) 105var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory(arg)));
Microsoft.CodeAnalysis.CodeStyle (6)
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
222private readonly ConcurrentDictionary<SyntaxTree, (StrongBox<bool> completed, TextSpanMutableIntervalTree? intervalTree)> _codeBlockIntervals = []; 249static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, TextSpanMutableIntervalTree intervalTree)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (4)
85public static T? Initialize<T>([NotNull] ref StrongBox<T?>? target, Func<T?> valueFactory) 87var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory())); 103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg) 105var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory(arg)));
Microsoft.CodeAnalysis.CSharp (47)
CodeGen\EmitStatement.cs (4)
426var stack = ArrayBuilder<(BoundExpression? condition, StrongBox<object?> destBox, bool sense)>.GetInstance(); 427var destBox = new StrongBox<object?>(dest); 432(BoundExpression? condition, StrongBox<object?> destBox, bool sense) top = stack.Pop(); 453var fallThrough = new StrongBox<object?>();
Compilation\SyntaxAndDeclarationManager.cs (12)
61var lastComputedMemberNamesMap = PooledDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>>.GetInstance(); 164IDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> lastComputedMemberNamesMap, 179lastComputedMemberNames: OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>.Empty, ref declTable); 185lastComputedMemberNamesMap.Add(tree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>.Empty); 199IDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> lastComputedMemberNamesMap, 296OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>> lastComputedMemberNames, 501OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>> lastComputedMemberNames = tryGetLastComputedMemberNames( 605static OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>> tryGetLastComputedMemberNames( 608ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>>.Builder lastComputedMemberNamesMap) 618var builder = ArrayBuilder<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>.GetInstance(); 642builder.Add(new WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>(singleType.MemberNames)); 659return OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>.Empty;
Compilation\SyntaxAndDeclarationManager.LazyState.cs (2)
43internal readonly ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> LastComputedMemberNames; 52ImmutableDictionary<SyntaxTree, OneOrMany<WeakReference<StrongBox<ImmutableSegmentedHashSet<string>>>>> lastComputedMemberNames,
Declarations\DeclarationTreeBuilder.cs (21)
22using BoxedMemberNames = StrongBox<ImmutableSegmentedHashSet<string>>; 36private static readonly ConditionalWeakTable<GreenNode, BoxedMemberNames> s_nodeToMemberNames 37= new ConditionalWeakTable<GreenNode, BoxedMemberNames>(); 39private static readonly BoxedMemberNames s_emptyMemberNames = new BoxedMemberNames(ImmutableSegmentedHashSet<string>.Empty); 49private readonly OneOrMany<WeakReference<BoxedMemberNames>> _previousMemberNames; 79OneOrMany<WeakReference<BoxedMemberNames>> previousMemberNames) 91OneOrMany<WeakReference<BoxedMemberNames>>? previousMemberNames = null) 95previousMemberNames ?? OneOrMany<WeakReference<BoxedMemberNames>>.Empty); 208var memberNames = GetNonTypeMemberNames(node, internalMembers, ref declFlags, skipGlobalStatements: acceptSimpleProgram); 217private static SingleNamespaceOrTypeDeclaration CreateImplicitClass(BoxedMemberNames memberNames, SyntaxReference container, SingleTypeDeclaration.TypeDeclarationFlags declFlags) 293var membernames = GetNonTypeMemberNames(compilationUnit, ((Syntax.InternalSyntax.CompilationUnitSyntax)(compilationUnit.Green)).Members, ref declFlags); 324BoxedMemberNames memberNames, 722var memberNames = GetNonTypeMemberNames( 851var memberNames = GetEnumMemberNames(node, ref declFlags); 890private BoxedMemberNames GetEnumMemberNames( 919private BoxedMemberNames GetNonTypeMemberNames( 1019private BoxedMemberNames GetOrComputeMemberNames<TData>( 1025var result = getOrComputeMemberNamesWorker(); 1029BoxedMemberNames getOrComputeMemberNamesWorker() 1033if (!s_nodeToMemberNames.TryGetValue(greenNode, out BoxedMemberNames memberNames)) 1061static (GreenNode _, BoxedMemberNames memberNames) => memberNames, memberNames, out var pooledCallback);
Declarations\SingleTypeDeclaration.cs (4)
26/// Stored as a <see cref="StrongBox{T}"/> so that we can point weak-references at this instance and attempt to 29private readonly StrongBox<ImmutableSegmentedHashSet<string>> _memberNames; 85StrongBox<ImmutableSegmentedHashSet<string>> memberNames, 134public StrongBox<ImmutableSegmentedHashSet<string>> MemberNames => _memberNames;
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
186public StrongBox<ParameterSymbol?>? LazyExtensionParameter;
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (1)
42private StrongBox<ParameterSymbol> _lazyExtensionParameter;
Symbols\Source\SourcePropertySymbolBase.cs (1)
78private StrongBox<SynthesizedBackingFieldSymbol?>? _lazyMergedBackingField;
Symbols\SubstitutedNamedTypeSymbol.cs (1)
44private StrongBox<ParameterSymbol?> _lazyExtensionParameter;
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (3)
InteractiveSessionTests.cs (3)
2028var globals = new StrongBox<CancellationTokenSource>(); 2062var globals = new StrongBox<CancellationTokenSource>(); 2096var globals = new StrongBox<CancellationTokenSource>();
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (2)
30private static readonly ConditionalWeakTable<SemanticModel, StrongBox<bool>> s_modelToHasUsingAliasesMap = new(); 198if (!s_modelToHasUsingAliasesMap.TryGetValue(semanticModel, out var hasAliases))
Microsoft.CodeAnalysis.EditorFeatures (5)
EditorConfigSettings\Data\EnumFlagsSetting.cs (2)
18StrongBox<TOptionValue> valueStorage, 29private readonly StrongBox<TOptionValue> _valueStorage = valueStorage;
EditorConfigSettings\Data\Setting.cs (1)
70StrongBox<TValue> valueStorage,
IntelliSense\AsyncCompletion\CompletionSource.cs (2)
54private static readonly ConditionalWeakTable<RoslynCompletionItem, StrongBox<VSCompletionItemData>> s_roslynItemToVsItemData = new(); 519if (roslynItem.Flags.IsCached() && s_roslynItemToVsItemData.TryGetValue(roslynItem, out var boxedItemData))
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (3)
RazorDocumentServiceProviderWrapper.cs (3)
17private StrongBox<ISpanMappingService?>? _lazySpanMappingService; 18private StrongBox<IDocumentExcerptService?>? _lazyExcerptService; 19private StrongBox<IDocumentService?>? _lazyDocumentPropertiesService;
Microsoft.CodeAnalysis.Features (12)
AddImport\AbstractAddImportFeatureService.cs (1)
38private static readonly ConditionalWeakTable<PortableExecutableReference, StrongBox<bool>> s_isInPackagesDirectory = new();
Common\AbstractProjectExtensionProvider.cs (2)
25private static readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableArray<TExtension>>> s_referencesToExtensionsMap = new(); 37if (s_referencesToExtensionsMap.TryGetValue(analyzerReferences, out var providers))
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.CompilationManager.cs (2)
26private static readonly ConditionalWeakTable<ProjectState, StrongBox<(Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers, CompilationWithAnalyzersPair? compilationWithAnalyzersPair)>> s_projectToCompilationWithAnalyzers = new(); 43if (!s_projectToCompilationWithAnalyzers.TryGetValue(projectState, out var tupleBox) ||
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs (1)
121if (s_projectToForceAnalysisData.TryGetValue(project.State, out var box) &&
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (2)
35private static readonly ConditionalWeakTable<ProjectState, StrongBox<(Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers, ImmutableDictionary<DiagnosticAnalyzer, DiagnosticAnalysisResult> diagnosticAnalysisResults)>> s_projectToForceAnalysisData = new(); 44if (!s_projectToForceAnalysisData.TryGetValue(projectState, out var box) ||
Navigation\NavigableItemFactory.SymbolLocationNavigableItem.cs (2)
31/// <seealso cref="InterlockedOperations.Initialize{T, U}(ref StrongBox{T}, Func{U, T}, U)"/> 32private StrongBox<INavigableItem.NavigableDocument> _lazyDocument;
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
222private readonly ConcurrentDictionary<SyntaxTree, (StrongBox<bool> completed, TextSpanMutableIntervalTree? intervalTree)> _codeBlockIntervals = []; 249static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, TextSpanMutableIntervalTree intervalTree)
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\RequestContext.cs (1)
56private readonly StrongBox<(Workspace Workspace, Solution Solution, TextDocument? Document)>? _lspSolution;
Microsoft.CodeAnalysis.Remote.ServiceHub (2)
Services\SourceGeneration\RemoteSourceGenerationService.cs (2)
21using AnalyzerReferenceMap = ConditionalWeakTable<AnalyzerReference, StrongBox<bool>>; 80private static StrongBox<bool> HasSourceGenerators(
Microsoft.CodeAnalysis.Scripting (2)
Script.cs (1)
582var exceptionOpt = (catchExceptionOpt != null) ? new StrongBox<Exception>() : null;
ScriptExecutionState.cs (1)
71StrongBox<Exception> exceptionHolderOpt,
Microsoft.CodeAnalysis.VisualBasic (2)
Symbols\Metadata\PE\PEPropertySymbol.vb (1)
49Private _lazyOverloadResolutionPriority As StrongBox(Of Integer)
Symbols\Source\SourceModuleSymbol.vb (1)
74Private _lazyBoundImportsAdditionalDiagnostics As StrongBox(Of ReadOnlyBindingDiagnostic(Of AssemblySymbol))
Microsoft.CodeAnalysis.Workspaces (14)
Diagnostics\HostDiagnosticAnalyzers.cs (2)
55private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableDictionary<string, SkippedHostAnalyzersInfo>>> _skippedHostAnalyzers = new(); 301var box = _skippedHostAnalyzers.GetOrCreateValue(project.AnalyzerReferences);
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (2)
34private static readonly ConditionalWeakTable<ProjectState, StrongBox<(Checksum checksum, AsyncLazy<ProjectIndex> lazyProjectIndex)>> s_projectToIndex = new(); 48if (!s_projectToIndex.TryGetValue(project.State, out var tuple) ||
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (2)
33private static readonly ConditionalWeakTable<ParseOptions, StrongBox<Checksum>> s_ppDirectivesToChecksum = new(); 122var directivesChecksum = s_ppDirectivesToChecksum.GetValue(
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (4)
85public static T? Initialize<T>([NotNull] ref StrongBox<T?>? target, Func<T?> valueFactory) 87var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory())); 103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg) 105var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory(arg)));
Workspace\Solution\FileTextLoader.cs (1)
21private static readonly ConditionalWeakTable<Type, StrongBox<bool>> s_isObsoleteCreateTextOverriden = new();
Workspace\Solution\StateChecksums.cs (2)
592private static readonly ConditionalWeakTable<TValue, StrongBox<TResult>> s_objectToChecksumCollectionCache = new(); 596if (s_objectToChecksumCollectionCache.TryGetValue(value, out var checksumCollection))
Workspace\Solution\TextLoader.cs (1)
21private static readonly ConditionalWeakTable<Type, StrongBox<bool>> s_isObsoleteLoadTextAndVersionAsyncOverriden = new();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (4)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (4)
85public static T? Initialize<T>([NotNull] ref StrongBox<T?>? target, Func<T?> valueFactory) 87var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory())); 103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg) 105var box = Volatile.Read(ref target!) ?? GetOrStore(ref target, new StrongBox<T?>(valueFactory(arg)));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
TestExportJoinableTaskContext+DenyExecutionSynchronizationContext.cs (3)
40/// <para>The <see cref="StrongBox{T}"/> wrapper allows copies of the synchronization context (created by 44private readonly StrongBox<ExceptionDispatchInfo> _failedTransfer; 56private DenyExecutionSynchronizationContext(SynchronizationContext? underlyingContext, Thread? mainThread, StrongBox<ExceptionDispatchInfo>? failedTransfer)
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SolutionTests\SolutionTests.cs (1)
100private static IEnumerable<T> OnceEnumerableImpl<T>(StrongBox<int> counter, T[] items)
Microsoft.VisualStudio.LanguageServices.CSharp (4)
EditorConfigSettings\DataProvider\Whitespace\CSharpWhitespaceSettingsProvider.cs (2)
51var spaceBetweenParenthesesValue = new StrongBox<SpacePlacementWithinParentheses>(); 77var newLineBeforeOpenBraceValue = new StrongBox<NewLineBeforeOpenBracePlacement>();
Options\Formatting\NewLinesViewModel.cs (1)
209var newLineBeforeOpenBraceValue = new StrongBox<NewLineBeforeOpenBracePlacement>();
Options\Formatting\SpacingViewModel.cs (1)
126var spaceBetweenParenthesesStorage = new StrongBox<SpacePlacementWithinParentheses>();
netstandard (1)
netstandard.cs (1)
1576[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.StrongBox<>))]
System.Collections.Concurrent (2)
System\Collections\Concurrent\PartitionerStatic.cs (2)
315protected StrongBox<int>? _currentChunkSize; 318protected StrongBox<int>? _localOffset;
System.Console (9)
System\Console.cs (9)
250private static StrongBox<bool>? _isStdInRedirected; 251private static StrongBox<bool>? _isStdOutRedirected; 252private static StrongBox<bool>? _isStdErrRedirected; 258StrongBox<bool> redirected = Volatile.Read(ref _isStdInRedirected) ?? EnsureInitialized(); 261static StrongBox<bool> EnsureInitialized() 273StrongBox<bool> redirected = Volatile.Read(ref _isStdOutRedirected) ?? EnsureInitialized(); 276static StrongBox<bool> EnsureInitialized() 288StrongBox<bool> redirected = Volatile.Read(ref _isStdErrRedirected) ?? EnsureInitialized(); 291static StrongBox<bool> EnsureInitialized()
System.Core (1)
System.Core.cs (1)
194[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.StrongBox<>))]
System.Linq.Expressions (9)
System\Linq\Expressions\Compiler\CompilerScope.cs (1)
324Type boxType = typeof(StrongBox<>).MakeGenericType(v.Type);
System\Linq\Expressions\Compiler\CompilerScope.Storage.cs (2)
115Type boxType = typeof(StrongBox<>).MakeGenericType(variable.Type); 167Type boxType = typeof(StrongBox<>).MakeGenericType(variable.Type);
System\Linq\Expressions\Compiler\HoistedLocals.cs (1)
91return ((StrongBox<object[]>)locals[0]).Value!;
System\Linq\Expressions\Interpreter\ControlFlowInstructions.cs (2)
762private readonly StrongBox<int> _nullCase; 764internal StringSwitchInstruction(Dictionary<string, int> cases, StrongBox<int> nullCase)
System\Linq\Expressions\Interpreter\InstructionList.cs (1)
1097public void EmitStringSwitch(Dictionary<string, int> cases, StrongBox<int> nullCase)
System\Linq\Expressions\Interpreter\LightCompiler.cs (1)
1679var nullCase = new StrongBox<int>(1);
System\Linq\Expressions\Utils.cs (1)
58[DynamicDependency("Value", typeof(StrongBox<>))]
System.Private.CoreLib (6)
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\StrongBox.cs (4)
11/// <typeparam name="T">The type of the value that the <see cref = "StrongBox{T}"></see> references.</typeparam> 15/// Gets the strongly typed value associated with the <see cref = "StrongBox{T}"></see> 28/// Initializes a new <see cref = "StrongBox{T}"></see> with the specified value. 30/// <param name="value">A value that the <see cref = "StrongBox{T}"></see> will reference.</param>
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (1)
53private readonly StrongBox<bool> m_lockObjAndDisposed;
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (1)
232internal StrongBox<CancellationTokenRegistration>? m_cancellationRegistration; // Task's registration with the cancellation token
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
631[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.StrongBox<>))]
System.Text.Encodings.Web (1)
System\Text\Encodings\Web\TextEncoderSettings.cs (1)
227StrongBox<AllowedBmpCodePointsBitmap> newBitmap = new StrongBox<AllowedBmpCodePointsBitmap>();
System.Threading.Tasks.Dataflow (4)
Base\DataflowBlock.cs (4)
1918var boxedCompleted = new StrongBox<Task>(); 2000StrongBox<Task> boxedCompleted, CancellationTokenSource cts, 2078private readonly StrongBox<Task> _completed; 2083internal ChooseTarget(StrongBox<Task> completed, CancellationToken cancellationToken)
System.Threading.Tasks.Parallel (2)
System\Threading\Tasks\ParallelRangeManager.cs (2)
34internal volatile StrongBox<long>? _nSharedCurrentIndexOffset; 106StrongBox<long>? sharedCurrentIndexOffset = _indexRanges[_nCurrentIndexRange]._nSharedCurrentIndexOffset;
System.Windows.Forms (9)
System\Windows\Forms\PropertyStore.cs (9)
45return foundValue.Type == typeof(StrongBox<T>) 46? foundValue.GetValue<StrongBox<T>>().Value 89value = foundValue.Type == typeof(StrongBox<T>) 90? foundValue.GetValue<StrongBox<T>>().Value 166bool isStrongBox = foundValue.Type == typeof(StrongBox<T>); 171? foundValue.GetValue<StrongBox<T>>().Value 222if (_values.TryGetValue(key, out Value foundValue) && foundValue.Type == typeof(StrongBox<T>)) 224StrongBox<T> storedValue = foundValue.GetValue<StrongBox<T>>();
System.Windows.Forms.UI.IntegrationTests (4)
Infra\DataCollectionService.cs (2)
15private static readonly ConditionalWeakTable<Exception, StrongBox<bool>> s_loggedExceptions = []; 142var logged = s_loggedExceptions.GetOrCreateValue(ex);
Infra\DenyExecutionSynchronizationContext.cs (2)
13private readonly StrongBox<ExceptionDispatchInfo> _failedTransfer; 20private DenyExecutionSynchronizationContext(SynchronizationContext underlyingContext, Thread? mainThread, StrongBox<ExceptionDispatchInfo>? failedTransfer)