69 instantiations of StrongBox
Aspire.Hosting.Integration.Analyzers (1)
AspireExportAnalyzer.cs (1)
159var assemblyHasAspireExport = new StrongBox<bool>(
GenerateDocumentationAndConfigFiles (2)
src\roslyn\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 (6)
DiagnosticAnalyzer\AnalyzerExecutor.cs (1)
1361StrongBox<long> totalTicks = _analyzerExecutionTimeMap.GetOrAdd(analyzer, _ => new StrongBox<long>(0));
DiagnosticAnalyzer\DiagnosticStartAnalysisScope.cs (1)
659return InterlockedOperations.Initialize(ref _analyzerActions, static () => new StrongBox<AnalyzerActions>(AnalyzerActions.Empty));
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
262new StrongBox<ISymbol?>(_compilation.GetTypeByMetadataName("System.Diagnostics.CodeAnalysis.SuppressMessageAttribute")), 278new 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.Analyzers (2)
src\roslyn\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.AnalyzerUtilities (2)
src\roslyn\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.CodeStyle (4)
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
215var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.CodeBlock.SyntaxTree, _ => (new StrongBox<bool>(false), new TextSpanMutableIntervalTree())); 259var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.SemanticModel.SyntaxTree, syntaxTree => (new StrongBox<bool>(true), null));
src\roslyn\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 (12)
CodeGen\EmitStatement.cs (2)
427var destBox = new StrongBox<object?>(dest); 453var fallThrough = new StrongBox<object?>();
Declarations\DeclarationTreeBuilder.cs (2)
39private static readonly BoxedMemberNames s_emptyMemberNames = new BoxedMemberNames(ImmutableSegmentedHashSet<string>.Empty); 1085: new BoxedMemberNames(ImmutableSegmentedHashSet.CreateRange(memberNamesBuilder));
Symbols\AliasSymbol.cs (1)
329bool won = Interlocked.Exchange(ref _aliasTargetDiagnostics, new StrongBox<ReadOnlyBindingDiagnostic<AssemblySymbol>>(newDiagnostics.ToReadOnlyAndFree(forceDiagnosticResolution: false))) == null;
Symbols\Extensions\SourceExtensionImplementationMethodSymbol.cs (1)
100Interlocked.CompareExchange(ref lazyNullableContext, new StrongBox<byte?>(nullableContext), comparand: null);
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
430Interlocked.CompareExchange(ref uncommon.LazyExtensionParameter, new StrongBox<ParameterSymbol?>(extensionParameter), null);
Symbols\NamedTypeSymbol.cs (1)
2696lazyUnionData._lazyValueDeclaredNullableFlowState = new StrongBox<NullableFlowState>(result);
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (1)
109Interlocked.CompareExchange(ref _lazyExtensionParameter, new StrongBox<ParameterSymbol>(extensionParameter), null);
Symbols\Source\SourcePropertySymbolBase.cs (2)
788Interlocked.CompareExchange(ref _lazyMergedBackingField, new StrongBox<SynthesizedBackingFieldSymbol?>(backingField), null); 809Interlocked.CompareExchange(ref _lazyMergedBackingField, new StrongBox<SynthesizedBackingFieldSymbol?>(backingField), null);
Symbols\SubstitutedNamedTypeSymbol.cs (1)
508Interlocked.CompareExchange(ref _lazyExtensionParameter, new StrongBox<ParameterSymbol?>(substituteParameter()), null);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
200hasAliases = new StrongBox<bool>(ComputeHasUsingAliases(semanticModel, cancellationToken));
SyncedSource\FileBasedPrograms\VirtualProjectBuilder.cs (1)
580var refEnabled = new StrongBox<bool?>();
Microsoft.CodeAnalysis.Features (5)
AddImport\AbstractAddImportFeatureService.cs (1)
405static reference => new StrongBox<bool>(ComputeIsInPackagesDirectory(reference))).Value;
Common\AbstractProjectExtensionProvider.cs (1)
63=> s_referencesToExtensionsMap.GetValue(analyzerReferences, _ => new(ComputeExtensions(language, analyzerReferences))).Value;
Diagnostics\Service\DiagnosticAnalyzerService.HostAnalyzerInfo.cs (1)
81lazyAnalyzers = new(ComputeProjectAnalyzers());
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
215var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.CodeBlock.SyntaxTree, _ => (new StrongBox<bool>(false), new TextSpanMutableIntervalTree())); 259var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.SemanticModel.SyntaxTree, syntaxTree => (new StrongBox<bool>(true), null));
Microsoft.CodeAnalysis.NetAnalyzers (1)
Microsoft.NetCore.Analyzers\Resources\MarkAssembliesWithNeutralResourcesLanguage.cs (1)
72var alreadyReportedDiagnostic = new StrongBox<bool>(false);
Microsoft.CodeAnalysis.ResxSourceGenerator (2)
src\roslyn\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.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 (8)
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)));
Log\WorkspaceStructureLogger.cs (1)
271compilation, _ => new StrongBox<int>(Interlocked.Increment(ref _nextCompilationId)));
src\roslyn\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)
600=> 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.DotNet.ProjectTools (1)
src\sdk\src\Cli\Microsoft.DotNet.FileBasedPrograms\VirtualProjectBuilder.cs (1)
583var refEnabled = new StrongBox<bool?>();
Roslyn.Diagnostics.Analyzers (2)
src\roslyn\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)));
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)
264Volatile.Write(ref _isStdInRedirected, new StrongBox<bool>(ConsolePal.IsInputRedirectedCore())); 279Volatile.Write(ref _isStdOutRedirected, new StrongBox<bool>(ConsolePal.IsOutputRedirectedCore())); 294Volatile.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)
1698var 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\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (1)
163m_lockObjAndDisposed = new StrongBox<bool>();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (1)
802props.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));
179 references to StrongBox
Aspire.Hosting.Integration.Analyzers (5)
AspireExportAnalyzer.cs (5)
159var assemblyHasAspireExport = new StrongBox<bool>( 239StrongBox<bool> assemblyHasAspireExport) 428StrongBox<bool> assemblyHasAspireExport) 446private static void AnalyzeProperty(SymbolAnalysisContext context, INamedTypeSymbol aspireExportAttribute, StrongBox<bool> assemblyHasAspireExport) 511private static void ReportMissingPolyglotCompatibleMarker(CompilationAnalysisContext context, StrongBox<bool> assemblyHasAspireExport)
GenerateDocumentationAndConfigFiles (4)
src\roslyn\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 (13)
DiagnosticAnalyzer\AnalyzerExecutor.cs (5)
51private readonly ConcurrentDictionary<DiagnosticAnalyzer, StrongBox<long>>? _analyzerExecutionTimeMap; 139var analyzerExecutionTimeMap = logExecutionTime ? new ConcurrentDictionary<DiagnosticAnalyzer, StrongBox<long>>() : null; 164ConcurrentDictionary<DiagnosticAnalyzer, StrongBox<long>>? analyzerExecutionTimeMap, 1361StrongBox<long> totalTicks = _analyzerExecutionTimeMap.GetOrAdd(analyzer, _ => new StrongBox<long>(0)); 1691if (!_analyzerExecutionTimeMap.TryRemove(analyzer, out var executionTime))
DiagnosticAnalyzer\DiagnosticStartAnalysisScope.cs (2)
496private StrongBox<AnalyzerActions>? _analyzerActions; 657protected StrongBox<AnalyzerActions> GetOrCreateAnalyzerActions()
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (2)
39private StrongBox<ISymbol?>? _lazySuppressMessageAttribute; 40private 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.Analyzers (4)
src\roslyn\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.AnalyzerUtilities (4)
src\roslyn\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.CodeStyle (6)
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
208private readonly ConcurrentDictionary<SyntaxTree, (StrongBox<bool> completed, TextSpanMutableIntervalTree? intervalTree)> _codeBlockIntervals = []; 235static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, TextSpanMutableIntervalTree intervalTree)
src\roslyn\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 (53)
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, declTableBuilder); 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 (23)
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); 209var memberNames = GetNonTypeMemberNames(node, internalMembers, ref declFlags, skipGlobalStatements: acceptSimpleProgram); 218private static SingleNamespaceOrTypeDeclaration CreateImplicitClass(BoxedMemberNames memberNames, SyntaxReference container, SingleTypeDeclaration.TypeDeclarationFlags declFlags) 294var membernames = GetNonTypeMemberNames(compilationUnit, ((Syntax.InternalSyntax.CompilationUnitSyntax)(compilationUnit.Green)).Members, ref declFlags); 325BoxedMemberNames memberNames, 749var memberNames = GetNonTypeMemberNames( 885var memberNames = GetEnumMemberNames(node, ref declFlags); 925private BoxedMemberNames GetEnumMemberNames( 954private BoxedMemberNames GetNonTypeMemberNames( 1054private BoxedMemberNames GetOrComputeMemberNames<TData>( 1060var result = getOrComputeMemberNamesWorker(); 1064BoxedMemberNames getOrComputeMemberNamesWorker() 1068if (!s_nodeToMemberNames.TryGetValue(greenNode, out BoxedMemberNames memberNames)) 1076var previousMemberNames = _currentTypeIndex < _previousMemberNames.Count && _previousMemberNames[_currentTypeIndex].TryGetTarget(out var previousNames) 1096static (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\AliasSymbol.cs (1)
286private StrongBox<ReadOnlyBindingDiagnostic<AssemblySymbol>>? _aliasTargetDiagnostics;
Symbols\Extensions\SourceExtensionImplementationMethodSymbol.cs (1)
20private StrongBox<byte?>? lazyNullableContext;
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
197public StrongBox<ParameterSymbol?>? LazyExtensionParameter;
Symbols\NamedTypeSymbol.cs (2)
46public StrongBox<NullableFlowState>? _lazyValueDeclaredNullableFlowState; 2679StrongBox<NullableFlowState>? lazyNullableFlowState = lazyUnionData._lazyValueDeclaredNullableFlowState;
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (1)
47private StrongBox<ParameterSymbol> _lazyExtensionParameter;
Symbols\Source\SourcePropertySymbolBase.cs (1)
80private StrongBox<SynthesizedBackingFieldSymbol?>? _lazyMergedBackingField;
Symbols\SubstitutedNamedTypeSymbol.cs (1)
44private StrongBox<ParameterSymbol?> _lazyExtensionParameter;
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (2)
30private static readonly ConditionalWeakTable<SemanticModel, StrongBox<bool>> s_modelToHasUsingAliasesMap = new(); 198if (!s_modelToHasUsingAliasesMap.TryGetValue(semanticModel, out var hasAliases))
SyncedSource\FileBasedPrograms\VirtualProjectBuilder.cs (2)
580var refEnabled = new StrongBox<bool?>(); 590async ValueTask CheckFlagEnabledAsync(StrongBox<bool?> flag, string flagName, CSharpDirective directive)
Microsoft.CodeAnalysis.Features (9)
AddImport\AbstractAddImportFeatureService.cs (1)
39private 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\DiagnosticAnalyzerService.HostAnalyzerInfo.cs (2)
72private static readonly ConditionalWeakTable<Project, StrongBox<ImmutableArray<DiagnosticAnalyzer>>> s_projectToAnalyzers = new(); 79if (!s_projectToAnalyzers.TryGetValue(project, out var lazyAnalyzers))
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\roslyn\src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (2)
208private readonly ConcurrentDictionary<SyntaxTree, (StrongBox<bool> completed, TextSpanMutableIntervalTree? intervalTree)> _codeBlockIntervals = []; 235static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, TextSpanMutableIntervalTree intervalTree)
Microsoft.CodeAnalysis.NetAnalyzers (1)
Microsoft.NetCore.Analyzers\Resources\MarkAssembliesWithNeutralResourcesLanguage.cs (1)
72var alreadyReportedDiagnostic = new StrongBox<bool>(false);
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
src\roslyn\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.Scripting (2)
Script.cs (1)
582var exceptionOpt = (catchExceptionOpt != null) ? new StrongBox<Exception>() : null;
ScriptExecutionState.cs (1)
70StrongBox<Exception> exceptionHolderOpt,
Microsoft.CodeAnalysis.VisualBasic (2)
Symbols\Metadata\PE\PEPropertySymbol.vb (1)
49Private _lazyOverloadResolutionPriority As StrongBox(Of Integer)
Symbols\Source\SourceModuleSymbol.vb (1)
75Private _lazyBoundImportsAdditionalDiagnostics As StrongBox(Of ReadOnlyBindingDiagnostic(Of AssemblySymbol))
Microsoft.CodeAnalysis.Workspaces (16)
Diagnostics\HostDiagnosticAnalyzers.cs (2)
55private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, StrongBox<ImmutableDictionary<string, SkippedHostAnalyzersInfo>>> _skippedHostAnalyzers = new(); 336var 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(
Log\WorkspaceStructureLogger.cs (2)
24private readonly ConditionalWeakTable<Compilation, StrongBox<int>> _compilationIds = new(); 270var compilationId = _compilationIds.GetValue(
src\roslyn\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)
590private static readonly ConditionalWeakTable<TValue, StrongBox<TResult>> s_objectToChecksumCollectionCache = new(); 594if (s_objectToChecksumCollectionCache.TryGetValue(value, out var checksumCollection))
Workspace\Solution\TextLoader.cs (1)
21private static readonly ConditionalWeakTable<Type, StrongBox<bool>> s_isObsoleteLoadTextAndVersionAsyncOverriden = new();
Microsoft.CSharp (1)
Microsoft\CSharp\RuntimeBinder\ComInterop\ComBinderHelpers.cs (1)
45return t.IsGenericType && t.GetGenericTypeDefinition() == typeof(StrongBox<>);
Microsoft.DotNet.ProjectTools (2)
src\sdk\src\Cli\Microsoft.DotNet.FileBasedPrograms\VirtualProjectBuilder.cs (2)
583var refEnabled = new StrongBox<bool?>(); 593async ValueTask CheckFlagEnabledAsync(StrongBox<bool?> flag, string flagName, CSharpDirective directive)
netstandard (1)
netstandard.cs (1)
1576[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.StrongBox<>))]
Roslyn.Diagnostics.Analyzers (4)
src\roslyn\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)));
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)
251private static StrongBox<bool>? _isStdInRedirected; 252private static StrongBox<bool>? _isStdOutRedirected; 253private static StrongBox<bool>? _isStdErrRedirected; 259StrongBox<bool> redirected = Volatile.Read(ref _isStdInRedirected) ?? EnsureInitialized(); 262static StrongBox<bool> EnsureInitialized() 274StrongBox<bool> redirected = Volatile.Read(ref _isStdOutRedirected) ?? EnsureInitialized(); 277static StrongBox<bool> EnsureInitialized() 289StrongBox<bool> redirected = Volatile.Read(ref _isStdErrRedirected) ?? EnsureInitialized(); 292static StrongBox<bool> EnsureInitialized()
System.Core (1)
System.Core.cs (1)
195[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)
756private readonly StrongBox<int> _nullCase; 758internal 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)
1698var nullCase = new StrongBox<int>(1);
System\Linq\Expressions\Utils.cs (1)
58[DynamicDependency("Value", typeof(StrongBox<>))]
System.Private.CoreLib (6)
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (1)
53private readonly StrongBox<bool> m_lockObjAndDisposed;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (1)
376internal StrongBox<CancellationTokenRegistration>? m_cancellationRegistration; // Task's registration with the cancellation token
System.Runtime (1)
src\runtime\artifacts\obj\System.Runtime\Release\net11.0\System.Runtime.Forwards.cs (1)
648[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>(); 2002StrongBox<Task> boxedCompleted, CancellationTokenSource cts, 2080private readonly StrongBox<Task> _completed; 2085internal 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>>();