2 types derived from Lazy
System.ComponentModel.Composition (1)
System\ComponentModel\Composition\ExportServices.DisposableLazy.cs (1)
28private sealed class DisposableLazy<T> : Lazy<T>, IDisposable
System.Private.CoreLib (1)
src\libraries\System.Private.CoreLib\src\System\LazyOfTTMetadata.cs (1)
9public class Lazy<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] T, TMetadata> : Lazy<T>
863 instantiations of Lazy
aspire (1)
src\Shared\ColorGenerator.cs (1)
80return new Lazy<int>(() =>
Aspire.Azure.Data.Tables.Tests (1)
ConformanceTests.cs (1)
20private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Azure.Messaging.ServiceBus.Tests (2)
ConformanceTests_Queue.cs (1)
16private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
ConformanceTests_Topic.cs (1)
17private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Azure.Security.KeyVault.Tests (3)
CertificateClientConformanceTests.cs (1)
19private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
KeyClientConformanceTests.cs (1)
21private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
SecretClientConformanceTests.cs (1)
20private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Azure.Storage.Blobs.Tests (1)
ConformanceTests.cs (1)
20private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Azure.Storage.Files.DataLake.Tests (1)
ConformanceTests.cs (1)
18private static readonly Lazy<bool> s_canConnectToServer = new(CanConnect);
Aspire.Azure.Storage.Queues.Tests (1)
ConformanceTests.cs (1)
20private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Confluent.Kafka.Tests (5)
ReflectionHelpers.cs (5)
12public static readonly Lazy<Type> MetricsChannelType = new Lazy<Type>(() => ComponentAssembly.GetType("Aspire.Confluent.Kafka.MetricsChannel")!); 13public static readonly Lazy<Type> ProducerConnectionFactoryType = new Lazy<Type>(() => ComponentAssembly.GetType("Aspire.Confluent.Kafka.ProducerConnectionFactory`2")!); 14public static readonly Lazy<Type> ProducerConnectionFactoryStringKeyStringValueType = new Lazy<Type>(() => ProducerConnectionFactoryType.Value.MakeGenericType(typeof(string), typeof(string))); 15public static readonly Lazy<Type> ConsumerConnectionFactoryType = new Lazy<Type>(() => ComponentAssembly.GetType("Aspire.Confluent.Kafka.ConsumerConnectionFactory`2")!); 16public static readonly Lazy<Type> ConsumerConnectionFactoryStringKeyStringValueType = new Lazy<Type>(() => ConsumerConnectionFactoryType.Value.MakeGenericType(typeof(string), typeof(string)));
Aspire.Dashboard (5)
Model\ResourceViewModel.cs (3)
59public ImmutableArray<string> CachedAddresses => (_cachedAddresses ??= new Lazy<ImmutableArray<string>>(ExtractResourceAddresses)).Value; 338_tooltip = new(() => propertyViewModel.Value.HasStringValue ? propertyViewModel.Value.StringValue : propertyViewModel.Value.ToString()); 340_displayValue = new(() =>
src\Shared\ColorGenerator.cs (1)
80return new Lazy<int>(() =>
Utils\VersionHelpers.cs (1)
11private static readonly Lazy<string?> s_cachedRuntimeVersion = new Lazy<string?>(GetRuntimeVersion);
Aspire.Dashboard.Components.Tests (2)
UseCultureAttribute.cs (2)
45this._culture = new Lazy<CultureInfo>(() => new CultureInfo(culture, false)); 46this._uiCulture = new Lazy<CultureInfo>(() => new CultureInfo(uiCulture, false));
Aspire.EndToEnd.Tests (5)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
25public static Lazy<HttpClient> Client => new(CreateHttpClient);
tests\Shared\TemplatesTesting\BuildEnvironment.cs (4)
40private static readonly Lazy<BuildEnvironment> s_instance_80 = new(() => 43private static readonly Lazy<BuildEnvironment> s_instance_90 = new(() => 46private static readonly Lazy<BuildEnvironment> s_instance_100 = new(() => 49private static readonly Lazy<BuildEnvironment> s_instance_100_90_80 = new(() =>
Aspire.Hosting (10)
ApplicationModel\ParameterResource.cs (1)
30_lazyValue = new Lazy<string>(() => _valueGetter(Default));
DeveloperCertificateService.cs (3)
22_certificates = new Lazy<ImmutableList<X509Certificate2>>(() => 71_supportsContainerTrust = new Lazy<bool>(() => 78_supportsTlsTermination = new Lazy<bool>(() =>
DistributedApplicationOptions.cs (6)
31_assembly = new(ResolveAssembly); 32_projectDirectoryLazy = new(ResolveProjectDirectory); 33_projectNameLazy = new(ResolveProjectName); 34_dashboardApplicationNameLazy = new(ResolveDashboardApplicationName); 35_appHostFilePathLazy = new(ResolveAppHostFilePath); 36_configurationLazy = new(ResolveConfiguration);
Aspire.Hosting.Azure (7)
AzureResourcePreparer.cs (6)
312new(() => RoleManagementPrincipalType.ServicePrincipal), 313new(() => appIdentityResource.PrincipalId.AsProvisioningParameter(infra, parameterName: AzureBicepResource.KnownParameters.PrincipalId)), 314new(() => appIdentityResource.PrincipalName.AsProvisioningParameter(infra, parameterName: AzureBicepResource.KnownParameters.PrincipalName))); 417new(() => CreatePrincipalParam(AzureBicepResource.KnownParameters.PrincipalType)), 418new(() => CreatePrincipalParam(AzureBicepResource.KnownParameters.PrincipalId)), 419new(() => CreatePrincipalParam(AzureBicepResource.KnownParameters.PrincipalName)));
Provisioning\Provisioners\AzureProvisioner.cs (1)
166var provisioningContextLazy = new Lazy<Task<ProvisioningContext>>(() => provisioningContextProvider.CreateProvisioningContextAsync(cancellationToken));
Aspire.Hosting.JavaScript (1)
JavaScriptHostingExtensions.cs (1)
158var defaultBaseImage = new Lazy<string>(() => GetDefaultBaseImage(appDirectory, "alpine", dockerfileContext.Services));
Aspire.Hosting.RemoteHost.Tests (4)
AtsMarshallerTests.cs (1)
40return new AtsMarshaller(handles, context, ctRegistry, new Lazy<AtsCallbackProxyFactory>(() => throw new NotImplementedException()));
CallbackProxyTests.cs (1)
352var marshaller = new AtsMarshaller(handles, context, ctRegistry, new Lazy<AtsCallbackProxyFactory>(() => throw new NotImplementedException()));
CapabilityDispatcherTests.cs (2)
1330return new AtsMarshaller(handles, context, ctRegistry, new Lazy<AtsCallbackProxyFactory>(() => throw new NotImplementedException())); 1340var marshaller = new AtsMarshaller(handles, context, ctRegistry, new Lazy<AtsCallbackProxyFactory>(() => callbackFactory!));
Aspire.Hosting.Testing.Tests (1)
DistributedApplicationHttpClientExtensionsForTests.cs (1)
11private static readonly Lazy<IHttpClientFactory> s_httpClientFactory = new(CreateHttpClientFactoryWithResilience);
Aspire.Hosting.Tests (1)
tests\Aspire.Hosting.Testing.Tests\DistributedApplicationHttpClientExtensionsForTests.cs (1)
11private static readonly Lazy<IHttpClientFactory> s_httpClientFactory = new(CreateHttpClientFactoryWithResilience);
Aspire.StackExchange.Redis (1)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\Implementation\RedisProfilerEntryToActivityConverter.cs (1)
19private static readonly Lazy<Func<object, (string?, string?)>> MessageDataGetter = new(() =>
Aspire.Templates.Tests (6)
TemplateTestsBase.cs (1)
22private static Lazy<IBrowser> Browser => new(CreateBrowser);
tests\Shared\TemplatesTesting\AspireProject.cs (1)
25public static Lazy<HttpClient> Client => new(CreateHttpClient);
tests\Shared\TemplatesTesting\BuildEnvironment.cs (4)
40private static readonly Lazy<BuildEnvironment> s_instance_80 = new(() => 43private static readonly Lazy<BuildEnvironment> s_instance_90 = new(() => 46private static readonly Lazy<BuildEnvironment> s_instance_100 = new(() => 49private static readonly Lazy<BuildEnvironment> s_instance_100_90_80 = new(() =>
Aspire.TestUtilities (2)
UseCultureAttribute.cs (2)
26private readonly Lazy<CultureInfo> _culture = new(() => new(culture, useUserOverride: false)); 27private readonly Lazy<CultureInfo> _uiCulture = new(() => new(uiCulture, useUserOverride: false));
aspire-server (5)
AssemblyLoader.cs (1)
31_assemblies = new Lazy<IReadOnlyList<Assembly>>(() => LoadAssemblies(configuration, logger));
AtsContextFactory.cs (1)
19_context = new Lazy<AtsContext>(() => Create(assemblyLoader.GetAssemblies(), logger));
CodeGeneration\CodeGeneratorResolver.cs (1)
25_generators = new Lazy<Dictionary<string, ICodeGenerator>>(
Language\LanguageSupportResolver.cs (1)
25_languages = new Lazy<Dictionary<string, ILanguageSupport>>(
RemoteHostServer.cs (1)
59services.AddScoped(sp => new Lazy<AtsCallbackProxyFactory>(() => sp.GetRequiredService<AtsCallbackProxyFactory>()));
dotnet-svcutil-lib (2)
FrameworkFork\Microsoft.Xml\Xml\Serialization\SourceInfo.cs (1)
22private static readonly Lazy<MethodInfo> s_iListGetItemMethod = new Lazy<MethodInfo>(
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (1)
109_webSocketSoapContentType = new Lazy<string>(() => MessageEncoderFactory.CreateSessionEncoder().ContentType, LazyThreadSafetyMode.ExecutionAndPublication);
GenerateDocumentationAndConfigFiles (6)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
ILLink.RoslynAnalyzer (2)
DynamicallyAccessedMembersAnalyzer.cs (1)
27public static Lazy<ImmutableArray<RequiresAnalyzerBase>> RequiresAnalyzers { get; } = new Lazy<ImmutableArray<RequiresAnalyzerBase>>(GetRequiresAnalyzers);
TrimAnalysis\FlowAnnotations.cs (1)
18private static readonly Lazy<FlowAnnotations> _instance = new(() => new FlowAnnotations(), isThreadSafe: true);
Infrastructure.Common (1)
TestProperties.cs (1)
19private static Lazy<Dictionary<String, String>> s_properties = new Lazy<Dictionary<String, String>>(() =>
Metrics (6)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Metrics.Legacy (6)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Microsoft.AspNetCore.App.Analyzers.Test (1)
TestDiagnosticAnalyzer.cs (1)
118ExportProviderFactory = new Lazy<IExportProviderFactory>(
Microsoft.AspNetCore.DataProtection (3)
Internal\ContainerUtils.cs (1)
14private static readonly Lazy<bool> _isContainer = new Lazy<bool>(IsProcessRunningInContainer);
Repositories\DefaultKeyStorageDirectories.cs (1)
13private static readonly Lazy<DirectoryInfo?> _defaultDirectoryLazy = new Lazy<DirectoryInfo?>(GetKeyStorageDirectoryImpl);
Repositories\RegistryXmlRepository.cs (1)
23private static readonly Lazy<RegistryKey?> _defaultRegistryKeyLazy = new Lazy<RegistryKey?>(GetDefaultHklmStorageKey);
Microsoft.AspNetCore.DataProtection.Tests (3)
Internal\KeyManagementOptionsSetupTest.cs (1)
114private static readonly Lazy<RegistryKey> LazyHkcuTempKey = new Lazy<RegistryKey>(() =>
RegistryPolicyResolverTests.cs (1)
286private static readonly Lazy<RegistryKey> LazyHkcuTempKey = new Lazy<RegistryKey>(() =>
Repositories\RegistryXmlRepositoryTests.cs (1)
237private static readonly Lazy<RegistryKey> LazyHkcuTempKey = new Lazy<RegistryKey>(() =>
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
GrpcJsonTranscodingOptions.cs (2)
21_unaryOptions = new Lazy<JsonSerializerOptions>( 24_serverStreamingOptions = new Lazy<JsonSerializerOptions>(
Microsoft.AspNetCore.Http.Extensions (2)
src\Shared\ParameterBindingMethodCache.cs (2)
30private static readonly Lazy<ParameterBindingMethodCache> _instance = new(() => new ParameterBindingMethodCache()); 32private static readonly Lazy<ParameterBindingMethodCache> _nonThrowingInstance = new(() => new ParameterBindingMethodCache(throwOnInvalidMethod: false));
Microsoft.AspNetCore.HttpsPolicy (2)
HttpsRedirectionMiddleware.cs (2)
48_httpsPort = new Lazy<int>(httpsRedirectionOptions.HttpsPort.Value); 52_httpsPort = new Lazy<int>(TryGetHttpsPort);
Microsoft.AspNetCore.InternalTesting (1)
TestContext.cs (1)
34_files = new Lazy<TestFileOutputContext>(() => new TestFileOutputContext(this));
Microsoft.AspNetCore.Mvc.Abstractions (2)
src\Shared\ParameterBindingMethodCache.cs (2)
30private static readonly Lazy<ParameterBindingMethodCache> _instance = new(() => new ParameterBindingMethodCache()); 32private static readonly Lazy<ParameterBindingMethodCache> _nonThrowingInstance = new(() => new ParameterBindingMethodCache(throwOnInvalidMethod: false));
Microsoft.AspNetCore.Mvc.Core (1)
Filters\MiddlewareFilterBuilder.cs (1)
37key => new Lazy<RequestDelegate>(() => BuildPipeline(key)));
Microsoft.AspNetCore.OpenApi (2)
src\Shared\ParameterBindingMethodCache.cs (2)
30private static readonly Lazy<ParameterBindingMethodCache> _instance = new(() => new ParameterBindingMethodCache()); 32private static readonly Lazy<ParameterBindingMethodCache> _nonThrowingInstance = new(() => new ParameterBindingMethodCache(throwOnInvalidMethod: false));
Microsoft.AspNetCore.Server.IntegrationTesting (1)
Deployers\RemoteWindowsDeployer\RemoteWindowsDeployer.cs (1)
22private static readonly Lazy<Scripts> _scripts = new Lazy<Scripts>(CopyEmbeddedScriptFilesToDisk);
Microsoft.AspNetCore.SignalR.Core (2)
Internal\DefaultHubActivator.cs (1)
13private static readonly Lazy<ObjectFactory> _objectFactory = new Lazy<ObjectFactory>(() => ActivatorUtilities.CreateFactory(typeof(THub), Type.EmptyTypes));
Internal\TypedClientBuilder.cs (1)
17private static readonly Lazy<Func<IClientProxy, T>> _builder = new Lazy<Func<IClientProxy, T>>(GenerateClientBuilder);
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
Docker.cs (1)
22private static readonly Lazy<Docker> _instance = new Lazy<Docker>(Create);
Microsoft.AspNetCore.WebSockets.ConformanceTests (1)
Autobahn\Wstest.cs (1)
11private static readonly Lazy<Wstest> _instance = new Lazy<Wstest>(Create);
Microsoft.Build (38)
BackEnd\Components\Communications\TranslatorExtensions.cs (1)
23private static readonly Lazy<ConcurrentDictionary<Type, ConstructorInfo>> parameterlessConstructorCache = new Lazy<ConcurrentDictionary<Type, ConstructorInfo>>(() => new ConcurrentDictionary<Type, ConstructorInfo>());
BackEnd\Components\Logging\LoggingService.cs (3)
98private static readonly Lazy<PropertyInfo> s_projectStartedEventArgsGlobalProperties = new Lazy<PropertyInfo>(() => typeof(ProjectStartedEventArgs).GetProperty("GlobalProperties", BindingFlags.Public | BindingFlags.Instance), LazyThreadSafetyMode.PublicationOnly); 107private static readonly Lazy<PropertyInfo> s_projectStartedEventArgsToolsVersion = new Lazy<PropertyInfo>(() => typeof(ProjectStartedEventArgs).GetProperty("ToolsVersion", BindingFlags.Public | BindingFlags.Instance), LazyThreadSafetyMode.PublicationOnly); 317_configCache = new Lazy<IConfigCache>(() => (IConfigCache)_componentHost.GetComponent(BuildComponentType.ConfigCache), LazyThreadSafetyMode.PublicationOnly);
BackEnd\Components\ProjectCache\ProjectCacheService.cs (1)
170descriptor => new Lazy<Task<ProjectCachePlugin>>(() => CreateAndInitializePluginAsync(descriptor, projectGraph, buildRequestConfiguration, requestedTargets, cancellationToken)))
BackEnd\Components\SdkResolution\CachingSdkResolverService.cs (1)
63key => new Lazy<SdkResult>(() =>
BackEnd\Components\SdkResolution\OutOfProcNodeSdkResolverService.cs (1)
81key => new Lazy<SdkResult>(() =>
BackEnd\Components\SdkResolution\SdkResolverService.cs (1)
31private static readonly Lazy<SdkResolverService> InstanceLazy = new Lazy<SdkResolverService>(() => new SdkResolverService(), isThreadSafe: true);
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
Definition\Toolset.cs (2)
228_defaultSubToolsetVersionLazy = new Lazy<string>(ComputeDefaultSubToolsetVersion); 311_defaultSubToolsetVersionLazy = new Lazy<string>(ComputeDefaultSubToolsetVersion);
Definition\ToolsetConfigurationReader.cs (1)
51private static readonly Lazy<Configuration> s_configurationCache = new Lazy<Configuration>(ReadOpenMappedExeConfiguration);
Evaluation\IntrinsicFunctions.cs (1)
53private static readonly Lazy<NuGetFrameworkWrapper> NuGetFramework = new Lazy<NuGetFrameworkWrapper>(() => NuGetFrameworkWrapper.CreateInstance());
FileMatcher.cs (4)
52private static readonly Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>> s_cachedGlobExpansions = new Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>>(() => new ConcurrentDictionary<string, IReadOnlyList<string>>(StringComparer.OrdinalIgnoreCase)); 53private static readonly Lazy<ConcurrentDictionary<string, object>> s_cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase)); 54private static readonly Lazy<ConcurrentDictionary<string, (Regex regex, bool needsRecursion, bool isLegalFileSpec)>> s_regexCache = new(() =>new(StringComparer.Ordinal)); 57private readonly Lazy<ConcurrentDictionary<string, object>> _cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase));
FrameworkLocationHelper.cs (3)
237private static readonly Lazy<VisualStudioSpec[]> VisualStudioSpecs = new(() => 433private static readonly Lazy<IReadOnlyDictionary<Version, DotNetFrameworkSpec>> DotNetFrameworkSpecDict = new(() => DotNetFrameworkSpecs().ToDictionary(spec => spec.Version)); 434private static readonly Lazy<IReadOnlyDictionary<Version, VisualStudioSpec>> VisualStudioSpecDict = new(() => VisualStudioSpecs.Value.ToDictionary(spec => spec.Version));
Globbing\MSBuildGlob.cs (1)
183var lazyState = new Lazy<GlobState>(() =>
Graph\GraphBuilder.cs (1)
603new Lazy<ProjectInstance>(() => _projectInstanceFactory(projectPath, globalProperties, projectCollection))).Value;
Graph\ParallelWorkSet.cs (1)
112var workItem = new Lazy<TResult>(workFunc);
Graph\ProjectGraph.cs (1)
449_projectNodesTopologicallySorted = new Lazy<IReadOnlyCollection<ProjectGraphNode>>(() => TopologicalSort(GraphRoots, ProjectNodes));
InprocTrackingNativeMethods.cs (1)
153private static readonly Lazy<string> fileTrackerDllName = new Lazy<string>(() => RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "FileTrackerA4.dll" : (IntPtr.Size == sizeof(Int32)) ? "FileTracker32.dll" : "FileTracker64.dll");
Instance\HostServices.cs (2)
60private Lazy<IRunningObjectTableWrapper> _runningObjectTable = new Lazy<IRunningObjectTableWrapper>(() => new RunningObjectTable()); 380_runningObjectTable = new Lazy<IRunningObjectTableWrapper>(() => runningObjectTable);
Instance\TaskFactoryWrapper.cs (1)
100_propertyData = new Lazy<PropertyData>(PopulatePropertyInfo);
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 38new Lazy<PrintLineDebugger>(() => Create(null, null, false)); 41new Lazy<PrintLineDebugger>(() => Create(null, null, true));
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
RegisteredTaskObjectCacheBase.cs (2)
24private static readonly Lazy<ConcurrentDictionary<object, object>> s_appDomainLifetimeObjects = new Lazy<ConcurrentDictionary<object, object>>(); 29private Lazy<ConcurrentDictionary<object, object>> _buildLifetimeObjects = new Lazy<ConcurrentDictionary<object, object>>();
Resources\MSBuildAssemblyFileVersion.cs (1)
17private static readonly Lazy<MSBuildAssemblyFileVersion> MSBuildAssemblyFileVersionLazy = new Lazy<MSBuildAssemblyFileVersion>(GetMSBuildAssemblyFileVersion, isThreadSafe: true);
TypeLoader.cs (1)
84private static readonly Lazy<string[]> runtimeAssembliesCLR35_20 = new Lazy<string[]>(FindRuntimeAssembliesWithMicrosoftBuildFrameworkCLR2CLR35);
Utilities\EngineFileUtilities.cs (2)
588private static readonly Lazy<ConcurrentDictionary<string, bool>> _regexMatchCache = new Lazy<ConcurrentDictionary<string, bool>>(() => new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase)); 599private readonly Lazy<ConcurrentDictionary<string, bool>> existenceCache = new Lazy<ConcurrentDictionary<string, bool>>(() => new ConcurrentDictionary<string, bool>(), true);
Microsoft.Build.Engine.OM.UnitTests (5)
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 38new Lazy<PrintLineDebugger>(() => Create(null, null, false)); 41new Lazy<PrintLineDebugger>(() => Create(null, null, true));
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
Microsoft.Build.Engine.UnitTests (1)
ProjectCache\ProjectCacheTests.cs (1)
75new Lazy<string>(
Microsoft.Build.Framework (5)
AssemblyUtilities.cs (2)
30private static Lazy<CultureInfo[]> s_validCultures = new Lazy<CultureInfo[]>(() => GetValidCultures(), true); 33private static Lazy<Assembly> s_entryAssembly = new Lazy<Assembly>(() => GetEntryAssembly());
FileClassifier.cs (1)
76private static readonly Lazy<FileClassifier> s_sharedInstance = new(() => new FileClassifier());
FileUtilities_TempFiles.cs (1)
24return new Lazy<string>(
NativeMethods.cs (1)
844private static readonly Lazy<bool> s_isFileSystemCaseSensitive = new(() =>
Microsoft.Build.Tasks.Core (34)
AssemblyDependency\AssemblyFoldersFromConfig\AssemblyFoldersFromConfigResolver.cs (1)
26private static readonly Lazy<Regex> s_crackAssemblyFoldersFromConfigSentinel = new Lazy<Regex>(
CultureInfoCache.cs (1)
27private static readonly Lazy<HashSet<string>> ValidCultureNames = new Lazy<HashSet<string>>(() => InitializeValidCultureNames());
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
Exec.cs (1)
498private static readonly Lazy<string> CommandProcessorPath = new Lazy<string>(() =>
FileMatcher.cs (4)
52private static readonly Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>> s_cachedGlobExpansions = new Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>>(() => new ConcurrentDictionary<string, IReadOnlyList<string>>(StringComparer.OrdinalIgnoreCase)); 53private static readonly Lazy<ConcurrentDictionary<string, object>> s_cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase)); 54private static readonly Lazy<ConcurrentDictionary<string, (Regex regex, bool needsRecursion, bool isLegalFileSpec)>> s_regexCache = new(() =>new(StringComparer.Ordinal)); 57private readonly Lazy<ConcurrentDictionary<string, object>> _cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase));
FileState.cs (3)
243_data = new Lazy<FileDirInfo>(() => new FileDirInfo(Path)); 312_data = new Lazy<FileDirInfo>(() => new FileDirInfo(value)); 335_data = new Lazy<FileDirInfo>(() => new FileDirInfo(Path));
GetFrameworkPath.cs (16)
36private static readonly Lazy<string> s_path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Latest)); 37private static readonly Lazy<string> s_version11Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version11)); 38private static readonly Lazy<string> s_version20Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version20)); 39private static readonly Lazy<string> s_version30Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version30)); 40private static readonly Lazy<string> s_version35Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version35)); 41private static readonly Lazy<string> s_version40Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version40)); 42private static readonly Lazy<string> s_version45Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version45)); 43private static readonly Lazy<string> s_version451Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version451)); 44private static readonly Lazy<string> s_version452Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version452)); 45private static readonly Lazy<string> s_version46Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version46)); 46private static readonly Lazy<string> s_version461Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version461)); 47private static readonly Lazy<string> s_version462Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version462)); 48private static readonly Lazy<string> s_version47Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version47)); 49private static readonly Lazy<string> s_version471Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version471)); 50private static readonly Lazy<string> s_version472Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version472)); 51private static readonly Lazy<string> s_version48Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version48));
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 38new Lazy<PrintLineDebugger>(() => Create(null, null, false)); 41new Lazy<PrintLineDebugger>(() => Create(null, null, true));
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
RoslynCodeTaskFactory\RoslynCodeTaskFactory.cs (1)
92private static readonly Lazy<string> ThisAssemblyDirectoryLazy = new Lazy<string>(() => Path.GetDirectoryName(typeof(RoslynCodeTaskFactory).GetTypeInfo().Assembly.ManifestModule.FullyQualifiedName));
RoslynCodeTaskFactory\RoslynCodeTaskFactoryCompilers.cs (1)
29_executablePath = new Lazy<string>(() =>
WriteCodeFragment.cs (1)
278Lazy<Type> attributeType = new(
Microsoft.Build.UnitTests.Shared (2)
DummyMappedDriveUtils.cs (1)
23public static Lazy<DummyMappedDrive?> GetLazyDummyMappedDrive() => new Lazy<DummyMappedDrive?>(() =>
TestEnvironment.cs (1)
85_defaultTestDirectory = new Lazy<TransientTestFolder>(() => CreateFolder());
Microsoft.Build.Utilities.Core (12)
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
FileMatcher.cs (4)
52private static readonly Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>> s_cachedGlobExpansions = new Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>>(() => new ConcurrentDictionary<string, IReadOnlyList<string>>(StringComparer.OrdinalIgnoreCase)); 53private static readonly Lazy<ConcurrentDictionary<string, object>> s_cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase)); 54private static readonly Lazy<ConcurrentDictionary<string, (Regex regex, bool needsRecursion, bool isLegalFileSpec)>> s_regexCache = new(() =>new(StringComparer.Ordinal)); 57private readonly Lazy<ConcurrentDictionary<string, object>> _cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase));
FrameworkLocationHelper.cs (3)
237private static readonly Lazy<VisualStudioSpec[]> VisualStudioSpecs = new(() => 433private static readonly Lazy<IReadOnlyDictionary<Version, DotNetFrameworkSpec>> DotNetFrameworkSpecDict = new(() => DotNetFrameworkSpecs().ToDictionary(spec => spec.Version)); 434private static readonly Lazy<IReadOnlyDictionary<Version, VisualStudioSpec>> VisualStudioSpecDict = new(() => VisualStudioSpecs.Value.ToDictionary(spec => spec.Version));
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 38new Lazy<PrintLineDebugger>(() => Create(null, null, false)); 41new Lazy<PrintLineDebugger>(() => Create(null, null, true));
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
Microsoft.CodeAnalysis (15)
AdditionalTextFile.cs (1)
34_text = new Lazy<SourceText?>(ReadText);
CommandLine\CommandLineArguments.cs (1)
319_lazyManifestResources = new Lazy<ImmutableArray<ResourceDescription>>(
CommandLine\CommonCompiler.cs (1)
74private readonly Lazy<Encoding> _fallbackEncoding = new Lazy<Encoding>(EncodedStringText.CreateFallbackEncoding);
CommandLine\CommonCompiler.ExistingReferencesResolver.cs (1)
37_lazyAvailableReferences = new Lazy<HashSet<AssemblyIdentity>>(() => new HashSet<AssemblyIdentity>(
Compilation\Compilation.cs (1)
95_lazyDataSectionStringLiteralThreshold = new Lazy<int?>(ComputeDataSectionStringLiteralThreshold);
Compilation\CompilationOptions.cs (1)
326_lazyErrors = new Lazy<ImmutableArray<Diagnostic>>(() =>
Compilation\ParseOptions.cs (1)
45_lazyErrors = new Lazy<ImmutableArray<Diagnostic>>(() =>
DiagnosticAnalyzer\AnalysisScope.cs (1)
154_lazyAnalyzersSet = new Lazy<ImmutableHashSet<DiagnosticAnalyzer>>(CreateAnalyzersSet);
DiaSymReader\SymUnmanagedFactory.cs (1)
79private static readonly Lazy<Func<string, string>> s_lazyGetEnvironmentVariable = new Lazy<Func<string, string>>(() =>
Emit\CommonPEModuleBuilder.cs (1)
73_stringsInILMap = new Lazy<StringTokenMap>(() => new StringTokenMap(PreviousGeneration?.UserStringStreamLength ?? 0));
EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
MetadataReader\PEModule.cs (2)
157_lazyTypeNameCollection = new Lazy<IdentifierCollection>(ComputeTypeNameCollection); 158_lazyNamespaceNameCollection = new Lazy<IdentifierCollection>(ComputeNamespaceNameCollection);
SourceGeneration\SyntaxStore.cs (2)
89var root = new Lazy<SyntaxNode>(() => tree.GetRoot(_cancellationToken)); 90var model = state != EntryState.Removed ? new Lazy<SemanticModel>(() => _compilation.GetSemanticModel(tree)) : null;
Microsoft.CodeAnalysis.Analyzers (7)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (1)
441_lazySymbols = new Lazy<ImmutableArray<ISymbol>>(
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Microsoft.CodeAnalysis.AnalyzerUtilities (13)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAnalysis.TaintedDataOperationVisitor.cs (4)
310new Lazy<PointsToAnalysisResult?>(() => DataFlowAnalysisContext.PointsToAnalysisResult), 311new Lazy<(PointsToAnalysisResult?, ValueContentAnalysisResult?)>(() => (DataFlowAnalysisContext.PointsToAnalysisResult, DataFlowAnalysisContext.ValueContentAnalysisResult)), 686Lazy<HashSet<SinkKind>> lazySinkKinds = new Lazy<HashSet<SinkKind>>(() => []); 727Lazy<HashSet<SinkKind>> lazySinkKinds = new Lazy<HashSet<SinkKind>>(() => []);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataConfig.cs (3)
119lazySourceSymbolMap = new Lazy<TaintedDataSymbolMap<SourceInfo>>( 130lazySanitizerSymbolMap = new Lazy<TaintedDataSymbolMap<SanitizerInfo>>( 152Lazy<TaintedDataSymbolMap<SinkInfo>> lazySinkSymbolMap = new Lazy<TaintedDataSymbolMap<SinkInfo>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Microsoft.CodeAnalysis.BannedApiAnalyzers (7)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
SymbolIsBannedAnalyzerBase.cs (1)
441_lazySymbols = new Lazy<ImmutableArray<ISymbol>>(
Microsoft.CodeAnalysis.CodeStyle (4)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
41_lazySupportedCompilerErrorCodes = new Lazy<ImmutableHashSet<int>>(GetSupportedCompilerErrorCodes);
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
Host\Mef\CodeStyleHostLanguageServices.cs (1)
77=> _compositionContext.GetExports<TExtension>().Select(e => new Lazy<TExtension>(() => e));
Microsoft.CodeAnalysis.CSharp (4)
CommandLine\CommandLineDiagnosticFormatter.cs (1)
25_lazyNormalizedBaseDirectory = new Lazy<string>(() => FileUtilities.TryNormalizeAbsolutePath(baseDirectory));
Compilation\MemberSemanticModel.cs (1)
63_operationFactory = new Lazy<CSharpOperationFactory>(() => new CSharpOperationFactory(this));
Compilation\SyntaxAndDeclarationManager.cs (1)
299var lazyRoot = new Lazy<RootSingleNamespaceDeclaration>(() => DeclarationTreeBuilder.ForTree(tree, scriptClassName, isSubmission, lastComputedMemberNames));
Errors\ErrorFacts.cs (1)
21private static readonly Lazy<ImmutableDictionary<ErrorCode, string>> s_categoriesMap = new Lazy<ImmutableDictionary<ErrorCode, string>>(CreateCategoriesMap);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
PdbSourceDocument\PdbSourceDocumentLoaderServiceTests.cs (2)
38var sourceLinkService = new Lazy<ISourceLinkService>(() => new TestSourceLinkService(sourceFilePath: sourceFilePath)); 69var sourceLinkService = new Lazy<ISourceLinkService>(() => new TestSourceLinkService(sourceFilePath: sourceFilePath));
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (1)
InteractiveSessionReferencesTests.cs (1)
238private static readonly Lazy<bool> s_isSystemV2AndV4Available = new Lazy<bool>(() =>
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
ObjectFormatterTests.cs (1)
754var obj = new Lazy<int[]>(() => new int[] { 1, 2 }, LazyThreadSafetyMode.None);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
DeclarationTests.cs (1)
197return new Lazy<RootSingleNamespaceDeclaration>(() => decl);
Microsoft.CodeAnalysis.EditorFeatures (5)
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (3)
112private static readonly Lazy<NamingRuleComparerIgnoreGUIDs> s_lazyInstance = new(() => new NamingRuleComparerIgnoreGUIDs()); 133private static readonly Lazy<NamingStyleComparerIgnoreGUIDs> s_lazyInstance = new(() => new NamingStyleComparerIgnoreGUIDs()); 158private static readonly Lazy<SymbolSpecificationComparerIgnoreGUIDs> s_lazyInstance = new(() => new SymbolSpecificationComparerIgnoreGUIDs());
InlineRename\UI\SmartRename\SmartRenameUserInputComboBox.xaml.cs (1)
36_innerTextBox = new Lazy<TextBox>(() =>
NavigateTo\DefaultNavigateToPreviewServiceFactory.cs (1)
18new(() => new DefaultNavigateToPreviewService());
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (4)
CodeFixes\CodeFixServiceTests.cs (3)
53var logger = SpecializedCollections.SingletonEnumerable(new Lazy<IErrorLoggerService>(() => workspace.Services.GetRequiredService<IErrorLoggerService>())); 345var logger = SpecializedCollections.SingletonEnumerable(new Lazy<IErrorLoggerService>(() => new TestErrorLogger())); 741var logger = SpecializedCollections.SingletonEnumerable(new Lazy<IErrorLoggerService>(() => workspace.Services.GetRequiredService<IErrorLoggerService>()));
Diagnostics\SuppressMessageAttributeWorkspaceTests.cs (1)
26private static readonly Lazy<MetadataReference> _unconditionalSuppressMessageRef = new(() =>
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
ExpressionCompiler.cs (1)
381new Lazy<ImmutableArray<AssemblyReaders>>(instructionAddress.MakeAssemblyReaders, LazyThreadSafetyMode.None),
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
Debugger\Engine\DkmClrType.cs (1)
47_lazyEvalAttributes = new System.Lazy<ReadOnlyCollection<DkmClrEvalAttribute>>(
Microsoft.CodeAnalysis.Features (20)
CodeFixes\Service\CodeFixService.cs (5)
68_fixersPerLanguageMap = new(() => _fixers.ToPerLanguageMapWithMultipleLanguages()); 70_configurationProvidersMap = new(() => GetConfigurationProvidersPerLanguageMap(configurationProviders)); 910var lazyMap = new Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>(() => 949var lazyConfigurationFixers = new Lazy<ImmutableArray<IConfigurationFixProvider>>(() => GetConfigurationFixProviders(lazyFixers)); 971var lazyMap = new Lazy<ImmutableDictionary<CodeFixProvider, int>>(() =>
CodeRefactorings\CodeRefactoringService.cs (3)
34new(() => 39new Lazy<ImmutableArray<CodeRefactoringProvider>>(() => [.. ExtensionOrderer.Order(grp).Select(lz => lz.Value)]))))); 41private readonly Lazy<ImmutableDictionary<CodeRefactoringProvider, CodeChangeProviderMetadata>> _lazyRefactoringToMetadataMap = new(() => providers.Where(provider => provider.IsValueCreated).ToImmutableDictionary(provider => provider.Value, provider => provider.Metadata));
Completion\CompletionList.cs (1)
83_lazyItems = new(() => ItemsList.ToImmutableArrayOrEmpty(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
Completion\CompletionService.ProviderManager.cs (1)
40_nameToProvider = new Lazy<ImmutableDictionary<string, CompletionProvider>>(LoadImportedProvidersAndCreateNameMap, LazyThreadSafetyMode.PublicationOnly);
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (1)
121var editorBrowsableInfo = new Lazy<EditorBrowsableInfo>(() => new EditorBrowsableInfo(originCompilation));
Completion\Providers\Scripting\GlobalAssemblyCacheCompletionHelper.cs (1)
19new(() => [.. GlobalAssemblyCache.Instance.GetAssemblySimpleNames()]);
Completion\SharedSyntaxContextsWithSpeculativeModel.cs (1)
28_lazyRelatedDocumentIds = new(_document.GetLinkedDocumentIds, isThreadSafe: true);
EditAndContinue\EditAndContinueDebugInfoReader.cs (1)
131_lazyDefaultSourceFileEncoding = new(ReadDefaultSourceFileEncoding);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs (1)
58_lazyAnalyzers = new Lazy<ImmutableArray<IUnitTestingIncrementalAnalyzer>>(() => analyzers.Add(analyzer));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs (1)
57var lazyAllAnalyzers = new Lazy<ImmutableArray<IUnitTestingIncrementalAnalyzer>>(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: false));
Intents\IntentDataProvider.cs (1)
15private static readonly Lazy<JsonSerializerOptions> s_serializerOptions = new(() =>
MetadataAsSource\MetadataAsSourceFileService.cs (1)
61_providers = new(() => [.. ExtensionOrderer.Order(providers)]);
NavigateTo\RoslynNavigateToItem.cs (1)
120_secondarySort = new Lazy<string>(ComputeSecondarySort);
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
41_lazySupportedCompilerErrorCodes = new Lazy<ImmutableHashSet<int>>(GetSupportedCompilerErrorCodes);
Microsoft.CodeAnalysis.LanguageServer (5)
DotnetCliHelper.cs (1)
27_dotnetExecutablePath = new Lazy<string>(() => GetDotNetPathOrDefault());
FileBasedPrograms\CanonicalMiscFilesProjectLoader.cs (1)
55_canonicalDocumentPath = new Lazy<string>(() =>
HostWorkspace\FileWatching\DelegatingFileChangeWatcher.cs (1)
32private readonly Lazy<IFileChangeWatcher> _underlyingFileWatcher = new(() =>
HostWorkspace\LoadedProject.cs (1)
248_mostRecentFileMatchers = new Lazy<ImmutableArray<Matcher>>(() =>
Logging\LspLogMessageLogger.cs (1)
18private readonly Lazy<ILogger> _fallbackLogger = new(() => fallbackLoggerFactory.CreateLogger(categoryName));
Microsoft.CodeAnalysis.LanguageServer.Protocol (8)
LspServices\AbstractExportLspServiceAttribute.cs (1)
78? new(() => CreateMethodHandlerData(serviceType))
RoslynLanguageServer.cs (1)
26private static readonly Lazy<int> s_currentProcessId = new(static () => { using var process = Process.GetCurrentProcess(); return process.Id; });
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\AbstractLanguageServer.cs (3)
74_lspServices = new Lazy<ILspServices>(() => ConstructLspServices()); 75_queue = new Lazy<IRequestExecutionQueue<TRequestContext>>(() => ConstructRequestExecutionQueue()); 76_handlerProvider = new Lazy<AbstractHandlerProvider>(() =>
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\HandlerProvider.cs (2)
100return new(() => instance); 105return new(() =>
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\RequestExecutionQueue.cs (1)
106languages.Add(metadata.Language, new(() =>
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Microsoft.CodeAnalysis.PublicApiAnalyzers (7)
DeclarePublicApiAnalyzer.Impl.cs (1)
95_apiMap = new Lazy<IReadOnlyDictionary<string, ApiLine>>(() => CreateApiMap(shippedData, unshippedData));
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Host\RemoteWorkspaceManager.cs (1)
48private static readonly Lazy<RemoteWorkspaceManager> s_default = new(static () =>
Microsoft.CodeAnalysis.ResxSourceGenerator (6)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Microsoft.CodeAnalysis.SemanticSearch.Extensions (2)
ProjectModel.cs (2)
30_lazyResxFiles = new(LoadResxFiles, isThreadSafe: true); 36_lazyResxFiles = new(() => resxFiles, isThreadSafe: true);
Microsoft.CodeAnalysis.Test.Utilities (180)
Assert\ConditionalFactAttribute.cs (1)
171private static readonly Lazy<bool> s_operatingSystemRestrictsFileNames = new Lazy<bool>(() =>
Assert\UseCultureAttribute.cs (2)
58_culture = new Lazy<CultureInfo>(() => new CultureInfo(culture, useUserOverride: false)); 59_uiCulture = new Lazy<CultureInfo>(() => new CultureInfo(uiCulture, useUserOverride: false));
Mocks\Silverlight.cs (1)
29private static readonly Lazy<(byte[], byte[])> s_tuple = new Lazy<(byte[], byte[])>(
Mocks\TestReferences.cs (147)
21private static readonly Lazy<PortableExecutableReference> s_appCS = new Lazy<PortableExecutableReference>( 26private static readonly Lazy<PortableExecutableReference> s_moduleCS00 = new Lazy<PortableExecutableReference>( 31private static readonly Lazy<PortableExecutableReference> s_moduleCS01 = new Lazy<PortableExecutableReference>( 36private static readonly Lazy<PortableExecutableReference> s_moduleVB01 = new Lazy<PortableExecutableReference>( 44private static readonly Lazy<PortableExecutableReference> s_CSClasses01 = new Lazy<PortableExecutableReference>( 49private static readonly Lazy<PortableExecutableReference> s_CSInterfaces01 = new Lazy<PortableExecutableReference>( 54private static readonly Lazy<PortableExecutableReference> s_VBClasses01 = new Lazy<PortableExecutableReference>( 59private static readonly Lazy<PortableExecutableReference> s_VBClasses02 = new Lazy<PortableExecutableReference>( 64private static readonly Lazy<PortableExecutableReference> s_VBInterfaces01 = new Lazy<PortableExecutableReference>( 75private static readonly Lazy<PortableExecutableReference> s_mincorlib = new Lazy<PortableExecutableReference>( 80private static readonly Lazy<PortableExecutableReference> s_minasync = new Lazy<PortableExecutableReference>( 85private static readonly Lazy<PortableExecutableReference> s_minasynccorlib = new Lazy<PortableExecutableReference>( 93private static readonly Lazy<PortableExecutableReference> s_tuplelib = new Lazy<PortableExecutableReference>( 101private static readonly Lazy<PortableExecutableReference> s_system = new Lazy<PortableExecutableReference>( 112private static readonly Lazy<PortableExecutableReference> s_errTestLib01 = new Lazy<PortableExecutableReference>( 120private static readonly Lazy<PortableExecutableReference> s_errTestLib02 = new Lazy<PortableExecutableReference>( 128private static readonly Lazy<PortableExecutableReference> s_errTestLib11 = new Lazy<PortableExecutableReference>( 136private static readonly Lazy<PortableExecutableReference> s_errTestMod01 = new Lazy<PortableExecutableReference>( 144private static readonly Lazy<PortableExecutableReference> s_errTestMod02 = new Lazy<PortableExecutableReference>( 152private static readonly Lazy<PortableExecutableReference> s_badresfile = new Lazy<PortableExecutableReference>( 161private static readonly Lazy<PortableExecutableReference> s_mdTestLib1 = new Lazy<PortableExecutableReference>( 166private static readonly Lazy<PortableExecutableReference> s_mdTestLib2 = new Lazy<PortableExecutableReference>( 171private static readonly Lazy<PortableExecutableReference> s_VBConversions = new Lazy<PortableExecutableReference>( 176private static readonly Lazy<PortableExecutableReference> s_withSpaces = new Lazy<PortableExecutableReference>( 181private static readonly Lazy<PortableExecutableReference> s_withSpacesModule = new Lazy<PortableExecutableReference>( 186private static readonly Lazy<PortableExecutableReference> s_inheritIComparable = new Lazy<PortableExecutableReference>( 191private static readonly Lazy<PortableExecutableReference> s_bigVisitor = new Lazy<PortableExecutableReference>( 196private static readonly Lazy<PortableExecutableReference> s_properties = new Lazy<PortableExecutableReference>( 201private static readonly Lazy<PortableExecutableReference> s_propertiesWithByRef = new Lazy<PortableExecutableReference>( 206private static readonly Lazy<PortableExecutableReference> s_indexers = new Lazy<PortableExecutableReference>( 211private static readonly Lazy<PortableExecutableReference> s_events = new Lazy<PortableExecutableReference>( 218private static readonly Lazy<PortableExecutableReference> s_netModule1 = new Lazy<PortableExecutableReference>( 223private static readonly Lazy<PortableExecutableReference> s_netModule2 = new Lazy<PortableExecutableReference>( 228private static readonly Lazy<PortableExecutableReference> s_crossRefModule1 = new Lazy<PortableExecutableReference>( 233private static readonly Lazy<PortableExecutableReference> s_crossRefModule2 = new Lazy<PortableExecutableReference>( 238private static readonly Lazy<PortableExecutableReference> s_crossRefLib = new Lazy<PortableExecutableReference>( 246private static readonly Lazy<PortableExecutableReference> s_hash_module = new Lazy<PortableExecutableReference>( 251private static readonly Lazy<PortableExecutableReference> s_x64COFF = new Lazy<PortableExecutableReference>( 261private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 269private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 277private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib2 = new Lazy<PortableExecutableReference>( 285private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 296private static readonly Lazy<PortableExecutableReference> s_v2MTTestLib1 = new Lazy<PortableExecutableReference>( 304private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 312private static readonly Lazy<PortableExecutableReference> s_v2MTTestLib3 = new Lazy<PortableExecutableReference>( 320private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 331private static readonly Lazy<PortableExecutableReference> s_v3MTTestLib1 = new Lazy<PortableExecutableReference>( 339private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 347private static readonly Lazy<PortableExecutableReference> s_v3MTTestLib4 = new Lazy<PortableExecutableReference>( 355private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 364private static readonly Lazy<PortableExecutableReference> s_assembly = new Lazy<PortableExecutableReference>( 372private static readonly Lazy<PortableExecutableReference> s_mod2 = new Lazy<PortableExecutableReference>( 377private static readonly Lazy<PortableExecutableReference> s_mod3 = new Lazy<PortableExecutableReference>( 382private static readonly Lazy<PortableExecutableReference> s_consumer = new Lazy<PortableExecutableReference>( 390private static readonly Lazy<PortableExecutableReference> s_typeAndNamespaceDifferByCase = new Lazy<PortableExecutableReference>( 395private static readonly Lazy<PortableExecutableReference> s_differByCaseConsumer = new Lazy<PortableExecutableReference>( 400private static readonly Lazy<PortableExecutableReference> s_csharpCaseSen = new Lazy<PortableExecutableReference>( 405private static readonly Lazy<PortableExecutableReference> s_csharpDifferCaseOverloads = new Lazy<PortableExecutableReference>( 415private static readonly Lazy<PortableExecutableReference> s_exe = new Lazy<PortableExecutableReference>( 421private static readonly Lazy<PortableExecutableReference> s_noMsCorLibRef = new Lazy<PortableExecutableReference>( 428private static readonly Lazy<PortableExecutableReference> s_dll = new Lazy<PortableExecutableReference>( 439private static readonly Lazy<PortableExecutableReference> s_dll = new Lazy<PortableExecutableReference>( 444private static readonly Lazy<PortableExecutableReference> s_module = new Lazy<PortableExecutableReference>( 450private static readonly Lazy<PortableExecutableReference> s_modoptTests = new Lazy<PortableExecutableReference>( 457private static readonly Lazy<PortableExecutableReference> s_dll = new Lazy<PortableExecutableReference>( 465private static readonly Lazy<PortableExecutableReference> s_dll = new Lazy<PortableExecutableReference>( 476private static readonly Lazy<PortableExecutableReference> s_cyclic1 = new Lazy<PortableExecutableReference>( 484private static readonly Lazy<PortableExecutableReference> s_cyclic2 = new Lazy<PortableExecutableReference>( 493private static readonly Lazy<PortableExecutableReference> s_class1 = new Lazy<PortableExecutableReference>( 498private static readonly Lazy<PortableExecutableReference> s_class2 = new Lazy<PortableExecutableReference>( 503private static readonly Lazy<PortableExecutableReference> s_class3 = new Lazy<PortableExecutableReference>( 509private static readonly Lazy<PortableExecutableReference> s_cycledStructs = new Lazy<PortableExecutableReference>( 520private static readonly Lazy<PortableExecutableReference> s_classA = new Lazy<PortableExecutableReference>( 528private static readonly Lazy<PortableExecutableReference> s_classB = new Lazy<PortableExecutableReference>( 539private static readonly Lazy<PortableExecutableReference> s_classA = new Lazy<PortableExecutableReference>( 547private static readonly Lazy<PortableExecutableReference> s_classB = new Lazy<PortableExecutableReference>( 557private static readonly Lazy<PortableExecutableReference> s_CSMethods = new Lazy<PortableExecutableReference>( 562private static readonly Lazy<PortableExecutableReference> s_VBMethods = new Lazy<PortableExecutableReference>( 567private static readonly Lazy<PortableExecutableReference> s_ILMethods = new Lazy<PortableExecutableReference>( 572private static readonly Lazy<PortableExecutableReference> s_byRefReturn = new Lazy<PortableExecutableReference>( 582private static readonly Lazy<PortableExecutableReference> s_CSFields = new Lazy<PortableExecutableReference>( 590private static readonly Lazy<PortableExecutableReference> s_VBFields = new Lazy<PortableExecutableReference>( 596private static readonly Lazy<PortableExecutableReference> s_constantFields = new Lazy<PortableExecutableReference>( 604private static readonly Lazy<PortableExecutableReference> s_MDMissingType = new Lazy<PortableExecutableReference>( 609private static readonly Lazy<PortableExecutableReference> s_MDMissingTypeLib = new Lazy<PortableExecutableReference>( 614private static readonly Lazy<PortableExecutableReference> s_missingTypesEquality1 = new Lazy<PortableExecutableReference>( 619private static readonly Lazy<PortableExecutableReference> s_missingTypesEquality2 = new Lazy<PortableExecutableReference>( 624private static readonly Lazy<PortableExecutableReference> s_CL2 = new Lazy<PortableExecutableReference>( 629private static readonly Lazy<PortableExecutableReference> s_CL3 = new Lazy<PortableExecutableReference>( 639private static readonly Lazy<PortableExecutableReference> s_typeForwarder2 = new Lazy<PortableExecutableReference>( 647private static readonly Lazy<PortableExecutableReference> s_typeForwarderLib2 = new Lazy<PortableExecutableReference>( 655private static readonly Lazy<PortableExecutableReference> s_typeForwarderBase2 = new Lazy<PortableExecutableReference>( 664private static readonly Lazy<PortableExecutableReference> s_source1Module = new Lazy<PortableExecutableReference>( 669private static readonly Lazy<PortableExecutableReference> s_source3Module = new Lazy<PortableExecutableReference>( 674private static readonly Lazy<PortableExecutableReference> s_source4Module = new Lazy<PortableExecutableReference>( 679private static readonly Lazy<PortableExecutableReference> s_source5Module = new Lazy<PortableExecutableReference>( 684private static readonly Lazy<PortableExecutableReference> s_source7Module = new Lazy<PortableExecutableReference>( 692private static readonly Lazy<PortableExecutableReference> s_stdOleNetFramework = new Lazy<PortableExecutableReference>( 696private static readonly Lazy<PortableExecutableReference> s_stdOleNet40 = new Lazy<PortableExecutableReference>( 700private static readonly Lazy<PortableExecutableReference> s_pia1 = new Lazy<PortableExecutableReference>( 705private static readonly Lazy<PortableExecutableReference> s_pia1Copy = new Lazy<PortableExecutableReference>( 710private static readonly Lazy<PortableExecutableReference> s_pia2 = new Lazy<PortableExecutableReference>( 715private static readonly Lazy<PortableExecutableReference> s_pia3 = new Lazy<PortableExecutableReference>( 720private static readonly Lazy<PortableExecutableReference> s_pia4 = new Lazy<PortableExecutableReference>( 725private static readonly Lazy<PortableExecutableReference> s_pia5 = new Lazy<PortableExecutableReference>( 730private static readonly Lazy<PortableExecutableReference> s_generalPia = new Lazy<PortableExecutableReference>( 735private static readonly Lazy<PortableExecutableReference> s_generalPiaCopy = new Lazy<PortableExecutableReference>( 740private static readonly Lazy<PortableExecutableReference> s_noPIAGenericsAsm1 = new Lazy<PortableExecutableReference>( 745private static readonly Lazy<PortableExecutableReference> s_externalAsm1 = new Lazy<PortableExecutableReference>( 750private static readonly Lazy<PortableExecutableReference> s_library1 = new Lazy<PortableExecutableReference>( 755private static readonly Lazy<PortableExecutableReference> s_library2 = new Lazy<PortableExecutableReference>( 760private static readonly Lazy<PortableExecutableReference> s_localTypes1 = new Lazy<PortableExecutableReference>( 765private static readonly Lazy<PortableExecutableReference> s_localTypes2 = new Lazy<PortableExecutableReference>( 770private static readonly Lazy<PortableExecutableReference> s_localTypes3 = new Lazy<PortableExecutableReference>( 775private static readonly Lazy<PortableExecutableReference> s_A = new Lazy<PortableExecutableReference>( 780private static readonly Lazy<PortableExecutableReference> s_B = new Lazy<PortableExecutableReference>( 785private static readonly Lazy<PortableExecutableReference> s_C = new Lazy<PortableExecutableReference>( 790private static readonly Lazy<PortableExecutableReference> s_D = new Lazy<PortableExecutableReference>( 799private static readonly Lazy<PortableExecutableReference> s_missingPIAAttributes = new Lazy<PortableExecutableReference>( 809private static readonly Lazy<PortableExecutableReference> s_staticMethodInInterface = new Lazy<PortableExecutableReference>( 814private static readonly Lazy<PortableExecutableReference> s_MDInterfaceMapping = new Lazy<PortableExecutableReference>( 822private static readonly Lazy<PortableExecutableReference> s_MDTestLib1 = new Lazy<PortableExecutableReference>( 827private static readonly Lazy<PortableExecutableReference> s_netModule1 = new Lazy<PortableExecutableReference>( 837private static readonly Lazy<PortableExecutableReference> s_CSharp = new Lazy<PortableExecutableReference>( 842private static readonly Lazy<PortableExecutableReference> s_IL = new Lazy<PortableExecutableReference>( 850private static readonly Lazy<PortableExecutableReference> s_CSharp = new Lazy<PortableExecutableReference>( 855private static readonly Lazy<PortableExecutableReference> s_IL = new Lazy<PortableExecutableReference>( 863private static readonly Lazy<PortableExecutableReference> s_CSharp = new Lazy<PortableExecutableReference>( 870private static readonly Lazy<PortableExecutableReference> s_regress40025 = new Lazy<PortableExecutableReference>( 877private static readonly Lazy<PortableExecutableReference> s_simpleWithEvents = new Lazy<PortableExecutableReference>( 885private static readonly Lazy<PortableExecutableReference> s_delegatesWithoutInvoke = new Lazy<PortableExecutableReference>( 890private static readonly Lazy<PortableExecutableReference> s_delegateByRefParamArray = new Lazy<PortableExecutableReference>( 898private static readonly Lazy<PortableExecutableReference> s_invalidCharactersInAssemblyName2 = new Lazy<PortableExecutableReference>( 903private static readonly Lazy<PortableExecutableReference> s_MDTestAttributeDefLib = new Lazy<PortableExecutableReference>( 908private static readonly Lazy<PortableExecutableReference> s_MDTestAttributeApplicationLib = new Lazy<PortableExecutableReference>( 913private static readonly Lazy<PortableExecutableReference> s_attributeInterop01 = new Lazy<PortableExecutableReference>( 918private static readonly Lazy<PortableExecutableReference> s_attributeInterop02 = new Lazy<PortableExecutableReference>( 923private static readonly Lazy<PortableExecutableReference> s_attributeTestLib01 = new Lazy<PortableExecutableReference>( 928private static readonly Lazy<PortableExecutableReference> s_attributeTestDef01 = new Lazy<PortableExecutableReference>( 933private static readonly Lazy<PortableExecutableReference> s_dynamicAttributeLib = new Lazy<PortableExecutableReference>( 941private static readonly Lazy<PortableExecutableReference> s_unavailable = new Lazy<PortableExecutableReference>( 946private static readonly Lazy<PortableExecutableReference> s_CSharp = new Lazy<PortableExecutableReference>( 951private static readonly Lazy<PortableExecutableReference> s_IL = new Lazy<PortableExecutableReference>( 959private static readonly Lazy<PortableExecutableReference> s_AR_SA = new Lazy<PortableExecutableReference>( 964private static readonly Lazy<PortableExecutableReference> s_EN_US = new Lazy<PortableExecutableReference>( 969private static readonly Lazy<PortableExecutableReference> s_C1 = new Lazy<PortableExecutableReference>( 974private static readonly Lazy<PortableExecutableReference> s_C2 = new Lazy<PortableExecutableReference>(
TestBase.cs (29)
78private static readonly Lazy<MetadataReference[]> s_lazyDefaultVbReferences = new Lazy<MetadataReference[]>( 83private static readonly Lazy<MetadataReference[]> s_lazyLatestVbReferences = new Lazy<MetadataReference[]>( 96private static readonly Lazy<MetadataReference[]> s_winRtRefs = new Lazy<MetadataReference[]>( 129private static readonly Lazy<MetadataReference[]> s_portableRefsMinimal = new Lazy<MetadataReference[]>( 145new Lazy<MetadataReference>( 150private static readonly Lazy<MetadataReference> s_systemCoreRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 155private static readonly Lazy<MetadataReference> s_systemRuntimeSerializationRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 160private static readonly Lazy<MetadataReference> s_systemCoreRef_v46 = new Lazy<MetadataReference>( 165private static readonly Lazy<MetadataReference> s_systemWindowsFormsRef = new Lazy<MetadataReference>( 170private static readonly Lazy<MetadataReference> s_systemDrawingRef = new Lazy<MetadataReference>( 175private static readonly Lazy<MetadataReference> s_systemDataRef = new Lazy<MetadataReference>( 180private static readonly Lazy<MetadataReference> s_mscorlibRef = new Lazy<MetadataReference>( 185private static readonly Lazy<MetadataReference> s_aacorlibRef = new Lazy<MetadataReference>( 212private static readonly Lazy<MetadataReference> s_mscorlibRef_v46 = new Lazy<MetadataReference>( 242private static readonly Lazy<MetadataReference> s_desktopCSharpRef = new Lazy<MetadataReference>( 247private static readonly Lazy<MetadataReference> s_std20Ref = new Lazy<MetadataReference>( 253private static readonly Lazy<MetadataReference> s_systemRef = new Lazy<MetadataReference>( 258private static readonly Lazy<MetadataReference> s_systemRef_v46 = new Lazy<MetadataReference>( 263private static readonly Lazy<MetadataReference> s_systemRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 268private static readonly Lazy<MetadataReference> s_systemRef_v20 = new Lazy<MetadataReference>( 273private static readonly Lazy<MetadataReference> s_systemXmlRef = new Lazy<MetadataReference>( 278private static readonly Lazy<MetadataReference> s_systemXmlLinqRef = new Lazy<MetadataReference>( 283private static readonly Lazy<MetadataReference> s_mscorlibFacadeRef = new Lazy<MetadataReference>( 288private static readonly Lazy<MetadataReference> s_systemRuntimeFacadeRef = new Lazy<MetadataReference>( 293private static readonly Lazy<MetadataReference> s_systemThreadingFacadeRef = new Lazy<MetadataReference>( 298private static readonly Lazy<MetadataReference> s_systemThreadingTasksFacadeRef = new Lazy<MetadataReference>( 303private static readonly Lazy<MetadataReference> s_mscorlibPP7Ref = new Lazy<MetadataReference>( 308private static readonly Lazy<MetadataReference> s_systemRuntimePP7Ref = new Lazy<MetadataReference>( 313private static readonly Lazy<MetadataReference> s_FSharpTestLibraryRef = new Lazy<MetadataReference>(
Microsoft.CodeAnalysis.UnitTests (2)
Diagnostics\SuppressMessageAttributeCompilerTests.cs (1)
37private static readonly Lazy<ImmutableArray<MetadataReference>> s_references = new Lazy<ImmutableArray<MetadataReference>>(() =>
Text\StringTextDecodingTests.cs (1)
51return EncodedStringText.TestAccessor.Create(stream, new Lazy<Encoding>(getEncoding), readEncodingOpt, algorithm, canBeEmbedded: false);
Microsoft.CodeAnalysis.Workspaces (21)
Diagnostics\DocumentAnalysisScope.cs (1)
35_lazyAdditionalFile = new Lazy<AdditionalText>(ComputeAdditionalFile);
Diagnostics\HostDiagnosticAnalyzers.cs (1)
62_lazyHostDiagnosticAnalyzersPerReferenceMap = new Lazy<ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>>(() => CreateDiagnosticAnalyzersPerReferenceMap(_hostAnalyzerReferencesMap), isThreadSafe: true);
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex.cs (1)
30_declaredSymbolInfoSet = new(() => [.. this.DeclaredSymbolInfos]);
Log\FunctionIdExtensions.cs (1)
13private static readonly Lazy<ImmutableDictionary<FunctionId, string>> s_functionIdsToString = new(
Options\GlobalOptionService.cs (1)
28private readonly Lazy<ImmutableArray<IOptionPersister>> _optionPersisters = new(() => GetOptionPersisters(optionPersisterProviders));
Serialization\SerializerService.cs (1)
43private readonly Lazy<TemporaryStorageService> _storageService = new(() => (TemporaryStorageService)workspaceServices.GetRequiredService<ITemporaryStorageServiceInternal>());
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Storage\SQLite\v2\SQLitePersistentStorageService.cs (1)
39private static readonly Lazy<bool> s_initialized = new(TryInitializeLibrariesLazy);
Workspace\Host\Mef\MefHostServices.cs (1)
59=> compositionContext.GetExports<TExtension>().Select(e => new Lazy<TExtension>(() => e));
Workspace\Host\Metadata\IAnalyzerAssemblyLoaderProvider.cs (1)
46_shadowCopyLoader = new(CreateNewShadowCopyLoader);
Workspace\ProjectSystem\FileWatchedPortableExecutableReferenceFactory.cs (1)
67_fileReferenceChangeContext = new Lazy<IFileChangeContext>(() =>
Workspace\Solution\ProjectState.AnalyzerConfigOptionsCache.cs (1)
28private readonly Lazy<AnalyzerConfigData> _global = new(() => new AnalyzerConfigData(configSet.GlobalConfigOptions, StructuredAnalyzerConfigOptions.Empty));
Workspace\Solution\SolutionCompilationState.CompilationTracker.CompilationTrackerState.cs (1)
118new Lazy<Compilation>(() => compilationWithoutGeneratedDocuments),
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (3)
152FinalCompilationTrackerState finalState => (new Lazy<Compilation>(() => finalState.CompilationWithoutGeneratedDocuments), new CancellableLazy<Compilation?>(finalState.FinalCompilationWithGeneratedDocuments)), 346new Lazy<Compilation>(CreateEmptyCompilation), 801var lazyCompilationWithoutGeneratedDocuments = new Lazy<Compilation>(() =>
Workspace\Solution\SolutionState.cs (1)
111=> new(() => new HostDiagnosticAnalyzers(analyzerReferences));
Workspace\Solution\SourceGeneratedDocumentState.cs (2)
77var lazyTextChecksum = new Lazy<Checksum>(() => originalSourceTextChecksum ?? ComputeContentHash(generatedSourceText)); 241var lazyTextChecksum = new Lazy<Checksum>(() => ComputeContentHash(sourceText));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
MEF\TestComposition.cs (1)
84_exportProviderFactory = new Lazy<IExportProviderFactory>(GetOrCreateFactory);
Remote\InProcRemoteHostClientProvider.cs (2)
78_lazyManager = new Lazy<WorkspaceManager>( 84_lazyClient = new Lazy<RemoteHostClient>(
Microsoft.CommonLanguageServerProtocol.Framework.Package (6)
AbstractLanguageServer.cs (3)
74_lspServices = new Lazy<ILspServices>(() => ConstructLspServices()); 75_queue = new Lazy<IRequestExecutionQueue<TRequestContext>>(() => ConstructRequestExecutionQueue()); 76_handlerProvider = new Lazy<AbstractHandlerProvider>(() =>
HandlerProvider.cs (2)
100return new(() => instance); 105return new(() =>
RequestExecutionQueue.cs (1)
106languages.Add(metadata.Language, new(() =>
Microsoft.DotNet.Deployment.Tasks.Links (2)
Microsoft.DotNet.Helix.Sdk (1)
CommandPayload.cs (1)
17private readonly Lazy<DirectoryInfo> _directoryInfo = new Lazy<DirectoryInfo>(CreateDirectory);
Microsoft.DotNet.XUnitExtensions (13)
src\Microsoft.DotNet.XUnitExtensions.Shared\DiscovererHelpers.cs (1)
15private static readonly Lazy<bool> s_isMonoRuntime = new Lazy<bool>(() => Type.GetType("Mono.RuntimeStructs") != null);
src\Microsoft.DotNet.XUnitExtensions.Shared\Discoverers\SkipOnCoreClrDiscoverer.cs (12)
17private static readonly Lazy<bool> s_isJitStress = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitStress); 18private static readonly Lazy<bool> s_isJitStressRegs = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitStressRegs); 19private static readonly Lazy<bool> s_isJitMinOpts = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitMinOpts); 20private static readonly Lazy<bool> s_isTailCallStress = new Lazy<bool>(() => CoreClrConfigurationDetection.IsTailCallStress); 21private static readonly Lazy<bool> s_isZapDisable = new Lazy<bool>(() => CoreClrConfigurationDetection.IsZapDisable); 22private static readonly Lazy<bool> s_isGCStress3 = new Lazy<bool>(() => CoreClrConfigurationDetection.IsGCStress3); 23private static readonly Lazy<bool> s_isGCStressC = new Lazy<bool>(() => CoreClrConfigurationDetection.IsGCStressC); 24private static readonly Lazy<bool> s_isCheckedRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsCheckedRuntime); 25private static readonly Lazy<bool> s_isReleaseRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsReleaseRuntime); 26private static readonly Lazy<bool> s_isDebugRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsDebugRuntime); 27private static readonly Lazy<bool> s_isStressTest = new Lazy<bool>(() => CoreClrConfigurationDetection.IsStressTest); 28private static readonly Lazy<bool> s_isCoreClrInterpreter = new Lazy<bool>(() => CoreClrConfigurationDetection.IsCoreClrInterpreter);
Microsoft.DotNet.XUnitV3Extensions (13)
src\Microsoft.DotNet.XUnitExtensions.Shared\Attributes\SkipOnCoreClrAttribute.cs (12)
18private static readonly Lazy<bool> s_isJitStress = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitStress); 19private static readonly Lazy<bool> s_isJitStressRegs = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitStressRegs); 20private static readonly Lazy<bool> s_isJitMinOpts = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitMinOpts); 21private static readonly Lazy<bool> s_isTailCallStress = new Lazy<bool>(() => CoreClrConfigurationDetection.IsTailCallStress); 22private static readonly Lazy<bool> s_isZapDisable = new Lazy<bool>(() => CoreClrConfigurationDetection.IsZapDisable); 23private static readonly Lazy<bool> s_isGCStress3 = new Lazy<bool>(() => CoreClrConfigurationDetection.IsGCStress3); 24private static readonly Lazy<bool> s_isGCStressC = new Lazy<bool>(() => CoreClrConfigurationDetection.IsGCStressC); 25private static readonly Lazy<bool> s_isCheckedRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsCheckedRuntime); 26private static readonly Lazy<bool> s_isReleaseRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsReleaseRuntime); 27private static readonly Lazy<bool> s_isDebugRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsDebugRuntime); 28private static readonly Lazy<bool> s_isStressTest = new Lazy<bool>(() => CoreClrConfigurationDetection.IsStressTest); 29private static readonly Lazy<bool> s_isCoreClrInterpreter = new Lazy<bool>(() => CoreClrConfigurationDetection.IsCoreClrInterpreter);
src\Microsoft.DotNet.XUnitExtensions.Shared\DiscovererHelpers.cs (1)
15private static readonly Lazy<bool> s_isMonoRuntime = new Lazy<bool>(() => Type.GetType("Mono.RuntimeStructs") != null);
Microsoft.Extensions.DataIngestion.Tests (1)
Readers\MarkItDownConditionAttribute.cs (1)
18internal static readonly Lazy<bool> IsInstalled = new(CanInvokeMarkItDown);
Microsoft.Extensions.DependencyInjection.Abstractions (1)
ActivatorUtilities.cs (1)
31private static readonly Lazy<ConditionalWeakTable<Type, ConstructorInfoEx[]>> s_collectibleConstructorInfos = new();
Microsoft.Extensions.DependencyModel (1)
DependencyContext.cs (1)
17private static readonly Lazy<DependencyContext?> _defaultContext = new(LoadDefault);
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Windows\WindowsContainerResourceQuotaProvider.cs (1)
26_memoryStatus = new Lazy<MEMORYSTATUSEX>(
Microsoft.Extensions.Http (2)
DefaultHttpClientFactory.cs (2)
82return new Lazy<ActiveHandlerTrackingEntry>(() => 98_logger = new Lazy<ILogger>(
Microsoft.Extensions.Options (3)
OptionsCache.cs (3)
39value = _cache.GetOrAdd(name, static (name, createOptions) => new Lazy<TOptions>(createOptions), createOptions); 68static (name, arg) => new Lazy<TOptions>(() => arg.createOptions(name, arg.factoryArgument)), (createOptions, factoryArgument)).Value; 100return _cache.TryAdd(name ?? Options.DefaultName, new Lazy<TOptions>(
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (1)
Resolver\LoopbackDnsTestBase.cs (1)
37_resolverLazy = new(InitializeResolver);
Microsoft.Extensions.Telemetry (2)
src\Shared\Memoization\MemoizedFunction.cs (2)
82return _values.GetOrAdd(arg, new Lazy<TResult>(() => _function(arg1))).Value; 155return _values.GetOrAdd(args, new Lazy<TResult>(() => _function(arg1, arg2))).Value;
Microsoft.Interop.LibraryImportGenerator (4)
Analyzers\CustomMarshallerAttributeFixer.cs (4)
214Lazy<SyntaxNode> unmanagedTypeSyntax = new(CreateUnmanagedTypeSyntax, isThreadSafe: false); 215Lazy<ITypeSymbol> managedElementTypeSymbol = new(CreateManagedElementTypeSymbol, isThreadSafe: false); 410Lazy<SyntaxNode> unmanagedTypeSyntax = new(CreateUnmanagedTypeSyntax, isThreadSafe: false); 411Lazy<ITypeSymbol> managedElementTypeSymbol = new(CreateManagedElementTypeSymbol, isThreadSafe: false);
Microsoft.Maui (3)
Hosting\MauiAppBuilder.cs (1)
26 var configuration = new Lazy<ConfigurationManager>(() => new ConfigurationManager());
MauiContext.cs (1)
31 _handlers = new Lazy<IMauiHandlersFactory>(() => _services.GetRequiredService<IMauiHandlersFactory>());
VisualDiagnostics\VisualDiagnostics.cs (1)
16 static Lazy<bool> isVisualDiagnosticsEnvVarSet = new Lazy<bool>(() => Environment.GetEnvironmentVariable("ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO") is { } value && value == "1");
Microsoft.Maui.Controls (47)
ActivityIndicator\ActivityIndicator.cs (1)
24 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<ActivityIndicator>>(() => new PlatformConfigurationRegistry<ActivityIndicator>(this));
Application\Application.cs (2)
44 _systemResources = new Lazy<IResourceDictionary?>(() => 55 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Application>>(() => new PlatformConfigurationRegistry<Application>(this));
BoxView\BoxView.cs (1)
23 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<BoxView>>(() => new PlatformConfigurationRegistry<BoxView>(this));
Button\Button.cs (1)
355 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Button>>(() => new PlatformConfigurationRegistry<Button>(this));
CarouselPage\CarouselPage.cs (1)
14 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<CarouselPage>>(() => new PlatformConfigurationRegistry<CarouselPage>(this));
Cells\Cell.cs (2)
32 _elementConfiguration = new Lazy<ElementConfiguration>(() => new ElementConfiguration(this)); 351 new Lazy<PlatformConfigurationRegistry<Cell>>(() => new PlatformConfigurationRegistry<Cell>(cell));
CheckBox\CheckBox.cs (1)
37 public CheckBox() => _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<CheckBox>>(() => new PlatformConfigurationRegistry<CheckBox>(this));
DatePicker\DatePicker.cs (1)
53 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<DatePicker>>(() => new PlatformConfigurationRegistry<DatePicker>(this));
Editor\Editor.cs (1)
100 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Editor>>(() => new PlatformConfigurationRegistry<Editor>(this));
Entry\Entry.cs (1)
95 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Entry>>(() => new PlatformConfigurationRegistry<Entry>(this));
FlyoutPage\FlyoutPage.cs (1)
312 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<FlyoutPage>>(() => new PlatformConfigurationRegistry<FlyoutPage>(this));
Frame\Frame.cs (1)
28 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Frame>>(() => new PlatformConfigurationRegistry<Frame>(this));
Image\Image.cs (1)
35 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Image>>(() => new PlatformConfigurationRegistry<Image>(this));
ImageButton\ImageButton.cs (1)
65 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<ImageButton>>(() => new PlatformConfigurationRegistry<ImageButton>(this));
Label\Label.cs (1)
123 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Label>>(() => new PlatformConfigurationRegistry<Label>(this));
LegacyLayouts\AbsoluteLayout.cs (2)
30 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<AbsoluteLayout>>(() => 166 var sizeRequest = new Lazy<SizeRequest>(() => view.Measure(double.PositiveInfinity, double.PositiveInfinity, MeasureFlags.IncludeMargins));
LegacyLayouts\Grid.cs (1)
75 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Grid>>(() =>
LegacyLayouts\RelativeLayout.cs (1)
47 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<RelativeLayout>>(() =>
LegacyLayouts\StackLayout.cs (1)
27 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<StackLayout>>(() =>
ListView\ListView.cs (1)
113 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<ListView>>(() => new PlatformConfigurationRegistry<ListView>(this));
NavigationPage\NavigationPage.cs (2)
79 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<NavigationPage>>(() => new PlatformConfigurationRegistry<NavigationPage>(this)); 725 _castingList = new Lazy<ReadOnlyCastingList<Page, Element>>(() => new ReadOnlyCastingList<Page, Element>(Owner.InternalChildren));
NavigationPage\NavigationPage.Legacy.cs (1)
263 _castingList = new Lazy<ReadOnlyCastingList<Page, Element>>(() => new ReadOnlyCastingList<Page, Element>(Owner.InternalChildren));
NavigationProxy.cs (4)
25 Lazy<NavigatingStepRequestList> _modalStack = new Lazy<NavigatingStepRequestList>(() => new NavigatingStepRequestList()); 27 Lazy<List<Page>> _pushStack = new Lazy<List<Page>>(() => new List<Page>()); 43 _pushStack = new Lazy<List<Page>>(() => new List<Page>()); 44 _modalStack = new Lazy<NavigatingStepRequestList>(() => new NavigatingStepRequestList());
Page\Page.cs (1)
101 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Page>>(() => new PlatformConfigurationRegistry<Page>(this));
Picker\Picker.cs (1)
74 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Picker>>(() => new PlatformConfigurationRegistry<Picker>(this));
ProgressBar\ProgressBar.cs (1)
26 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<ProgressBar>>(() => new PlatformConfigurationRegistry<ProgressBar>(this));
RadioButton\RadioButton.cs (1)
213 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<RadioButton>>(() =>
RefreshView\RefreshView.cs (1)
28 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<RefreshView>>(() => new PlatformConfigurationRegistry<RefreshView>(this));
Registrar.cs (1)
317 static readonly Lazy<Dictionary<string, IList<StylePropertyAttribute>>> LazyStyleProperties = new Lazy<Dictionary<string, IList<StylePropertyAttribute>>>(LoadStyleSheets);
ScrollView\ScrollView.cs (1)
236 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<ScrollView>>(() => new PlatformConfigurationRegistry<ScrollView>(this));
SearchBar\SearchBar.cs (1)
115 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<SearchBar>>(() => new PlatformConfigurationRegistry<SearchBar>(this));
Shell\ShellItem.cs (1)
179 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<ShellItem>>(() => new PlatformConfigurationRegistry<ShellItem>(this));
Slider\Slider.cs (1)
63 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Slider>>(() => new PlatformConfigurationRegistry<Slider>(this));
Stepper\Stepper.cs (1)
56 public Stepper() => _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Stepper>>(() => new PlatformConfigurationRegistry<Stepper>(this));
SwipeView\SwipeView.cs (1)
21 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<SwipeView>>(() => new PlatformConfigurationRegistry<SwipeView>(this));
Switch\Switch.cs (1)
56 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Switch>>(() => new PlatformConfigurationRegistry<Switch>(this));
TabbedPage\TabbedPage.cs (1)
74 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<TabbedPage>>(() => new PlatformConfigurationRegistry<TabbedPage>(this));
TableView\TableView.cs (1)
44 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<TableView>>(() => new PlatformConfigurationRegistry<TableView>(this));
TimePicker\TimePicker.cs (1)
48 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<TimePicker>>(() => new PlatformConfigurationRegistry<TimePicker>(this));
WebView\WebView.cs (1)
61 _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<WebView>>(() => new PlatformConfigurationRegistry<WebView>(this));
Microsoft.Maui.Controls.DesignTools (2)
ColorDesignTypeConverter.cs (2)
180 static readonly Lazy<Regex> RxColorHex = new(() => new Regex(RxColorHexPattern, RegexOptions.Compiled | RegexOptions.Singleline)); 189 static readonly Lazy<Regex> RxFuncExpr = new(() => new Regex(RxFuncPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline));
Microsoft.Maui.Controls.Foldable (3)
DualScreenInfo.cs (1)
54 static Lazy<DualScreenInfo> _dualScreenInfo { get; } = new Lazy<DualScreenInfo>(OnCreate);
NoPlatformFoldableService.cs (1)
18 static Lazy<NoPlatformFoldableService> _Instance = new Lazy<NoPlatformFoldableService>(() => new NoPlatformFoldableService());
TwoPaneViewLayoutGuide.cs (1)
17 static Lazy<TwoPaneViewLayoutGuide> _twoPaneViewLayoutGuide = new Lazy<TwoPaneViewLayoutGuide>(() => new TwoPaneViewLayoutGuide());
Microsoft.Maui.Resizetizer (1)
ColorTable.cs (1)
13 static readonly Lazy<Dictionary<string, SKColor>> ColorConstants = new Lazy<Dictionary<string, SKColor>>(GetColors);
Microsoft.ML.AutoML (2)
ColumnInference\PurposeInference.cs (2)
73_type = new Lazy<DataViewType>(() => _data.Schema[_columnId].Type); 74_columnName = new Lazy<string>(() => _data.Schema[_columnId].Name);
Microsoft.ML.CodeAnalyzer.Tests (1)
Helpers\TestUtils.cs (1)
36return new Lazy<string>(() => LoadSource(resourceName), true);
Microsoft.ML.Data (2)
Transforms\ColumnBindingsBase.cs (1)
344_convertedSchema = new Lazy<DataViewSchema>(() => CreateSchema(this), LazyThreadSafetyMode.PublicationOnly);
Transforms\RowToRowTransformerBase.cs (1)
71OutputColumns = new Lazy<DataViewSchema.DetachedColumn[]>(GetOutputColumnsCore);
Microsoft.ML.FastTree (3)
Dataset\SegmentIntArray.cs (2)
52public static Lazy<PerformSegmentFindOptimalCost> SegmentFindOptimalCost = new(() => 64public static Lazy<PerformSegmentFindOptimalPath> SegmentFindOptimalPath = new(() =>
Training\Test.cs (1)
475_winLossCalculator = new Lazy<WinLossCalculator>(
Microsoft.VisualStudio.LanguageServices (10)
DocumentationComments\VisualStudioDocumentationProvider.cs (1)
29_lazyMemberIndex = new Lazy<IVsXMLMemberIndex>(CreateXmlMemberIndex, isThreadSafe: true);
FindReferences\StreamingFindUsagesPresenter.cs (1)
124_lazyClassificationFormatMap = new Lazy<IClassificationFormatMap>(() =>
LanguageService\AbstractLanguageService`2.cs (1)
56this._languageDebugInfo = new Lazy<VsLanguageDebugInfo>(CreateLanguageDebugInfo);
Library\ObjectBrowser\AbstractObjectBrowserLibraryManager.cs (1)
59_libraryService = new Lazy<ILibraryService>(() => Workspace.Services.GetLanguageServices(_languageName).GetService<ILibraryService>());
NavigateTo\VisualStudioNavigateToPreviewServiceFactory.cs (1)
17new(() => new VisualStudioNavigateToPreviewService());
Options\VisualStudioOptionPersisterProvider.cs (1)
45_lazyPersister = new Lazy<IOptionPersister>(() => CreatePersister());
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceProviderServiceFactory.cs (1)
26private readonly Lazy<VisualStudioMetadataReferenceManager> _manager = new(
ProjectSystem\MiscellaneousFilesWorkspace.cs (1)
68_metadataReferences = new(() => [.. CreateMetadataReferences()]);
ProjectSystem\OpenTextBufferProvider.cs (1)
64_runningDocumentTable = new(() =>
ProjectSystem\SdkAnalyzerAssemblyRedirector.cs (1)
61_analyzerMap = new(() => CreateAnalyzerMap(insertedAnalyzersDirectory));
Microsoft.VisualStudio.LanguageServices.CSharp (4)
SemanticSearch\SemanticSearchQueryExecutor.cs (2)
32private readonly Lazy<ConcurrentStack<(DocumentId documentId, ImmutableArray<TextChange> changes)>> _lazyDocumentUpdates = new(); 33private readonly Lazy<ConcurrentDictionary<string, string?>> _lazyTextFileUpdates = new();
SemanticSearch\SemanticSearchToolWindowImpl.cs (2)
75private static readonly Lazy<ControlTemplate> s_buttonTemplate = new(CreateButtonTemplate); 81= new(() => new SemanticSearchEditorWorkspace(
Microsoft.VisualStudio.LanguageServices.Implementation (1)
ProjectSystem\CPS\CPSProject_IWorkspaceProjectContext.cs (1)
76_externalErrorReporter = new Lazy<ProjectExternalErrorReporter?>(() =>
MinimalValidationSample (1)
artifacts\obj\MinimalValidationSample\Release\net11.0\generated\Microsoft.Extensions.Validation.ValidationsGenerator\Microsoft.Extensions.Validation.ValidationsGenerator\ValidatableInfoResolver.g.cs (1)
193private static readonly global::System.Lazy<global::System.Collections.Concurrent.ConcurrentDictionary<global::System.Type, global::System.ComponentModel.DataAnnotations.ValidationAttribute[]>> _lazyTypeCache = new (() => new ());
MSBuild (11)
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
FrameworkLocationHelper.cs (3)
237private static readonly Lazy<VisualStudioSpec[]> VisualStudioSpecs = new(() => 433private static readonly Lazy<IReadOnlyDictionary<Version, DotNetFrameworkSpec>> DotNetFrameworkSpecDict = new(() => DotNetFrameworkSpecs().ToDictionary(spec => spec.Version)); 434private static readonly Lazy<IReadOnlyDictionary<Version, VisualStudioSpec>> VisualStudioSpecDict = new(() => VisualStudioSpecs.Value.ToDictionary(spec => spec.Version));
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 38new Lazy<PrintLineDebugger>(() => Create(null, null, false)); 41new Lazy<PrintLineDebugger>(() => Create(null, null, true));
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
RegisteredTaskObjectCacheBase.cs (2)
24private static readonly Lazy<ConcurrentDictionary<object, object>> s_appDomainLifetimeObjects = new Lazy<ConcurrentDictionary<object, object>>(); 29private Lazy<ConcurrentDictionary<object, object>> _buildLifetimeObjects = new Lazy<ConcurrentDictionary<object, object>>();
TypeLoader.cs (1)
84private static readonly Lazy<string[]> runtimeAssembliesCLR35_20 = new Lazy<string[]>(FindRuntimeAssembliesWithMicrosoftBuildFrameworkCLR2CLR35);
PresentationFramework (27)
MS\Internal\WindowsRuntime\Generated\Windows.Data.Text.cs (3)
46_defaultLazy = new Lazy<global::MS.Internal.WindowsRuntime.ABI.Windows.Data.Text.IAlternateWordForm>(() => ifc); 264_defaultLazy = new Lazy<global::MS.Internal.WindowsRuntime.ABI.Windows.Data.Text.IWordSegment>(() => ifc); 369_defaultLazy = new Lazy<global::MS.Internal.WindowsRuntime.ABI.Windows.Data.Text.IWordsSegmenter>(() => ifc);
MS\Internal\WindowsRuntime\Generated\Windows.Globalization.cs (1)
141_defaultLazy = new Lazy<global::MS.Internal.WindowsRuntime.ABI.Windows.Globalization.ILanguage>(() => ifc);
MS\Internal\WindowsRuntime\Generated\WinRT.cs (1)
195private static Lazy<WinrtModule> _instance = new Lazy<WinrtModule>();
System\Windows\Markup\Baml2006\Baml2006SchemaContext.cs (9)
661= new Lazy<XamlMember>(() => XamlLanguage.Static.GetMember("MemberType")); 664= new Lazy<XamlMember>(() => XamlLanguage.Static.GetMember("Type")); 667= new Lazy<XamlMember>(() => _resourceDictionaryType.Value.GetMember("DeferrableContent")); 670= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(ResourceDictionary))); 673= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(EventSetter))); 676= new Lazy<XamlMember>(() => _eventSetterType.Value.GetMember("Event")); 679= new Lazy<XamlMember>(() => _eventSetterType.Value.GetMember("Handler")); 682= new Lazy<XamlMember>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(FrameworkTemplate)).GetMember("Template")); 685= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(StaticResourceExtension)));
System\Windows\Markup\Baml2006\WpfSharedBamlSchemaContext.cs (9)
350= new Lazy<XamlMember>(() => XamlLanguage.Static.GetMember("MemberType")); 353= new Lazy<XamlMember>(() => XamlLanguage.Static.GetMember("Type")); 356= new Lazy<XamlMember>(() => _resourceDictionaryType.Value.GetMember("DeferrableContent")); 359= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(ResourceDictionary))); 362= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(EventSetter))); 365= new Lazy<XamlMember>(() => _eventSetterType.Value.GetMember("Event")); 368= new Lazy<XamlMember>(() => _eventSetterType.Value.GetMember("Handler")); 371= new Lazy<XamlMember>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(FrameworkTemplate)).GetMember("Template")); 374= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(StaticResourceExtension)));
System\Windows\Markup\WpfXamlLoader.cs (1)
17private static Lazy<XamlMember> XmlSpace = new Lazy<XamlMember>(() => new WpfXamlMember(XmlAttributeProperties.XmlSpaceProperty, true));
System\Windows\Markup\XamlReader.cs (3)
1173new Lazy<WpfSharedBamlSchemaContext>(() => CreateBamlSchemaContext()); 1175new Lazy<WpfSharedXamlSchemaContext>(() => CreateXamlSchemaContext(false)); 1177new Lazy<WpfSharedXamlSchemaContext>(() => CreateXamlSchemaContext(true));
Roslyn.Diagnostics.Analyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Roslyn.Test.PdbUtilities (1)
EditAndContinue\EditAndContinueTest.GenerationVerifier.cs (1)
27private readonly Lazy<MetadataVisualizer> _lazyVisualizer = new(() => new MetadataVisualizer(readers, TextWriter.Null, MetadataVisualizerOptions.None));
Shared (2)
Memoization\MemoizedFunction.cs (2)
82return _values.GetOrAdd(arg, new Lazy<TResult>(() => _function(arg1))).Value; 155return _values.GetOrAdd(args, new Lazy<TResult>(() => _function(arg1, arg2))).Value;
Sockets.BindTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6ScopeIdPresentConditionAttribute.cs (1)
14private static readonly Lazy<bool> _ipv6ScopeIdPresent = new Lazy<bool>(IPv6ScopeIdAddressPresent);
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6SupportedConditionAttribute.cs (1)
14private static readonly Lazy<bool> _ipv6Supported = new Lazy<bool>(CanBindToIPv6Address);
Sockets.FunctionalTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6ScopeIdPresentConditionAttribute.cs (1)
14private static readonly Lazy<bool> _ipv6ScopeIdPresent = new Lazy<bool>(IPv6ScopeIdAddressPresent);
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6SupportedConditionAttribute.cs (1)
14private static readonly Lazy<bool> _ipv6Supported = new Lazy<bool>(CanBindToIPv6Address);
System.ComponentModel.Annotations (1)
System\ComponentModel\DataAnnotations\CustomValidationAttribute.cs (1)
92_malformedErrorMessage = new Lazy<string?>(CheckAttributeWellFormed);
System.ComponentModel.Composition (14)
System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs (2)
82new Lazy<ParameterInfo>(() => parameter), 97new Lazy<ParameterInfo>(() => parameter),
System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs (1)
44return new Lazy<Type>(GetPartType, LazyThreadSafetyMode.PublicationOnly);
System\ComponentModel\Composition\ExportServices.cs (1)
103return new Lazy<T>(() => ExportServices.GetCastedExportedValue<T>(export), LazyThreadSafetyMode.PublicationOnly);
System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs (3)
49var addedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => item.ToArray(), LazyThreadSafetyMode.PublicationOnly); 103var removedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => catalogs.SelectMany(catalog => catalog).ToArray(), LazyThreadSafetyMode.PublicationOnly); 187var removedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => item.ToArray(), LazyThreadSafetyMode.PublicationOnly);
System\ComponentModel\Composition\Hosting\TypeCatalog.cs (4)
81_contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true); 109_contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true); 138_contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true); 171_contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
System\ComponentModel\Composition\ReflectionModel\GenericSpecializationPartCreationInfo.cs (3)
46_lazyPartType = new Lazy<Type>( 337Lazy<ParameterInfo> parameter = new Lazy<ParameterInfo>(() => GetParameter(lazyParameter)); 402Lazy<IDictionary<string, object?>> lazyMetadata = new Lazy<IDictionary<string, object?>>(() => TranslateExportMetadata(capturedReflectionExport));
System.ComponentModel.TypeConverter (2)
src\libraries\Common\src\System\Drawing\ColorTable.cs (1)
12private static readonly Lazy<Dictionary<string, Color>> s_colorConstants = new Lazy<Dictionary<string, Color>>(GetColors);
System\Drawing\ColorConverter.cs (1)
17private static readonly Lazy<StandardValuesCollection> s_valuesLazy = new Lazy<StandardValuesCollection>(() =>
System.Composition.Hosting (3)
System\Composition\Hosting\Core\ExportDescriptorPromise.cs (2)
46_dependencies = new Lazy<ReadOnlyCollection<CompositionDependency>>(() => new ReadOnlyCollection<CompositionDependency>(dependencies().ToList()), false); 47_descriptor = new Lazy<ExportDescriptor>(() => getDescriptor(_dependencies.Value), false);
System\Composition\Hosting\Providers\Lazy\LazyExportDescriptorProvider.cs (1)
39return ExportDescriptor.Create((c, o) => new Lazy<TValue>(() => (TValue)CompositionOperation.Run(c, da)), dsc.Metadata);
System.Composition.TypedParts (1)
System\Composition\TypedParts\Discovery\DiscoveredPart.cs (1)
59_partMetadata = new Lazy<IDictionary<string, object>>(() => GetPartMetadata(partType));
System.Console (1)
System\ConsolePal.Unix.cs (1)
44private static readonly Lazy<TerminalFormatStrings> s_terminalFormatStringsInstance = new(() => new TerminalFormatStrings(TermInfo.DatabaseFactory.ReadActiveDatabase()));
System.Drawing.Primitives (1)
src\libraries\Common\src\System\Drawing\ColorTable.cs (1)
12private static readonly Lazy<Dictionary<string, Color>> s_colorConstants = new Lazy<Dictionary<string, Color>>(GetColors);
System.Formats.Tar (1)
System\Formats\Tar\TarHelpers.Unix.cs (1)
12private static readonly Lazy<UnixFileMode> s_umask = new Lazy<UnixFileMode>(DetermineUMask);
System.Net.Http (1)
System\Net\Http\SocketsHttpHandler\SystemProxyInfo.cs (1)
10private static readonly Lazy<IWebProxy> s_proxy = new Lazy<IWebProxy>(ConstructSystemProxy);
System.Net.Ping (3)
src\libraries\Common\src\System\Net\NetworkInformation\UnixCommandLinePing.cs (1)
21private static readonly Lazy<bool> s_isBusybox = new Lazy<bool>(() => IsBusyboxPing(s_discoveredPing4UtilityPath));
src\libraries\Common\src\System\Net\RawSocketPermissions.cs (2)
10private static readonly Lazy<bool> s_canUseRawIPv4Sockets = new Lazy<bool>(() => CheckRawSocketPermissions(AddressFamily.InterNetwork)); 11private static readonly Lazy<bool> s_canUseRawIPv6Sockets = new Lazy<bool>(() => CheckRawSocketPermissions(AddressFamily.InterNetworkV6));
System.Net.Quic (1)
System\Net\Quic\Internal\MsQuicApi.cs (1)
56private static readonly Lazy<MsQuicApi> _api = new Lazy<MsQuicApi>(AllocateMsQuicApi);
System.Net.Security (3)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (1)
34private static readonly Lazy<string[]> s_defaultSigAlgs = new(GetDefaultSignatureAlgorithms);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\GssSafeHandles.cs (1)
73private static readonly Lazy<bool> s_IsNtlmInstalled = new Lazy<bool>(InitIsNtlmInstalled);
System\Net\NegotiateAuthenticationPal.Unix.cs (1)
22private static readonly Lazy<bool> _hasSystemNetSecurityNative = new Lazy<bool>(CheckHasSystemNetSecurityNative);
System.Private.Windows.Core.TestUtilities (2)
XUnit\UseCultureAttribute.cs (2)
47_culture = new Lazy<CultureInfo>(() => new(culture, useUserOverride: false)); 48_uiCulture = new Lazy<CultureInfo>(() => new(uiCulture, useUserOverride: false));
System.Private.Xml (1)
System\Xml\Serialization\SourceInfo.cs (1)
25private static readonly Lazy<MethodInfo> s_iListGetItemMethod = new Lazy<MethodInfo>(
System.Reflection.Metadata (1)
System\Reflection\PortableExecutable\PEBuilder.cs (1)
71_lazySections = new Lazy<ImmutableArray<Section>>(CreateSections);
System.Security.Cryptography (28)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSslAvailable.cs (1)
15new Lazy<bool>(() => OpenSslAvailable() != 0);
src\libraries\Common\src\System\Security\Cryptography\DSAOpenSsl.cs (3)
47_key = new Lazy<SafeDsaHandle>(GenerateKey); 64_key = new Lazy<SafeDsaHandle>(GenerateKey); 374_key = new Lazy<SafeDsaHandle>(newKey);
src\libraries\Common\src\System\Security\Cryptography\ECDiffieHellmanOpenSsl.cs (5)
22_key = new Lazy<SafeEvpPKeyHandle>(ECOpenSsl.GenerateECKey(curve, out int keySize)); 45_key = new Lazy<SafeEvpPKeyHandle>(() => ECOpenSsl.GenerateECKey(keySize)); 79_key = new Lazy<SafeEvpPKeyHandle>(ECOpenSsl.GenerateECKey(value)); 88_key = new Lazy<SafeEvpPKeyHandle>(ECOpenSsl.GenerateECKey(curve, out int keySizeValue)); 107_key = new Lazy<SafeEvpPKeyHandle>(ECOpenSsl.ImportECKey(parameters, out int keySize));
src\libraries\Common\src\System\Security\Cryptography\ECDsaOpenSsl.cs (5)
33_key = new Lazy<SafeEvpPKeyHandle>(ECOpenSsl.GenerateECKey(curve, out int keySize)); 63_key = new Lazy<SafeEvpPKeyHandle>(GenerateKeyFromSize); 245_key = new Lazy<SafeEvpPKeyHandle>(GenerateKeyFromSize); 254_key = new Lazy<SafeEvpPKeyHandle>(ECOpenSsl.GenerateECKey(curve, out int keySize)); 266_key = new Lazy<SafeEvpPKeyHandle>(ECOpenSsl.ImportECKey(parameters, out int keySize));
src\libraries\Common\src\System\Security\Cryptography\ECOpenSsl.cs (3)
20_key = new Lazy<SafeEcKeyHandle>(() => GenerateKeyByKeySize(keySizeBits)); 31_key = new Lazy<SafeEcKeyHandle>(key); 58_key = new Lazy<SafeEcKeyHandle>(key);
src\libraries\Common\src\System\Security\Cryptography\ECOpenSsl.ImportExport.cs (1)
51_key = new Lazy<SafeEcKeyHandle>(key);
src\libraries\Common\src\System\Security\Cryptography\RSAOpenSsl.cs (3)
39_key = new Lazy<SafeEvpPKeyHandle>(GenerateKey); 56_key = new Lazy<SafeEvpPKeyHandle>(GenerateKey); 635_key = new Lazy<SafeEvpPKeyHandle>(newKey);
System\Security\Cryptography\DSAOpenSsl.cs (1)
20_key = new Lazy<SafeDsaHandle>();
System\Security\Cryptography\ECDiffieHellmanOpenSsl.cs (2)
39_key = new Lazy<SafeEvpPKeyHandle>(pkeyHandle.DuplicateHandle()); 68_key = new Lazy<SafeEvpPKeyHandle>(Interop.Crypto.CreateEvpPkeyFromEcKey(ecKeyHandle));
System\Security\Cryptography\ECDsaOpenSsl.cs (2)
39_key = new Lazy<SafeEvpPKeyHandle>(pkeyHandle.DuplicateHandle()); 68_key = new Lazy<SafeEvpPKeyHandle>(Interop.Crypto.CreateEvpPkeyFromEcKey(ecKeyHandle));
System\Security\Cryptography\RSAOpenSsl.cs (1)
22_key = new Lazy<SafeEvpPKeyHandle>();
System\Security\Cryptography\X509Certificates\X500NameEncoder.cs (1)
33private static readonly Lazy<Dictionary<string, EncodingRules>> s_lazyEncodingRulesLookup = new(CreateEncodingRulesLookup);
System.ServiceModel.Http (1)
System\ServiceModel\Channels\HttpChannelFactory.cs (1)
132_webSocketSoapContentType = new Lazy<string>(() => MessageEncoderFactory.CreateSessionEncoder().ContentType, LazyThreadSafetyMode.ExecutionAndPublication);
System.ServiceModel.Primitives (1)
System\ServiceModel\Dispatcher\InvokerUtil.cs (1)
22private static readonly Lazy<bool> s_useLegacyInvokeDelegate = new Lazy<bool>(() =>
System.Threading.RateLimiting (1)
System\Threading\RateLimiting\DefaultPartitionedRateLimiter.cs (1)
97limiter = new Lazy<RateLimiter>(() => partition.Factory(partition.PartitionKey));
System.Windows.Forms.Primitives.TestUtilities (1)
PlatformDetection.cs (1)
29private static readonly Lazy<bool> s_largeArrayIsNotSupported = new(IsLargeArrayNotSupported);
System.Xaml (56)
System\Xaml\AttachablePropertyServices.cs (1)
121new Lazy<ConditionalWeakTable<object, Dictionary<AttachableMemberIdentifier, object>>>();
System\Xaml\XamlLanguage.cs (55)
56new Lazy<XamlSchemaContext>(GetSchemaContext); 59new Lazy<XamlType>(() => GetXamlType(typeof(ArrayExtension))); 61new Lazy<XamlType>(() => GetXamlType(typeof(NullExtension))); 63new Lazy<XamlType>(() => GetXamlType(typeof(Reference))); 65new Lazy<XamlType>(() => GetXamlType(typeof(StaticExtension))); 67new Lazy<XamlType>(() => GetXamlType(typeof(TypeExtension))); 69new Lazy<XamlType>(() => GetXamlType(typeof(string))); 71new Lazy<XamlType>(() => GetXamlType(typeof(double))); 73new Lazy<XamlType>(() => GetXamlType(typeof(int))); 75new Lazy<XamlType>(() => GetXamlType(typeof(bool))); 77new Lazy<XamlType>(() => GetXamlType(typeof(MemberDefinition))); 79new Lazy<XamlType>(() => GetXamlType(typeof(PropertyDefinition))); 81new Lazy<XamlType>(() => GetXamlType(typeof(XData))); 84new Lazy<XamlType>(() => GetXamlType(typeof(object))); 86new Lazy<XamlType>(() => GetXamlType(typeof(List<object>))); 88new Lazy<XamlType>(() => GetXamlType(typeof(List<MemberDefinition>))); 90new Lazy<XamlType>(() => GetXamlType(typeof(List<Attribute>))); 93new Lazy<XamlType>(() => GetXamlType(typeof(MarkupExtension))); 95new Lazy<XamlType>(() => GetXamlType(typeof(INameScope))); 97new Lazy<XamlType>(() => GetXamlType(typeof(IXmlSerializable)), true); 100new Lazy<XamlType>(() => GetXamlType(typeof(PositionalParameterDescriptor)), true); 103new Lazy<XamlType>(() => GetXamlType(typeof(char)), true); 105new Lazy<XamlType>(() => GetXamlType(typeof(float)), true); 107new Lazy<XamlType>(() => GetXamlType(typeof(byte)), true); 109new Lazy<XamlType>(() => GetXamlType(typeof(short)), true); 111new Lazy<XamlType>(() => GetXamlType(typeof(long)), true); 113new Lazy<XamlType>(() => GetXamlType(typeof(decimal)), true); 115new Lazy<XamlType>(() => GetXamlType(typeof(Uri)), true); 117new Lazy<XamlType>(() => GetXamlType(typeof(TimeSpan)), true); 120new Lazy<ReadOnlyCollection<XamlType>>(GetAllTypes); 123new Lazy<XamlDirective>(() => GetXamlDirective(x_AsyncRecords, 126new Lazy<XamlDirective>(() => GetXamlDirective(x_Arguments, 129new Lazy<XamlDirective>(() => GetXamlDirective(x_Class)); 131new Lazy<XamlDirective>(() => GetXamlDirective(x_ClassModifier)); 133new Lazy<XamlDirective>(() => GetXamlDirective(x_Code)); 135new Lazy<XamlDirective>(() => GetXamlDirective(x_ConnectionId, 138new Lazy<XamlDirective>(() => GetXamlDirective(x_FactoryMethod, 141new Lazy<XamlDirective>(() => GetXamlDirective(x_FieldModifier)); 143new Lazy<XamlDirective>(() => GetXamlDirective(x_Items, 146new Lazy<XamlDirective>(() => GetXamlDirective(x_Initialization, 149new Lazy<XamlDirective>(() => GetXamlDirective(x_Key, 152new Lazy<XamlDirective>(() => GetXamlDirective(x_Members, 155new Lazy<XamlDirective>(() => GetXamlDirective(x_ClassAttributes, 158new Lazy<XamlDirective>(() => GetXamlDirective(x_Name)); 160new Lazy<XamlDirective>(() => GetXamlDirective(x_PositionalParameters, 163new Lazy<XamlDirective>(() => GetXamlDirective(x_Shared), true); 165new Lazy<XamlDirective>(() => GetXamlDirective(x_Subclass), true); 167new Lazy<XamlDirective>(() => GetXamlDirective(x_SynchronousMode)); 169new Lazy<XamlDirective>(() => GetXamlDirective(x_TypeArguments)); 171new Lazy<XamlDirective>(() => GetXamlDirective(x_Uid)); 173new Lazy<XamlDirective>(() => GetXamlDirective(x_UnknownContent, AllowedMemberLocations.MemberElement, MemberReflector.UnknownReflector), true); 176new Lazy<XamlDirective>(() => GetXmlDirective(xml_Base)); 178new Lazy<XamlDirective>(() => GetXmlDirective(xml_Lang)); 180new Lazy<XamlDirective>(() => GetXmlDirective(xml_Space)); 183new Lazy<ReadOnlyCollection<XamlDirective>>(GetAllDirectives);
Test.Utilities (6)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
Text.Analyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (2)
62globalOptions = new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => SyntaxTreeCategorizedAnalyzerConfigOptions.Create(analyzerConfigOptionsProvider.GlobalOptions)); 70perTreeOptionsBuilder.Add(tree, new Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>(() => Create(tree, analyzerConfigOptionsProvider)));
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
33_referencedAssemblies = new Lazy<ImmutableArray<IAssemblySymbol>>(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
31_lazyNamingStylePreferences = new Lazy<NamingStylePreferences>(() => EditorConfigNamingStyleParser.ParseDictionary(_options));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
xunit.assert (4)
Sdk\AssertEqualityComparer.cs (1)
156 this.innerComparer = new Lazy<IEqualityComparer>(() => innerComparer ?? AssertEqualityComparer<T>.DefaultInnerComparer);
Sdk\AssertHelper.cs (3)
70 static readonly Lazy<TypeInfo?> fileSystemInfoTypeInfo = new Lazy<TypeInfo?>(() => Type.GetType(fileSystemInfoFqn)?.GetTypeInfo()); 71 static readonly Lazy<PropertyInfo?> fileSystemInfoFullNameProperty = new Lazy<PropertyInfo?>(() => Type.GetType(fileSystemInfoFqn)?.GetTypeInfo().GetDeclaredProperty("FullName")); 79 static readonly Lazy<Assembly[]> getAssemblies = new Lazy<Assembly[]>(() =>
xunit.console (4)
common\AssemblyResolution\DependencyContextAssemblyCache.cs (1)
53fallbackRuntimeIdentifier = new Lazy<string>(() => GetFallbackRuntime(this.currentRuntimeIdentifier));
common\AssemblyResolution\Microsoft.DotNet.PlatformAbstractions\Native\PlatformApis.cs (2)
18private static readonly Lazy<Platform> _platform = new Lazy<Platform>(DetermineOSPlatform); 19private static readonly Lazy<DistroInfo> _distroInfo = new Lazy<DistroInfo>(LoadDistroInfo);
common\AssemblyResolution\Microsoft.Extensions.DependencyModel\DependencyContext.cs (1)
13private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
1339 references to Lazy
aspire (2)
src\Shared\ColorGenerator.cs (2)
59private readonly ConcurrentDictionary<string, Lazy<int>> _colorIndexByKey; 65_colorIndexByKey = new ConcurrentDictionary<string, Lazy<int>>(StringComparer.OrdinalIgnoreCase);
Aspire.Azure.Data.Tables.Tests (1)
ConformanceTests.cs (1)
20private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Azure.Messaging.ServiceBus.Tests (2)
ConformanceTests_Queue.cs (1)
16private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
ConformanceTests_Topic.cs (1)
17private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Azure.Security.KeyVault.Tests (3)
CertificateClientConformanceTests.cs (1)
19private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
KeyClientConformanceTests.cs (1)
21private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
SecretClientConformanceTests.cs (1)
20private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Azure.Storage.Blobs.Tests (1)
ConformanceTests.cs (1)
20private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Azure.Storage.Files.DataLake.Tests (1)
ConformanceTests.cs (1)
18private static readonly Lazy<bool> s_canConnectToServer = new(CanConnect);
Aspire.Azure.Storage.Queues.Tests (1)
ConformanceTests.cs (1)
20private static readonly Lazy<bool> s_canConnectToServer = new(GetCanConnect);
Aspire.Confluent.Kafka.Tests (5)
ReflectionHelpers.cs (5)
12public static readonly Lazy<Type> MetricsChannelType = new Lazy<Type>(() => ComponentAssembly.GetType("Aspire.Confluent.Kafka.MetricsChannel")!); 13public static readonly Lazy<Type> ProducerConnectionFactoryType = new Lazy<Type>(() => ComponentAssembly.GetType("Aspire.Confluent.Kafka.ProducerConnectionFactory`2")!); 14public static readonly Lazy<Type> ProducerConnectionFactoryStringKeyStringValueType = new Lazy<Type>(() => ProducerConnectionFactoryType.Value.MakeGenericType(typeof(string), typeof(string))); 15public static readonly Lazy<Type> ConsumerConnectionFactoryType = new Lazy<Type>(() => ComponentAssembly.GetType("Aspire.Confluent.Kafka.ConsumerConnectionFactory`2")!); 16public static readonly Lazy<Type> ConsumerConnectionFactoryStringKeyStringValueType = new Lazy<Type>(() => ConsumerConnectionFactoryType.Value.MakeGenericType(typeof(string), typeof(string)));
Aspire.Dashboard (6)
Model\ResourceViewModel.cs (3)
23private Lazy<ImmutableArray<string>>? _cachedAddresses; 308private readonly Lazy<string> _displayValue; 309private readonly Lazy<string> _tooltip;
src\Shared\ColorGenerator.cs (2)
59private readonly ConcurrentDictionary<string, Lazy<int>> _colorIndexByKey; 65_colorIndexByKey = new ConcurrentDictionary<string, Lazy<int>>(StringComparer.OrdinalIgnoreCase);
Utils\VersionHelpers.cs (1)
11private static readonly Lazy<string?> s_cachedRuntimeVersion = new Lazy<string?>(GetRuntimeVersion);
Aspire.Dashboard.Components.Tests (2)
UseCultureAttribute.cs (2)
17private readonly Lazy<CultureInfo> _culture; 18private readonly Lazy<CultureInfo> _uiCulture;
Aspire.EndToEnd.Tests (5)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
25public static Lazy<HttpClient> Client => new(CreateHttpClient);
tests\Shared\TemplatesTesting\BuildEnvironment.cs (4)
40private static readonly Lazy<BuildEnvironment> s_instance_80 = new(() => 43private static readonly Lazy<BuildEnvironment> s_instance_90 = new(() => 46private static readonly Lazy<BuildEnvironment> s_instance_100 = new(() => 49private static readonly Lazy<BuildEnvironment> s_instance_100_90_80 = new(() =>
Aspire.Hosting (10)
ApplicationModel\ParameterResource.cs (1)
14private readonly Lazy<string> _lazyValue;
DeveloperCertificateService.cs (3)
16private readonly Lazy<ImmutableList<X509Certificate2>> _certificates; 17private readonly Lazy<bool> _supportsContainerTrust; 18private readonly Lazy<bool> _supportsTlsTermination;
DistributedApplicationOptions.cs (6)
13private readonly Lazy<Assembly?> _assembly; 14private readonly Lazy<string?> _projectDirectoryLazy; 15private readonly Lazy<string?> _projectNameLazy; 16private readonly Lazy<string?> _dashboardApplicationNameLazy; 17private readonly Lazy<string?> _appHostFilePathLazy; 18private readonly Lazy<string?> _configurationLazy;
Aspire.Hosting.Azure (5)
AzureResourcePreparer.cs (3)
326Lazy<BicepValue<RoleManagementPrincipalType>> getPrincipalType, 327Lazy<BicepValue<Guid>> getPrincipalId, 328Lazy<BicepValue<string>> getPrincipalName) : IAddRoleAssignmentsContext
Provisioning\Provisioners\AzureProvisioner.cs (2)
166var provisioningContextLazy = new Lazy<Task<ProvisioningContext>>(() => provisioningContextProvider.CreateProvisioningContextAsync(cancellationToken)); 187private async Task ProcessResourceAsync(IConfiguration configuration, Lazy<Task<ProvisioningContext>> provisioningContextLazy, (IResource Resource, IAzureResource AzureResource) resource, CancellationToken cancellationToken)
Aspire.Hosting.JavaScript (1)
JavaScriptHostingExtensions.cs (1)
158var defaultBaseImage = new Lazy<string>(() => GetDefaultBaseImage(appDirectory, "alpine", dockerfileContext.Services));
Aspire.Hosting.Testing.Tests (1)
DistributedApplicationHttpClientExtensionsForTests.cs (1)
11private static readonly Lazy<IHttpClientFactory> s_httpClientFactory = new(CreateHttpClientFactoryWithResilience);
Aspire.Hosting.Tests (1)
tests\Aspire.Hosting.Testing.Tests\DistributedApplicationHttpClientExtensionsForTests.cs (1)
11private static readonly Lazy<IHttpClientFactory> s_httpClientFactory = new(CreateHttpClientFactoryWithResilience);
Aspire.StackExchange.Redis (1)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\Implementation\RedisProfilerEntryToActivityConverter.cs (1)
19private static readonly Lazy<Func<object, (string?, string?)>> MessageDataGetter = new(() =>
Aspire.Templates.Tests (6)
TemplateTestsBase.cs (1)
22private static Lazy<IBrowser> Browser => new(CreateBrowser);
tests\Shared\TemplatesTesting\AspireProject.cs (1)
25public static Lazy<HttpClient> Client => new(CreateHttpClient);
tests\Shared\TemplatesTesting\BuildEnvironment.cs (4)
40private static readonly Lazy<BuildEnvironment> s_instance_80 = new(() => 43private static readonly Lazy<BuildEnvironment> s_instance_90 = new(() => 46private static readonly Lazy<BuildEnvironment> s_instance_100 = new(() => 49private static readonly Lazy<BuildEnvironment> s_instance_100_90_80 = new(() =>
Aspire.TestUtilities (2)
UseCultureAttribute.cs (2)
26private readonly Lazy<CultureInfo> _culture = new(() => new(culture, useUserOverride: false)); 27private readonly Lazy<CultureInfo> _uiCulture = new(() => new(uiCulture, useUserOverride: false));
aspire-server (6)
AssemblyLoader.cs (1)
16private readonly Lazy<IReadOnlyList<Assembly>> _assemblies;
Ats\AtsMarshaller.cs (2)
21private readonly Lazy<AtsCallbackProxyFactory> _callbackProxyFactory; 34Lazy<AtsCallbackProxyFactory> callbackProxyFactory)
AtsContextFactory.cs (1)
15private readonly Lazy<AtsContext> _context;
CodeGeneration\CodeGeneratorResolver.cs (1)
16private readonly Lazy<Dictionary<string, ICodeGenerator>> _generators;
Language\LanguageSupportResolver.cs (1)
16private readonly Lazy<Dictionary<string, ILanguageSupport>> _languages;
dotnet-svcutil-lib (2)
FrameworkFork\Microsoft.Xml\Xml\Serialization\SourceInfo.cs (1)
22private static readonly Lazy<MethodInfo> s_iListGetItemMethod = new Lazy<MethodInfo>(
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (1)
49private Lazy<string> _webSocketSoapContentType;
GenerateDocumentationAndConfigFiles (16)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\IMefHostExportProvider.cs (1)
13IEnumerable<Lazy<TExtension>> GetExports<TExtension>();
ILLink.RoslynAnalyzer (2)
DynamicallyAccessedMembersAnalyzer.cs (1)
27public static Lazy<ImmutableArray<RequiresAnalyzerBase>> RequiresAnalyzers { get; } = new Lazy<ImmutableArray<RequiresAnalyzerBase>>(GetRequiresAnalyzers);
TrimAnalysis\FlowAnnotations.cs (1)
18private static readonly Lazy<FlowAnnotations> _instance = new(() => new FlowAnnotations(), isThreadSafe: true);
Infrastructure.Common (1)
TestProperties.cs (1)
19private static Lazy<Dictionary<String, String>> s_properties = new Lazy<Dictionary<String, String>>(() =>
Metrics (15)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
Metrics.Legacy (15)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
Microsoft.AspNetCore.App.Analyzers.Test (2)
RouteEmbeddedLanguage\Infrastructure\ExportProviderExtensions.cs (1)
75if (contractType.GetGenericTypeDefinition() == typeof(Lazy<>))
TestDiagnosticAnalyzer.cs (1)
114private static readonly Lazy<IExportProviderFactory> ExportProviderFactory;
Microsoft.AspNetCore.DataProtection (3)
Internal\ContainerUtils.cs (1)
14private static readonly Lazy<bool> _isContainer = new Lazy<bool>(IsProcessRunningInContainer);
Repositories\DefaultKeyStorageDirectories.cs (1)
13private static readonly Lazy<DirectoryInfo?> _defaultDirectoryLazy = new Lazy<DirectoryInfo?>(GetKeyStorageDirectoryImpl);
Repositories\RegistryXmlRepository.cs (1)
23private static readonly Lazy<RegistryKey?> _defaultRegistryKeyLazy = new Lazy<RegistryKey?>(GetDefaultHklmStorageKey);
Microsoft.AspNetCore.DataProtection.Tests (3)
Internal\KeyManagementOptionsSetupTest.cs (1)
114private static readonly Lazy<RegistryKey> LazyHkcuTempKey = new Lazy<RegistryKey>(() =>
RegistryPolicyResolverTests.cs (1)
286private static readonly Lazy<RegistryKey> LazyHkcuTempKey = new Lazy<RegistryKey>(() =>
Repositories\RegistryXmlRepositoryTests.cs (1)
237private static readonly Lazy<RegistryKey> LazyHkcuTempKey = new Lazy<RegistryKey>(() =>
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
GrpcJsonTranscodingOptions.cs (2)
16private readonly Lazy<JsonSerializerOptions> _unaryOptions; 17private readonly Lazy<JsonSerializerOptions> _serverStreamingOptions;
Microsoft.AspNetCore.Http.Extensions (2)
src\Shared\ParameterBindingMethodCache.cs (2)
30private static readonly Lazy<ParameterBindingMethodCache> _instance = new(() => new ParameterBindingMethodCache()); 32private static readonly Lazy<ParameterBindingMethodCache> _nonThrowingInstance = new(() => new ParameterBindingMethodCache(throwOnInvalidMethod: false));
Microsoft.AspNetCore.HttpsPolicy (1)
HttpsRedirectionMiddleware.cs (1)
22private readonly Lazy<int> _httpsPort;
Microsoft.AspNetCore.InternalTesting (1)
TestContext.cs (1)
19private readonly Lazy<TestFileOutputContext> _files;
Microsoft.AspNetCore.Mvc.Abstractions (2)
src\Shared\ParameterBindingMethodCache.cs (2)
30private static readonly Lazy<ParameterBindingMethodCache> _instance = new(() => new ParameterBindingMethodCache()); 32private static readonly Lazy<ParameterBindingMethodCache> _nonThrowingInstance = new(() => new ParameterBindingMethodCache(throwOnInvalidMethod: false));
Microsoft.AspNetCore.Mvc.Core (3)
Filters\MiddlewareFilterBuilder.cs (3)
20private readonly ConcurrentDictionary<Type, Lazy<RequestDelegate>> _pipelinesCache 21= new ConcurrentDictionary<Type, Lazy<RequestDelegate>>(); 35var requestDelegate = _pipelinesCache.GetOrAdd(
Microsoft.AspNetCore.OpenApi (2)
src\Shared\ParameterBindingMethodCache.cs (2)
30private static readonly Lazy<ParameterBindingMethodCache> _instance = new(() => new ParameterBindingMethodCache()); 32private static readonly Lazy<ParameterBindingMethodCache> _nonThrowingInstance = new(() => new ParameterBindingMethodCache(throwOnInvalidMethod: false));
Microsoft.AspNetCore.Server.IntegrationTesting (1)
Deployers\RemoteWindowsDeployer\RemoteWindowsDeployer.cs (1)
22private static readonly Lazy<Scripts> _scripts = new Lazy<Scripts>(CopyEmbeddedScriptFilesToDisk);
Microsoft.AspNetCore.SignalR.Core (2)
Internal\DefaultHubActivator.cs (1)
13private static readonly Lazy<ObjectFactory> _objectFactory = new Lazy<ObjectFactory>(() => ActivatorUtilities.CreateFactory(typeof(THub), Type.EmptyTypes));
Internal\TypedClientBuilder.cs (1)
17private static readonly Lazy<Func<IClientProxy, T>> _builder = new Lazy<Func<IClientProxy, T>>(GenerateClientBuilder);
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
Docker.cs (1)
22private static readonly Lazy<Docker> _instance = new Lazy<Docker>(Create);
Microsoft.AspNetCore.WebSockets.ConformanceTests (1)
Autobahn\Wstest.cs (1)
11private static readonly Lazy<Wstest> _instance = new Lazy<Wstest>(Create);
Microsoft.Build (58)
BackEnd\Components\Communications\TranslatorExtensions.cs (1)
23private static readonly Lazy<ConcurrentDictionary<Type, ConstructorInfo>> parameterlessConstructorCache = new Lazy<ConcurrentDictionary<Type, ConstructorInfo>>(() => new ConcurrentDictionary<Type, ConstructorInfo>());
BackEnd\Components\Logging\LoggingService.cs (3)
98private static readonly Lazy<PropertyInfo> s_projectStartedEventArgsGlobalProperties = new Lazy<PropertyInfo>(() => typeof(ProjectStartedEventArgs).GetProperty("GlobalProperties", BindingFlags.Public | BindingFlags.Instance), LazyThreadSafetyMode.PublicationOnly); 107private static readonly Lazy<PropertyInfo> s_projectStartedEventArgsToolsVersion = new Lazy<PropertyInfo>(() => typeof(ProjectStartedEventArgs).GetProperty("ToolsVersion", BindingFlags.Public | BindingFlags.Instance), LazyThreadSafetyMode.PublicationOnly); 173private Lazy<IConfigCache> _configCache;
BackEnd\Components\ProjectCache\ProjectCacheService.cs (3)
50private readonly ConcurrentDictionary<ProjectCacheDescriptor, Lazy<Task<ProjectCachePlugin>>> _projectCachePlugins = new(ProjectCacheDescriptorEqualityComparer.Instance); 865if (!_projectCachePlugins.TryGetValue(projectCacheDescriptor, out Lazy<Task<ProjectCachePlugin>>? pluginLazyTask)) 943foreach (KeyValuePair<ProjectCacheDescriptor, Lazy<Task<ProjectCachePlugin>>> kvp in _projectCachePlugins)
BackEnd\Components\SdkResolution\CachingSdkResolverService.cs (5)
22private readonly ConcurrentDictionary<int, ConcurrentDictionary<string, Lazy<SdkResult>>> _cache = new ConcurrentDictionary<int, ConcurrentDictionary<string, Lazy<SdkResult>>>(); 53ConcurrentDictionary<string, Lazy<SdkResult>> cached = _cache.GetOrAdd( 55_ => new ConcurrentDictionary<string, Lazy<SdkResult>>(MSBuildNameIgnoreCaseComparer.Default)); 61Lazy<SdkResult> resultLazy = cached.GetOrAdd(
BackEnd\Components\SdkResolution\OutOfProcNodeSdkResolverService.cs (3)
32private readonly ConcurrentDictionary<string, Lazy<SdkResult>> _responseCache = new ConcurrentDictionary<string, Lazy<SdkResult>>(MSBuildNameIgnoreCaseComparer.Default); 79Lazy<SdkResult> sdkResultLazy = _responseCache.GetOrAdd(
BackEnd\Components\SdkResolution\SdkResolverService.cs (1)
31private static readonly Lazy<SdkResolverService> InstanceLazy = new Lazy<SdkResolverService>(() => new SdkResolverService(), isThreadSafe: true);
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
Definition\Toolset.cs (1)
146private readonly Lazy<string> _defaultSubToolsetVersionLazy;
Definition\ToolsetConfigurationReader.cs (1)
51private static readonly Lazy<Configuration> s_configurationCache = new Lazy<Configuration>(ReadOpenMappedExeConfiguration);
Evaluation\IntrinsicFunctions.cs (1)
53private static readonly Lazy<NuGetFrameworkWrapper> NuGetFramework = new Lazy<NuGetFrameworkWrapper>(() => NuGetFrameworkWrapper.CreateInstance());
FileMatcher.cs (4)
52private static readonly Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>> s_cachedGlobExpansions = new Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>>(() => new ConcurrentDictionary<string, IReadOnlyList<string>>(StringComparer.OrdinalIgnoreCase)); 53private static readonly Lazy<ConcurrentDictionary<string, object>> s_cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase)); 54private static readonly Lazy<ConcurrentDictionary<string, (Regex regex, bool needsRecursion, bool isLegalFileSpec)>> s_regexCache = new(() =>new(StringComparer.Ordinal)); 57private readonly Lazy<ConcurrentDictionary<string, object>> _cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase));
FrameworkLocationHelper.cs (3)
237private static readonly Lazy<VisualStudioSpec[]> VisualStudioSpecs = new(() => 433private static readonly Lazy<IReadOnlyDictionary<Version, DotNetFrameworkSpec>> DotNetFrameworkSpecDict = new(() => DotNetFrameworkSpecs().ToDictionary(spec => spec.Version)); 434private static readonly Lazy<IReadOnlyDictionary<Version, VisualStudioSpec>> VisualStudioSpecDict = new(() => VisualStudioSpecs.Value.ToDictionary(spec => spec.Version));
Globbing\MSBuildGlob.cs (3)
53private readonly Lazy<GlobState> _state; 87private MSBuildGlob(Lazy<GlobState> state) 183var lazyState = new Lazy<GlobState>(() =>
Graph\GraphBuilder.cs (1)
54private ConcurrentDictionary<ConfigurationMetadata, Lazy<ProjectInstance>> _platformNegotiationInstancesCache = new();
Graph\ParallelWorkSet.cs (8)
27private readonly ConcurrentDictionary<TKey, Lazy<TResult>> _inProgressOrCompletedWork; 33private readonly ConcurrentQueue<Lazy<TResult>> _queue = 34new ConcurrentQueue<Lazy<TResult>>(); 51foreach (KeyValuePair<TKey, Lazy<TResult>> kvp in _inProgressOrCompletedWork) 53Lazy<TResult> workItem = kvp.Value; 88_inProgressOrCompletedWork = new ConcurrentDictionary<TKey, Lazy<TResult>>(comparer); 112var workItem = new Lazy<TResult>(workFunc); 195if (_queue.TryDequeue(out Lazy<TResult> workItem))
Graph\ProjectGraph.cs (1)
60private readonly Lazy<IReadOnlyCollection<ProjectGraphNode>> _projectNodesTopologicallySorted;
InprocTrackingNativeMethods.cs (1)
153private static readonly Lazy<string> fileTrackerDllName = new Lazy<string>(() => RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "FileTrackerA4.dll" : (IntPtr.Size == sizeof(Int32)) ? "FileTracker32.dll" : "FileTracker64.dll");
Instance\HostServices.cs (1)
60private Lazy<IRunningObjectTableWrapper> _runningObjectTable = new Lazy<IRunningObjectTableWrapper>(() => new RunningObjectTable());
Instance\TaskFactoryWrapper.cs (1)
63private Lazy<PropertyData> _propertyData;
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 37public static Lazy<PrintLineDebugger> Default = 40public static Lazy<PrintLineDebugger> DefaultWithProcessInfo =
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
RegisteredTaskObjectCacheBase.cs (7)
24private static readonly Lazy<ConcurrentDictionary<object, object>> s_appDomainLifetimeObjects = new Lazy<ConcurrentDictionary<object, object>>(); 29private Lazy<ConcurrentDictionary<object, object>> _buildLifetimeObjects = new Lazy<ConcurrentDictionary<object, object>>(); 51var lazyCollection = GetLazyCollectionForLifetime(lifetime); 105Lazy<ConcurrentDictionary<object, object>> dict = GetLazyCollectionForLifetime(lifetime); 119protected Lazy<ConcurrentDictionary<object, object>> GetLazyCollectionForLifetime(RegisteredTaskObjectLifetime lifetime) 121Lazy<ConcurrentDictionary<object, object>> dict = null; 139private static void DisposeObjects(Lazy<ConcurrentDictionary<object, object>> lifetimeObjects)
Resources\MSBuildAssemblyFileVersion.cs (1)
17private static readonly Lazy<MSBuildAssemblyFileVersion> MSBuildAssemblyFileVersionLazy = new Lazy<MSBuildAssemblyFileVersion>(GetMSBuildAssemblyFileVersion, isThreadSafe: true);
TypeLoader.cs (1)
84private static readonly Lazy<string[]> runtimeAssembliesCLR35_20 = new Lazy<string[]>(FindRuntimeAssembliesWithMicrosoftBuildFrameworkCLR2CLR35);
Utilities\EngineFileUtilities.cs (2)
588private static readonly Lazy<ConcurrentDictionary<string, bool>> _regexMatchCache = new Lazy<ConcurrentDictionary<string, bool>>(() => new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase)); 599private readonly Lazy<ConcurrentDictionary<string, bool>> existenceCache = new Lazy<ConcurrentDictionary<string, bool>>(() => new ConcurrentDictionary<string, bool>(), true);
Microsoft.Build.Engine.OM.UnitTests (7)
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
Definition\ProjectItem_Tests.cs (1)
58private Lazy<DummyMappedDrive> _mappedDrive = DummyMappedDriveUtils.GetLazyDummyMappedDrive();
Instance\ProjectItemInstance_Tests.cs (1)
28private Lazy<DummyMappedDrive> _mappedDrive = DummyMappedDriveUtils.GetLazyDummyMappedDrive();
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 37public static Lazy<PrintLineDebugger> Default = 40public static Lazy<PrintLineDebugger> DefaultWithProcessInfo =
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
Microsoft.Build.Engine.UnitTests (2)
FileMatcher_Tests.cs (1)
25private Lazy<DummyMappedDrive> _mappedDrive = DummyMappedDriveUtils.GetLazyDummyMappedDrive();
ProjectCache\ProjectCacheTests.cs (1)
74private static readonly Lazy<string> s_samplePluginAssemblyPath =
Microsoft.Build.Framework (8)
AssemblyUtilities.cs (2)
30private static Lazy<CultureInfo[]> s_validCultures = new Lazy<CultureInfo[]>(() => GetValidCultures(), true); 33private static Lazy<Assembly> s_entryAssembly = new Lazy<Assembly>(() => GetEntryAssembly());
FileClassifier.cs (2)
74/// Single, static <see cref="Lazy{T}"/> instance of shared file FileClassifier for <see cref="Shared"/> member. 76private static readonly Lazy<FileClassifier> s_sharedInstance = new(() => new FileClassifier());
FileUtilities_TempFiles.cs (2)
16private static Lazy<string> tempFileDirectory = CreateTempFileDirectoryLazy(); 22private static Lazy<string> CreateTempFileDirectoryLazy()
NativeMethods.cs (2)
844private static readonly Lazy<bool> s_isFileSystemCaseSensitive = new(() => 918/// Initially implemented as <see cref="Lazy{SystemInformationData}"/>, but
Microsoft.Build.Tasks.Core (33)
AssemblyDependency\AssemblyFoldersFromConfig\AssemblyFoldersFromConfigResolver.cs (1)
26private static readonly Lazy<Regex> s_crackAssemblyFoldersFromConfigSentinel = new Lazy<Regex>(
CultureInfoCache.cs (1)
27private static readonly Lazy<HashSet<string>> ValidCultureNames = new Lazy<HashSet<string>>(() => InitializeValidCultureNames());
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
Exec.cs (1)
498private static readonly Lazy<string> CommandProcessorPath = new Lazy<string>(() =>
FileMatcher.cs (4)
52private static readonly Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>> s_cachedGlobExpansions = new Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>>(() => new ConcurrentDictionary<string, IReadOnlyList<string>>(StringComparer.OrdinalIgnoreCase)); 53private static readonly Lazy<ConcurrentDictionary<string, object>> s_cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase)); 54private static readonly Lazy<ConcurrentDictionary<string, (Regex regex, bool needsRecursion, bool isLegalFileSpec)>> s_regexCache = new(() =>new(StringComparer.Ordinal)); 57private readonly Lazy<ConcurrentDictionary<string, object>> _cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase));
FileState.cs (1)
233private Lazy<FileDirInfo> _data;
GetFrameworkPath.cs (16)
36private static readonly Lazy<string> s_path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Latest)); 37private static readonly Lazy<string> s_version11Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version11)); 38private static readonly Lazy<string> s_version20Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version20)); 39private static readonly Lazy<string> s_version30Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version30)); 40private static readonly Lazy<string> s_version35Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version35)); 41private static readonly Lazy<string> s_version40Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version40)); 42private static readonly Lazy<string> s_version45Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version45)); 43private static readonly Lazy<string> s_version451Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version451)); 44private static readonly Lazy<string> s_version452Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version452)); 45private static readonly Lazy<string> s_version46Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version46)); 46private static readonly Lazy<string> s_version461Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version461)); 47private static readonly Lazy<string> s_version462Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version462)); 48private static readonly Lazy<string> s_version47Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version47)); 49private static readonly Lazy<string> s_version471Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version471)); 50private static readonly Lazy<string> s_version472Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version472)); 51private static readonly Lazy<string> s_version48Path = new Lazy<string>(() => ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version48));
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 37public static Lazy<PrintLineDebugger> Default = 40public static Lazy<PrintLineDebugger> DefaultWithProcessInfo =
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
RoslynCodeTaskFactory\RoslynCodeTaskFactory.cs (1)
92private static readonly Lazy<string> ThisAssemblyDirectoryLazy = new Lazy<string>(() => Path.GetDirectoryName(typeof(RoslynCodeTaskFactory).GetTypeInfo().Assembly.ManifestModule.FullyQualifiedName));
RoslynCodeTaskFactory\RoslynCodeTaskFactoryCompilers.cs (1)
25private readonly Lazy<string> _executablePath;
WriteCodeFragment.cs (2)
278Lazy<Type> attributeType = new( 412Lazy<Type> attributeType,
Microsoft.Build.Tasks.UnitTests (1)
CreateItem_Tests.cs (1)
33private Lazy<DummyMappedDrive> _mappedDrive = DummyMappedDriveUtils.GetLazyDummyMappedDrive();
Microsoft.Build.UnitTests.Shared (2)
DummyMappedDriveUtils.cs (1)
23public static Lazy<DummyMappedDrive?> GetLazyDummyMappedDrive() => new Lazy<DummyMappedDrive?>(() =>
TestEnvironment.cs (1)
42private readonly Lazy<TransientTestFolder> _defaultTestDirectory;
Microsoft.Build.Utilities.Core (12)
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
FileMatcher.cs (4)
52private static readonly Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>> s_cachedGlobExpansions = new Lazy<ConcurrentDictionary<string, IReadOnlyList<string>>>(() => new ConcurrentDictionary<string, IReadOnlyList<string>>(StringComparer.OrdinalIgnoreCase)); 53private static readonly Lazy<ConcurrentDictionary<string, object>> s_cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase)); 54private static readonly Lazy<ConcurrentDictionary<string, (Regex regex, bool needsRecursion, bool isLegalFileSpec)>> s_regexCache = new(() =>new(StringComparer.Ordinal)); 57private readonly Lazy<ConcurrentDictionary<string, object>> _cachedGlobExpansionsLock = new Lazy<ConcurrentDictionary<string, object>>(() => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase));
FrameworkLocationHelper.cs (3)
237private static readonly Lazy<VisualStudioSpec[]> VisualStudioSpecs = new(() => 433private static readonly Lazy<IReadOnlyDictionary<Version, DotNetFrameworkSpec>> DotNetFrameworkSpecDict = new(() => DotNetFrameworkSpecs().ToDictionary(spec => spec.Version)); 434private static readonly Lazy<IReadOnlyDictionary<Version, VisualStudioSpec>> VisualStudioSpecDict = new(() => VisualStudioSpecs.Value.ToDictionary(spec => spec.Version));
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 37public static Lazy<PrintLineDebugger> Default = 40public static Lazy<PrintLineDebugger> DefaultWithProcessInfo =
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
Microsoft.CodeAnalysis (26)
AdditionalTextFile.cs (1)
21private readonly Lazy<SourceText?> _text;
CommandLine\CommandLineArguments.cs (1)
312private readonly Lazy<ImmutableArray<ResourceDescription>> _lazyManifestResources;
CommandLine\CommonCompiler.cs (1)
74private readonly Lazy<Encoding> _fallbackEncoding = new Lazy<Encoding>(EncodedStringText.CreateFallbackEncoding);
CommandLine\CommonCompiler.ExistingReferencesResolver.cs (1)
26private readonly Lazy<HashSet<AssemblyIdentity>> _lazyAvailableReferences;
Compilation\Compilation.cs (1)
72private readonly Lazy<int?> _lazyDataSectionStringLiteralThreshold;
Compilation\CompilationOptions.cs (1)
262private readonly Lazy<ImmutableArray<Diagnostic>> _lazyErrors;
Compilation\ParseOptions.cs (1)
21private readonly Lazy<ImmutableArray<Diagnostic>> _lazyErrors;
DiagnosticAnalyzer\AnalysisScope.cs (1)
23private readonly Lazy<ImmutableHashSet<DiagnosticAnalyzer>> _lazyAnalyzersSet;
DiaSymReader\SymUnmanagedFactory.cs (1)
79private static readonly Lazy<Func<string, string>> s_lazyGetEnvironmentVariable = new Lazy<Func<string, string>>(() =>
Emit\CommonPEModuleBuilder.cs (1)
41private readonly Lazy<StringTokenMap> _stringsInILMap;
EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
MetadataReader\PEModule.cs (2)
68private readonly Lazy<IdentifierCollection> _lazyTypeNameCollection; 69private readonly Lazy<IdentifierCollection> _lazyNamespaceNameCollection;
SourceGeneration\GeneratorContexts.cs (2)
234private readonly Lazy<SemanticModel>? _semanticModel; 236internal GeneratorSyntaxContext(SyntaxNode node, Lazy<SemanticModel>? semanticModel, ISyntaxHelper syntaxHelper)
SourceGeneration\GeneratorSyntaxWalker.cs (1)
23public void VisitWithModel(Lazy<SemanticModel>? model, SyntaxNode node)
SourceGeneration\Nodes\ISyntaxStrategy.cs (2)
20void VisitTree(Lazy<SyntaxNode> root, EntryState state, Lazy<SemanticModel>? model, CancellationToken cancellationToken);
SourceGeneration\Nodes\PredicateSyntaxStrategy.cs (2)
62Lazy<SyntaxNode> root, 64Lazy<SemanticModel>? model,
SourceGeneration\Nodes\SyntaxReceiverStrategy.cs (2)
68Lazy<SyntaxNode> root, 70Lazy<SemanticModel>? model,
SourceGeneration\SyntaxStore.cs (2)
89var root = new Lazy<SyntaxNode>(() => tree.GetRoot(_cancellationToken)); 90var model = state != EntryState.Removed ? new Lazy<SemanticModel>(() => _compilation.GetSemanticModel(tree)) : null;
Microsoft.CodeAnalysis.Analyzers (17)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (1)
413private readonly Lazy<ImmutableArray<ISymbol>> _lazySymbols;
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\IMefHostExportProvider.cs (1)
13IEnumerable<Lazy<TExtension>> GetExports<TExtension>();
Microsoft.CodeAnalysis.AnalyzerUtilities (35)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAnalysis.TaintedDataOperationVisitor.cs (2)
686Lazy<HashSet<SinkKind>> lazySinkKinds = new Lazy<HashSet<SinkKind>>(() => []); 727Lazy<HashSet<SinkKind>> lazySinkKinds = new Lazy<HashSet<SinkKind>>(() => []);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataConfig.cs (16)
58private ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SourceInfo>>> SourceSymbolMap { get; } 63private ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SanitizerInfo>>> SanitizerSymbolMap { get; } 68private ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SinkInfo>>> SinkSymbolMap { get; } 82ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SourceInfo>>> sourceSymbolMap, 83ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SanitizerInfo>>> sanitizerSymbolMap, 84ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SinkInfo>>> sinkSymbolMap) 96PooledDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SourceInfo>>>.GetInstance(out var sourceSymbolMapBuilder); 98PooledDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SanitizerInfo>>>.GetInstance(out var sanitizerSymbolMapBuilder); 100PooledDictionary<SinkKind, Lazy<TaintedDataSymbolMap<SinkInfo>>>.GetInstance(out var sinkSymbolMapBuilder); 105PooledDictionary<ImmutableHashSet<SourceInfo>, Lazy<TaintedDataSymbolMap<SourceInfo>>>.GetInstance(out var sourcesToSymbolMap); 107PooledDictionary<ImmutableHashSet<SanitizerInfo>, Lazy<TaintedDataSymbolMap<SanitizerInfo>>>.GetInstance(out var sanitizersToSymbolMap); 117if (!sourcesToSymbolMap.TryGetValue(sources, out Lazy<TaintedDataSymbolMap<SourceInfo>> lazySourceSymbolMap)) 128if (!sanitizersToSymbolMap.TryGetValue(sanitizers, out Lazy<TaintedDataSymbolMap<SanitizerInfo>> lazySanitizerSymbolMap)) 152Lazy<TaintedDataSymbolMap<SinkInfo>> lazySinkSymbolMap = new Lazy<TaintedDataSymbolMap<SinkInfo>>( 191private TaintedDataSymbolMap<T> GetFromMap<T>(SinkKind sinkKind, ImmutableDictionary<SinkKind, Lazy<TaintedDataSymbolMap<T>>> map) 194if (map.TryGetValue(sinkKind, out var lazySourceSymbolMap))
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataSymbolMapExtensions.cs (2)
38Lazy<PointsToAnalysisResult?> pointsToFactory, 39Lazy<(PointsToAnalysisResult? p, ValueContentAnalysisResult? v)> valueContentFactory,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
Microsoft.CodeAnalysis.BannedApiAnalyzers (17)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\IMefHostExportProvider.cs (1)
13IEnumerable<Lazy<TExtension>> GetExports<TExtension>();
SymbolIsBannedAnalyzerBase.cs (1)
413private readonly Lazy<ImmutableArray<ISymbol>> _lazySymbols;
Microsoft.CodeAnalysis.CodeStyle (7)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
36private readonly Lazy<ImmutableHashSet<int>> _lazySupportedCompilerErrorCodes;
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
Host\Mef\CodeStyleHostLanguageServices.cs (1)
76IEnumerable<Lazy<TExtension>> IMefHostExportProvider.GetExports<TExtension>()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\IMefHostExportProvider.cs (1)
13IEnumerable<Lazy<TExtension>> GetExports<TExtension>();
Microsoft.CodeAnalysis.CSharp (28)
CommandLine\CommandLineDiagnosticFormatter.cs (1)
16private readonly Lazy<string> _lazyNormalizedBaseDirectory;
Compilation\MemberSemanticModel.cs (1)
44private readonly Lazy<CSharpOperationFactory> _operationFactory;
Compilation\SyntaxAndDeclarationManager.cs (9)
60var declMapBuilder = PooledDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>>.GetInstance(); 163IDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMapBuilder, 198IDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMapBuilder, 295IDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMapBuilder, 299var lazyRoot = new Lazy<RootSingleNamespaceDeclaration>(() => DeclarationTreeBuilder.ForTree(tree, scriptClassName, isSubmission, lastComputedMemberNames)); 458IDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> declMap, 461var lazyRoot = declMap[tree]; 607ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>>.Builder declMapBuilder, 610var previousRootNamespaceDeclaration = declMapBuilder[oldTree];
Compilation\SyntaxAndDeclarationManager.LazyState.cs (2)
24internal readonly ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> RootNamespaces; 51ImmutableDictionary<SyntaxTree, Lazy<RootSingleNamespaceDeclaration>> rootNamespaces,
Declarations\DeclarationTable.Builder.cs (9)
20private readonly List<Lazy<RootSingleNamespaceDeclaration>> _addedLazyRootDeclarations; 21private readonly List<Lazy<RootSingleNamespaceDeclaration>> _removedLazyRootDeclarations; 26_addedLazyRootDeclarations = new List<Lazy<RootSingleNamespaceDeclaration>>(); 27_removedLazyRootDeclarations = new List<Lazy<RootSingleNamespaceDeclaration>>(); 39public void AddRootDeclaration(Lazy<RootSingleNamespaceDeclaration> lazyRootDeclaration) 47public void RemoveRootDeclaration(Lazy<RootSingleNamespaceDeclaration> lazyRootDeclaration) 75var lastDeclaration = _addedLazyRootDeclarations[_addedLazyRootDeclarations.Count - 1]; 117var firstDeclaration = _removedLazyRootDeclarations[0]; 139var newLatestLazyRootDeclaration = isLatestRemoved ? null : _table._latestLazyRootDeclaration;
Declarations\DeclarationTable.cs (5)
26allOlderRootDeclarations: ImmutableSetWithInsertionOrder<Lazy<RootSingleNamespaceDeclaration>>.Empty, 32private readonly ImmutableSetWithInsertionOrder<Lazy<RootSingleNamespaceDeclaration>> _allOlderRootDeclarations; 33private readonly Lazy<RootSingleNamespaceDeclaration>? _latestLazyRootDeclaration; 46ImmutableSetWithInsertionOrder<Lazy<RootSingleNamespaceDeclaration>> allOlderRootDeclarations, 47Lazy<RootSingleNamespaceDeclaration>? latestLazyRootDeclaration,
Errors\ErrorFacts.cs (1)
21private static readonly Lazy<ImmutableDictionary<ErrorCode, string>> s_categoriesMap = new Lazy<ImmutableDictionary<ErrorCode, string>>(CreateCategoriesMap);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
EventHookup\EventHookupSessionManager.cs (2)
31Lazy<SuggestionServiceBase> suggestionServiceBase) 35internal readonly Lazy<SuggestionServiceBase> SuggestionServiceBase = suggestionServiceBase;
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
PdbSourceDocument\PdbSourceDocumentLoaderServiceTests.cs (2)
38var sourceLinkService = new Lazy<ISourceLinkService>(() => new TestSourceLinkService(sourceFilePath: sourceFilePath)); 69var sourceLinkService = new Lazy<ISourceLinkService>(() => new TestSourceLinkService(sourceFilePath: sourceFilePath));
Microsoft.CodeAnalysis.CSharp.Features (4)
ExternalAccess\Pythia\PythiaDeclarationNameRecommender.cs (2)
22internal sealed class PythiaDeclarationNameRecommender([Import(AllowDefault = true)] Lazy<IPythiaDeclarationNameRecommenderImplementation>? implementation) : IDeclarationNameRecommender 24private readonly Lazy<IPythiaDeclarationNameRecommenderImplementation>? _lazyImplementation = implementation;
ExternalAccess\Pythia\PythiaSignatureHelpProvider.cs (2)
26internal sealed class PythiaSignatureHelpProvider(Lazy<IPythiaSignatureHelpProviderImplementation> implementation) : InvocationExpressionSignatureHelpProviderBase 28private readonly Lazy<IPythiaSignatureHelpProviderImplementation> _lazyImplementation = implementation;
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (1)
InteractiveSessionReferencesTests.cs (1)
238private static readonly Lazy<bool> s_isSystemV2AndV4Available = new Lazy<bool>(() =>
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
ObjectFormatterTests.cs (1)
754var obj = new Lazy<int[]>(() => new int[] { 1, 2 }, LazyThreadSafetyMode.None);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (7)
DeclarationTests.cs (7)
195private Lazy<RootSingleNamespaceDeclaration> Lazy(RootSingleNamespaceDeclaration decl) 234var decl1 = Lazy(DeclarationTreeBuilder.ForTree(tree1, TestOptions.DebugExe.ScriptClassName, isSubmission: false)); 235var decl2 = Lazy(DeclarationTreeBuilder.ForTree(tree2, TestOptions.DebugExe.ScriptClassName, isSubmission: false)); 304var decl1 = Lazy(DeclarationTreeBuilder.ForTree(tree1, TestOptions.DebugExe.ScriptClassName, isSubmission: false)); 305var decl2 = Lazy(DeclarationTreeBuilder.ForTree(tree2, TestOptions.DebugExe.ScriptClassName, isSubmission: false)); 355var decl1 = Lazy(DeclarationTreeBuilder.ForTree(tree1, TestOptions.DebugExe.ScriptClassName, isSubmission: false)); 356var decl2 = Lazy(DeclarationTreeBuilder.ForTree(tree2, TestOptions.DebugExe.ScriptClassName, isSubmission: false));
Microsoft.CodeAnalysis.EditorFeatures (32)
Copilot\CopilotWpfTextCreationListener.cs (2)
34private readonly Lazy<SuggestionServiceBase> _suggestionServiceBase; 46Lazy<SuggestionServiceBase> suggestionServiceBase,
EditAndContinue\EditAndContinueLanguageService.cs (2)
32Lazy<IHostWorkspaceProvider> workspaceProvider, 33Lazy<IManagedHotReloadService> debuggerService,
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (3)
112private static readonly Lazy<NamingRuleComparerIgnoreGUIDs> s_lazyInstance = new(() => new NamingRuleComparerIgnoreGUIDs()); 133private static readonly Lazy<NamingStyleComparerIgnoreGUIDs> s_lazyInstance = new(() => new NamingStyleComparerIgnoreGUIDs()); 158private static readonly Lazy<SymbolSpecificationComparerIgnoreGUIDs> s_lazyInstance = new(() => new SymbolSpecificationComparerIgnoreGUIDs());
ExternalAccess\VSTypeScript\VSTypeScriptEditorInlineRenameService.cs (2)
22[Import(AllowDefault = true)] Lazy<VSTypeScriptEditorInlineRenameServiceImplementation>? service) : IEditorInlineRenameService 24private readonly Lazy<VSTypeScriptEditorInlineRenameServiceImplementation>? _service = service;
InlineHints\InlineHintsTaggerProvider.cs (2)
42Lazy<IStreamingFindUsagesPresenter> streamingFindUsagesPresenter, 55public readonly Lazy<IStreamingFindUsagesPresenter> StreamingFindUsagesPresenter = streamingFindUsagesPresenter;
InlineRename\UI\Adornment\RenameFlyoutViewModel.cs (1)
50Lazy<ISmartRenameSessionFactory>? smartRenameSessionFactory)
InlineRename\UI\InlineRenameAdornmentManager.cs (2)
30private readonly Lazy<ISmartRenameSessionFactory>? _smartRenameSessionFactory; 47Lazy<ISmartRenameSessionFactory>? smartRenameSessionFactory)
InlineRename\UI\InlineRenameAdornmentProvider.cs (2)
37private readonly Lazy<ISmartRenameSessionFactory>? _smartRenameSessionFactory; 64[Import(AllowDefault = true)] Lazy<ISmartRenameSessionFactory>? smartRenameSessionFactory)
InlineRename\UI\SmartRename\SmartRenameUserInputComboBox.xaml.cs (1)
24private readonly Lazy<TextBox> _innerTextBox;
IntelliSense\AsyncCompletion\CompletionSource.cs (2)
62private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter; 71Lazy<IStreamingFindUsagesPresenter> streamingPresenter,
IntelliSense\AsyncCompletion\CompletionSourceProvider.cs (2)
28Lazy<IStreamingFindUsagesPresenter> streamingPresenter, 33private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter = streamingPresenter;
IntelliSense\NavigationActionFactory.cs (1)
26Lazy<IStreamingFindUsagesPresenter> streamingPresenter) : INavigationActionFactory
IntelliSense\QuickInfo\QuickInfoSourceProvider.cs (2)
30Lazy<IStreamingFindUsagesPresenter> streamingPresenter, 36private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter = streamingPresenter;
IntelliSense\QuickInfo\QuickInfoSourceProvider.QuickInfoSource.cs (2)
36Lazy<IStreamingFindUsagesPresenter> streamingPresenter, 44private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter = streamingPresenter;
Interactive\CommandHandlers\ExecuteInInteractiveCommandHandler.cs (1)
40private Lazy<IExecuteInInteractiveCommandHandler> GetCommandHandler(ITextBuffer textBuffer)
LanguageServer\AlwaysActiveLanguageClientEventListener.cs (2)
28Lazy<ILanguageClientBroker> languageClientBroker, 32private readonly Lazy<ILanguageClientBroker> _languageClientBroker = languageClientBroker;
NavigateTo\DefaultNavigateToPreviewServiceFactory.cs (1)
17private readonly Lazy<INavigateToPreviewService> _singleton =
QuickInfo\Extensions.cs (2)
23foreach (var cloneService in cloneServices) 39foreach (var cloneService in cloneServices)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Diagnostics\SuppressMessageAttributeWorkspaceTests.cs (1)
26private static readonly Lazy<MetadataReference> _unconditionalSuppressMessageRef = new(() =>
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
ExpressionCompiler.cs (1)
341Lazy<ImmutableArray<AssemblyReaders>> lazyAssemblyReaders,
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
Debugger\Engine\DkmClrType.cs (1)
38private readonly System.Lazy<ReadOnlyCollection<DkmClrEvalAttribute>> _lazyEvalAttributes;
Microsoft.CodeAnalysis.Extensions.Package (1)
Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
Microsoft.CodeAnalysis.ExternalAccess.Debugger (2)
DebuggerFindReferencesService.cs (2)
23Lazy<IStreamingFindUsagesPresenter> streamingPresenter) 25private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter = streamingPresenter;
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (8)
Cohost\RazorConfigurationChangedServiceFactory.cs (2)
19[Import(AllowDefault = true)] Lazy<ICohostConfigurationChangedService>? cohostConfigurationChangedService) : ILspServiceFactory 27Lazy<ICohostConfigurationChangedService>? cohostConfigurationChangedService) : ILspService, IOnConfigurationChanged
Cohost\RazorStartupServiceFactory.cs (2)
25[Import(AllowDefault = true)] Lazy<ICohostStartupService>? cohostStartupService) : ILspServiceFactory 34Lazy<ICohostStartupService>? cohostStartupService) : ILspService, IOnInitialized, IDisposable
RazorAnalyzerAssemblyRedirector.cs (1)
15internal sealed class RazorAnalyzerAssemblyRedirector([Import(AllowDefault = true)] Lazy<RazorAnalyzerAssemblyRedirector.IRazorAnalyzerAssemblyRedirector>? razorRedirector) : IAnalyzerAssemblyRedirector
RazorMiscellaneousProjectInfoService.cs (1)
19internal sealed class RazorMiscellaneousProjectInfoService([Import(AllowDefault = true)] Lazy<IRazorSourceGeneratorLocator>? razorSourceGeneratorLocator) : IMiscellaneousProjectInfoService
RazorRefactorNotifyWrapper.cs (2)
17[Import(AllowDefault = true)] Lazy<IRazorRefactorNotifyService>? implementation) : IRefactorNotifyService 19private readonly Lazy<IRazorRefactorNotifyService>? _implementation = implementation;
Microsoft.CodeAnalysis.Features (51)
CodeFixes\Service\CodeFixService.cs (24)
43private readonly Lazy<ImmutableDictionary<string, ImmutableArray<Lazy<CodeFixProvider, CodeChangeProviderMetadata>>>> _fixersPerLanguageMap; 48private readonly Lazy<ImmutableDictionary<LanguageKind, Lazy<ImmutableArray<IConfigurationFixProvider>>>> _configurationProvidersMap; 49private readonly ImmutableArray<Lazy<IErrorLoggerService>> _errorLoggers; 51private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>>? _lazyWorkspaceFixersMap; 52private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>>? _lazyFixerPriorityMap; 61[ImportMany] IEnumerable<Lazy<IErrorLoggerService>> loggers, 367if (!_lazyWorkspaceFixersMap.TryGetValue(document.Project.Language, out var lazyFixerMap)) 382private bool TryGetWorkspaceFixersPriorityMap(TextDocument document, [NotNullWhen(true)] out Lazy<ImmutableDictionary<CodeFixProvider, int>>? fixersPriorityMap) 424foreach (var errorLogger in _errorLoggers) 494if (TryGetWorkspaceFixersPriorityMap(document, out var fixersForLanguage)) 745if (!_configurationProvidersMap.Value.TryGetValue(document.Project.Language, out var lazyConfigurationProviders) || 839if (!_configurationProvidersMap.Value.TryGetValue(language, out var lazyConfigurationProviders) || 880foreach (var logger in _errorLoggers) 903private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>> GetFixerPerLanguageMap( 906var fixerMap = ImmutableDictionary.Create<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>>(); 910var lazyMap = new Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>(() => 941private static ImmutableDictionary<LanguageKind, Lazy<ImmutableArray<IConfigurationFixProvider>>> GetConfigurationProvidersPerLanguageMap( 946var configurationFixerMap = ImmutableDictionary.CreateBuilder<LanguageKind, Lazy<ImmutableArray<IConfigurationFixProvider>>>(); 949var lazyConfigurationFixers = new Lazy<ImmutableArray<IConfigurationFixProvider>>(() => GetConfigurationFixProviders(lazyFixers)); 966private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>> GetFixerPriorityPerLanguageMap(SolutionServices services) 968var languageMap = ImmutableDictionary.CreateBuilder<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>>(); 971var lazyMap = new Lazy<ImmutableDictionary<CodeFixProvider, int>>(() => 1073public ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>> GetFixerPriorityPerLanguageMap(SolutionServices services)
CodeRefactorings\CodeRefactoringService.cs (5)
33private readonly Lazy<ImmutableDictionary<ProviderKey, Lazy<ImmutableArray<CodeRefactoringProvider>>>> _lazyLanguageDocumentToProvidersMap = 41private readonly Lazy<ImmutableDictionary<CodeRefactoringProvider, CodeChangeProviderMetadata>> _lazyRefactoringToMetadataMap = new(() => providers.Where(provider => provider.IsValueCreated).ToImmutableDictionary(provider => provider.Value, provider => provider.Metadata)); 74private ImmutableDictionary<ProviderKey, Lazy<ImmutableArray<CodeRefactoringProvider>>> LanguageDocumentToProvidersMap 86if (LanguageDocumentToProvidersMap.TryGetValue(key, out var lazyProviders))
Completion\CompletionList.cs (1)
19private readonly Lazy<ImmutableArray<CompletionItem>> _lazyItems;
Completion\CompletionService.ProviderManager.cs (1)
29private readonly Lazy<ImmutableDictionary<string, CompletionProvider>> _nameToProvider;
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (1)
121var editorBrowsableInfo = new Lazy<EditorBrowsableInfo>(() => new EditorBrowsableInfo(originCompilation));
Completion\Providers\Scripting\GlobalAssemblyCacheCompletionHelper.cs (1)
18private static readonly Lazy<List<string>> s_lazyAssemblySimpleNames =
Completion\SharedSyntaxContextsWithSpeculativeModel.cs (1)
21private readonly Lazy<ImmutableArray<DocumentId>> _lazyRelatedDocumentIds;
EditAndContinue\EditAndContinueDebugInfoReader.cs (1)
125private readonly Lazy<Encoding?> _lazyDefaultSourceFileEncoding;
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs (2)
26private Lazy<ImmutableArray<IUnitTestingIncrementalAnalyzer>> _lazyAnalyzers; 31Lazy<ImmutableArray<IUnitTestingIncrementalAnalyzer>> lazyAnalyzers,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs (1)
57var lazyAllAnalyzers = new Lazy<ImmutableArray<IUnitTestingIncrementalAnalyzer>>(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: false));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs (1)
30Lazy<ImmutableArray<IUnitTestingIncrementalAnalyzer>> lazyAnalyzers,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (1)
46Lazy<ImmutableArray<IUnitTestingIncrementalAnalyzer>> lazyAnalyzers,
Intents\IntentDataProvider.cs (1)
15private static readonly Lazy<JsonSerializerOptions> s_serializerOptions = new(() =>
LegacySolutionEvents\ILegacySolutionEventsAggregationService.cs (4)
32[ImportMany] IEnumerable<Lazy<ILegacySolutionEventsListener>> eventsServices) : ILegacySolutionEventsAggregationService 34private readonly ImmutableArray<Lazy<ILegacySolutionEventsListener>> _eventsServices = [.. eventsServices]; 38foreach (var service in _eventsServices) 49foreach (var service in _eventsServices)
MetadataAsSource\MetadataAsSourceFileService.cs (1)
34private readonly Lazy<ImmutableArray<Lazy<IMetadataAsSourceFileProvider, MetadataAsSourceFileProviderMetadata>>> _providers;
NavigateTo\RoslynNavigateToItem.cs (1)
107private readonly Lazy<string> _secondarySort;
PdbSourceDocument\PdbSourceDocumentLoaderService.cs (2)
25[Import(AllowDefault = true)] Lazy<ISourceLinkService>? sourceLinkService, 35private readonly Lazy<ISourceLinkService>? _sourceLinkService = sourceLinkService;
SemanticSearch\SemanticSearchDocumentSupportsFeatureService.cs (1)
16[Import(AllowDefault = true)] Lazy<ISemanticSearchSolutionService>? solutionService) : IDocumentSupportsFeatureService
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
36private readonly Lazy<ImmutableHashSet<int>> _lazySupportedCompilerErrorCodes;
Microsoft.CodeAnalysis.LanguageServer (6)
DotnetCliHelper.cs (1)
20private readonly Lazy<string> _dotnetExecutablePath;
FileBasedPrograms\CanonicalMiscFilesProjectLoader.cs (1)
26private readonly Lazy<string> _canonicalDocumentPath;
HostWorkspace\FileWatching\DelegatingFileChangeWatcher.cs (1)
32private readonly Lazy<IFileChangeWatcher> _underlyingFileWatcher = new(() =>
HostWorkspace\LoadedProject.cs (1)
38private Lazy<ImmutableArray<Matcher>>? _mostRecentFileMatchers;
HostWorkspace\Razor\RazorInitializer.cs (1)
18internal sealed class RazorInitializer(Lazy<LanguageServerWorkspaceFactory> workspaceFactory, [Import(AllowDefault = true)] ITelemetryReporter? telemetryReporter) : ILspService, IOnInitialized
Logging\LspLogMessageLogger.cs (1)
18private readonly Lazy<ILogger> _fallbackLogger = new(() => fallbackLoggerFactory.CreateLogger(categoryName));
Microsoft.CodeAnalysis.LanguageServer.Protocol (17)
LspServices\AbstractExportLspServiceAttribute.cs (1)
48private readonly Lazy<string?[]>? _lazyMethodHandlerData;
RoslynLanguageServer.cs (1)
26private static readonly Lazy<int> s_currentProcessId = new(static () => { using var process = Process.GetCurrentProcess(); return process.Id; });
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\AbstractLanguageServer.cs (3)
30private readonly Lazy<IRequestExecutionQueue<TRequestContext>> _queue; 31private readonly Lazy<ILspServices> _lspServices; 32private readonly Lazy<AbstractHandlerProvider> _handlerProvider;
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\HandlerProvider.cs (7)
21private FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>>? _requestHandlers; 31if (!requestHandlers.TryGetValue(requestHandlerMetadata, out var lazyHandler)) 45private FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>> GetRequestHandlers() 48private static FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>> CreateMethodToHandlerMap(ILspServices lspServices, AbstractTypeRefResolver typeRefResolver) 50var builder = new Dictionary<RequestHandlerMetadata, Lazy<IMethodHandler>>(); 98static Lazy<IMethodHandler> GetLazyHandlerFromInstance(IMethodHandler instance) 103static Lazy<IMethodHandler> GetLazyHandlerFromTypeRef(ILspServices lspServices, AbstractTypeRefResolver typeRefResolver, TypeRef handlerTypeRef)
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\RequestExecutionQueue.cs (5)
76private readonly FrozenDictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata Metadata, IMethodHandler Handler, MethodInfo MethodInfo)>>> _handlerInfoMap; 94private static FrozenDictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>> BuildHandlerMap(AbstractHandlerProvider handlerProvider, AbstractTypeRefResolver typeRefResolver) 96var genericMethodMap = new Dictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>>(); 103var languages = new Dictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>(); 419if (handlersForMethod.TryGetValue(language, out var lazyData) ||
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Workspaces\LspWorkspaceManagerTests.cs (1)
294var workspaceRegistrationService = exportProvider.GetExport<LspWorkspaceRegistrationService>();
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (16)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\IMefHostExportProvider.cs (1)
13IEnumerable<Lazy<TExtension>> GetExports<TExtension>();
Microsoft.CodeAnalysis.PublicApiAnalyzers (16)
DeclarePublicApiAnalyzer.Impl.cs (1)
85private readonly Lazy<IReadOnlyDictionary<string, ApiLine>> _apiMap;
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Host\RemoteWorkspaceManager.cs (1)
48private static readonly Lazy<RemoteWorkspaceManager> s_default = new(static () =>
Microsoft.CodeAnalysis.Remote.Workspaces (2)
VisualStudioMefHostServices.cs (2)
61public IEnumerable<Lazy<TExtension>> GetExports<TExtension>() 70return (IEnumerable<Lazy<TExtension>>)exports;
Microsoft.CodeAnalysis.ResxSourceGenerator (15)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
Microsoft.CodeAnalysis.SemanticSearch.Extensions (1)
ProjectModel.cs (1)
23private readonly Lazy<ImmutableDictionary<string, ResxFile>> _lazyResxFiles;
Microsoft.CodeAnalysis.Test.Utilities (180)
Assert\ConditionalFactAttribute.cs (1)
171private static readonly Lazy<bool> s_operatingSystemRestrictsFileNames = new Lazy<bool>(() =>
Assert\UseCultureAttribute.cs (2)
29private readonly Lazy<CultureInfo> _culture; 30private readonly Lazy<CultureInfo> _uiCulture;
Mocks\Silverlight.cs (1)
29private static readonly Lazy<(byte[], byte[])> s_tuple = new Lazy<(byte[], byte[])>(
Mocks\TestReferences.cs (147)
21private static readonly Lazy<PortableExecutableReference> s_appCS = new Lazy<PortableExecutableReference>( 26private static readonly Lazy<PortableExecutableReference> s_moduleCS00 = new Lazy<PortableExecutableReference>( 31private static readonly Lazy<PortableExecutableReference> s_moduleCS01 = new Lazy<PortableExecutableReference>( 36private static readonly Lazy<PortableExecutableReference> s_moduleVB01 = new Lazy<PortableExecutableReference>( 44private static readonly Lazy<PortableExecutableReference> s_CSClasses01 = new Lazy<PortableExecutableReference>( 49private static readonly Lazy<PortableExecutableReference> s_CSInterfaces01 = new Lazy<PortableExecutableReference>( 54private static readonly Lazy<PortableExecutableReference> s_VBClasses01 = new Lazy<PortableExecutableReference>( 59private static readonly Lazy<PortableExecutableReference> s_VBClasses02 = new Lazy<PortableExecutableReference>( 64private static readonly Lazy<PortableExecutableReference> s_VBInterfaces01 = new Lazy<PortableExecutableReference>( 75private static readonly Lazy<PortableExecutableReference> s_mincorlib = new Lazy<PortableExecutableReference>( 80private static readonly Lazy<PortableExecutableReference> s_minasync = new Lazy<PortableExecutableReference>( 85private static readonly Lazy<PortableExecutableReference> s_minasynccorlib = new Lazy<PortableExecutableReference>( 93private static readonly Lazy<PortableExecutableReference> s_tuplelib = new Lazy<PortableExecutableReference>( 101private static readonly Lazy<PortableExecutableReference> s_system = new Lazy<PortableExecutableReference>( 112private static readonly Lazy<PortableExecutableReference> s_errTestLib01 = new Lazy<PortableExecutableReference>( 120private static readonly Lazy<PortableExecutableReference> s_errTestLib02 = new Lazy<PortableExecutableReference>( 128private static readonly Lazy<PortableExecutableReference> s_errTestLib11 = new Lazy<PortableExecutableReference>( 136private static readonly Lazy<PortableExecutableReference> s_errTestMod01 = new Lazy<PortableExecutableReference>( 144private static readonly Lazy<PortableExecutableReference> s_errTestMod02 = new Lazy<PortableExecutableReference>( 152private static readonly Lazy<PortableExecutableReference> s_badresfile = new Lazy<PortableExecutableReference>( 161private static readonly Lazy<PortableExecutableReference> s_mdTestLib1 = new Lazy<PortableExecutableReference>( 166private static readonly Lazy<PortableExecutableReference> s_mdTestLib2 = new Lazy<PortableExecutableReference>( 171private static readonly Lazy<PortableExecutableReference> s_VBConversions = new Lazy<PortableExecutableReference>( 176private static readonly Lazy<PortableExecutableReference> s_withSpaces = new Lazy<PortableExecutableReference>( 181private static readonly Lazy<PortableExecutableReference> s_withSpacesModule = new Lazy<PortableExecutableReference>( 186private static readonly Lazy<PortableExecutableReference> s_inheritIComparable = new Lazy<PortableExecutableReference>( 191private static readonly Lazy<PortableExecutableReference> s_bigVisitor = new Lazy<PortableExecutableReference>( 196private static readonly Lazy<PortableExecutableReference> s_properties = new Lazy<PortableExecutableReference>( 201private static readonly Lazy<PortableExecutableReference> s_propertiesWithByRef = new Lazy<PortableExecutableReference>( 206private static readonly Lazy<PortableExecutableReference> s_indexers = new Lazy<PortableExecutableReference>( 211private static readonly Lazy<PortableExecutableReference> s_events = new Lazy<PortableExecutableReference>( 218private static readonly Lazy<PortableExecutableReference> s_netModule1 = new Lazy<PortableExecutableReference>( 223private static readonly Lazy<PortableExecutableReference> s_netModule2 = new Lazy<PortableExecutableReference>( 228private static readonly Lazy<PortableExecutableReference> s_crossRefModule1 = new Lazy<PortableExecutableReference>( 233private static readonly Lazy<PortableExecutableReference> s_crossRefModule2 = new Lazy<PortableExecutableReference>( 238private static readonly Lazy<PortableExecutableReference> s_crossRefLib = new Lazy<PortableExecutableReference>( 246private static readonly Lazy<PortableExecutableReference> s_hash_module = new Lazy<PortableExecutableReference>( 251private static readonly Lazy<PortableExecutableReference> s_x64COFF = new Lazy<PortableExecutableReference>( 261private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 269private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 277private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib2 = new Lazy<PortableExecutableReference>( 285private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 296private static readonly Lazy<PortableExecutableReference> s_v2MTTestLib1 = new Lazy<PortableExecutableReference>( 304private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 312private static readonly Lazy<PortableExecutableReference> s_v2MTTestLib3 = new Lazy<PortableExecutableReference>( 320private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 331private static readonly Lazy<PortableExecutableReference> s_v3MTTestLib1 = new Lazy<PortableExecutableReference>( 339private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 347private static readonly Lazy<PortableExecutableReference> s_v3MTTestLib4 = new Lazy<PortableExecutableReference>( 355private static readonly Lazy<PortableExecutableReference> s_v1MTTestLib1 = new Lazy<PortableExecutableReference>( 364private static readonly Lazy<PortableExecutableReference> s_assembly = new Lazy<PortableExecutableReference>( 372private static readonly Lazy<PortableExecutableReference> s_mod2 = new Lazy<PortableExecutableReference>( 377private static readonly Lazy<PortableExecutableReference> s_mod3 = new Lazy<PortableExecutableReference>( 382private static readonly Lazy<PortableExecutableReference> s_consumer = new Lazy<PortableExecutableReference>( 390private static readonly Lazy<PortableExecutableReference> s_typeAndNamespaceDifferByCase = new Lazy<PortableExecutableReference>( 395private static readonly Lazy<PortableExecutableReference> s_differByCaseConsumer = new Lazy<PortableExecutableReference>( 400private static readonly Lazy<PortableExecutableReference> s_csharpCaseSen = new Lazy<PortableExecutableReference>( 405private static readonly Lazy<PortableExecutableReference> s_csharpDifferCaseOverloads = new Lazy<PortableExecutableReference>( 415private static readonly Lazy<PortableExecutableReference> s_exe = new Lazy<PortableExecutableReference>( 421private static readonly Lazy<PortableExecutableReference> s_noMsCorLibRef = new Lazy<PortableExecutableReference>( 428private static readonly Lazy<PortableExecutableReference> s_dll = new Lazy<PortableExecutableReference>( 439private static readonly Lazy<PortableExecutableReference> s_dll = new Lazy<PortableExecutableReference>( 444private static readonly Lazy<PortableExecutableReference> s_module = new Lazy<PortableExecutableReference>( 450private static readonly Lazy<PortableExecutableReference> s_modoptTests = new Lazy<PortableExecutableReference>( 457private static readonly Lazy<PortableExecutableReference> s_dll = new Lazy<PortableExecutableReference>( 465private static readonly Lazy<PortableExecutableReference> s_dll = new Lazy<PortableExecutableReference>( 476private static readonly Lazy<PortableExecutableReference> s_cyclic1 = new Lazy<PortableExecutableReference>( 484private static readonly Lazy<PortableExecutableReference> s_cyclic2 = new Lazy<PortableExecutableReference>( 493private static readonly Lazy<PortableExecutableReference> s_class1 = new Lazy<PortableExecutableReference>( 498private static readonly Lazy<PortableExecutableReference> s_class2 = new Lazy<PortableExecutableReference>( 503private static readonly Lazy<PortableExecutableReference> s_class3 = new Lazy<PortableExecutableReference>( 509private static readonly Lazy<PortableExecutableReference> s_cycledStructs = new Lazy<PortableExecutableReference>( 520private static readonly Lazy<PortableExecutableReference> s_classA = new Lazy<PortableExecutableReference>( 528private static readonly Lazy<PortableExecutableReference> s_classB = new Lazy<PortableExecutableReference>( 539private static readonly Lazy<PortableExecutableReference> s_classA = new Lazy<PortableExecutableReference>( 547private static readonly Lazy<PortableExecutableReference> s_classB = new Lazy<PortableExecutableReference>( 557private static readonly Lazy<PortableExecutableReference> s_CSMethods = new Lazy<PortableExecutableReference>( 562private static readonly Lazy<PortableExecutableReference> s_VBMethods = new Lazy<PortableExecutableReference>( 567private static readonly Lazy<PortableExecutableReference> s_ILMethods = new Lazy<PortableExecutableReference>( 572private static readonly Lazy<PortableExecutableReference> s_byRefReturn = new Lazy<PortableExecutableReference>( 582private static readonly Lazy<PortableExecutableReference> s_CSFields = new Lazy<PortableExecutableReference>( 590private static readonly Lazy<PortableExecutableReference> s_VBFields = new Lazy<PortableExecutableReference>( 596private static readonly Lazy<PortableExecutableReference> s_constantFields = new Lazy<PortableExecutableReference>( 604private static readonly Lazy<PortableExecutableReference> s_MDMissingType = new Lazy<PortableExecutableReference>( 609private static readonly Lazy<PortableExecutableReference> s_MDMissingTypeLib = new Lazy<PortableExecutableReference>( 614private static readonly Lazy<PortableExecutableReference> s_missingTypesEquality1 = new Lazy<PortableExecutableReference>( 619private static readonly Lazy<PortableExecutableReference> s_missingTypesEquality2 = new Lazy<PortableExecutableReference>( 624private static readonly Lazy<PortableExecutableReference> s_CL2 = new Lazy<PortableExecutableReference>( 629private static readonly Lazy<PortableExecutableReference> s_CL3 = new Lazy<PortableExecutableReference>( 639private static readonly Lazy<PortableExecutableReference> s_typeForwarder2 = new Lazy<PortableExecutableReference>( 647private static readonly Lazy<PortableExecutableReference> s_typeForwarderLib2 = new Lazy<PortableExecutableReference>( 655private static readonly Lazy<PortableExecutableReference> s_typeForwarderBase2 = new Lazy<PortableExecutableReference>( 664private static readonly Lazy<PortableExecutableReference> s_source1Module = new Lazy<PortableExecutableReference>( 669private static readonly Lazy<PortableExecutableReference> s_source3Module = new Lazy<PortableExecutableReference>( 674private static readonly Lazy<PortableExecutableReference> s_source4Module = new Lazy<PortableExecutableReference>( 679private static readonly Lazy<PortableExecutableReference> s_source5Module = new Lazy<PortableExecutableReference>( 684private static readonly Lazy<PortableExecutableReference> s_source7Module = new Lazy<PortableExecutableReference>( 692private static readonly Lazy<PortableExecutableReference> s_stdOleNetFramework = new Lazy<PortableExecutableReference>( 696private static readonly Lazy<PortableExecutableReference> s_stdOleNet40 = new Lazy<PortableExecutableReference>( 700private static readonly Lazy<PortableExecutableReference> s_pia1 = new Lazy<PortableExecutableReference>( 705private static readonly Lazy<PortableExecutableReference> s_pia1Copy = new Lazy<PortableExecutableReference>( 710private static readonly Lazy<PortableExecutableReference> s_pia2 = new Lazy<PortableExecutableReference>( 715private static readonly Lazy<PortableExecutableReference> s_pia3 = new Lazy<PortableExecutableReference>( 720private static readonly Lazy<PortableExecutableReference> s_pia4 = new Lazy<PortableExecutableReference>( 725private static readonly Lazy<PortableExecutableReference> s_pia5 = new Lazy<PortableExecutableReference>( 730private static readonly Lazy<PortableExecutableReference> s_generalPia = new Lazy<PortableExecutableReference>( 735private static readonly Lazy<PortableExecutableReference> s_generalPiaCopy = new Lazy<PortableExecutableReference>( 740private static readonly Lazy<PortableExecutableReference> s_noPIAGenericsAsm1 = new Lazy<PortableExecutableReference>( 745private static readonly Lazy<PortableExecutableReference> s_externalAsm1 = new Lazy<PortableExecutableReference>( 750private static readonly Lazy<PortableExecutableReference> s_library1 = new Lazy<PortableExecutableReference>( 755private static readonly Lazy<PortableExecutableReference> s_library2 = new Lazy<PortableExecutableReference>( 760private static readonly Lazy<PortableExecutableReference> s_localTypes1 = new Lazy<PortableExecutableReference>( 765private static readonly Lazy<PortableExecutableReference> s_localTypes2 = new Lazy<PortableExecutableReference>( 770private static readonly Lazy<PortableExecutableReference> s_localTypes3 = new Lazy<PortableExecutableReference>( 775private static readonly Lazy<PortableExecutableReference> s_A = new Lazy<PortableExecutableReference>( 780private static readonly Lazy<PortableExecutableReference> s_B = new Lazy<PortableExecutableReference>( 785private static readonly Lazy<PortableExecutableReference> s_C = new Lazy<PortableExecutableReference>( 790private static readonly Lazy<PortableExecutableReference> s_D = new Lazy<PortableExecutableReference>( 799private static readonly Lazy<PortableExecutableReference> s_missingPIAAttributes = new Lazy<PortableExecutableReference>( 809private static readonly Lazy<PortableExecutableReference> s_staticMethodInInterface = new Lazy<PortableExecutableReference>( 814private static readonly Lazy<PortableExecutableReference> s_MDInterfaceMapping = new Lazy<PortableExecutableReference>( 822private static readonly Lazy<PortableExecutableReference> s_MDTestLib1 = new Lazy<PortableExecutableReference>( 827private static readonly Lazy<PortableExecutableReference> s_netModule1 = new Lazy<PortableExecutableReference>( 837private static readonly Lazy<PortableExecutableReference> s_CSharp = new Lazy<PortableExecutableReference>( 842private static readonly Lazy<PortableExecutableReference> s_IL = new Lazy<PortableExecutableReference>( 850private static readonly Lazy<PortableExecutableReference> s_CSharp = new Lazy<PortableExecutableReference>( 855private static readonly Lazy<PortableExecutableReference> s_IL = new Lazy<PortableExecutableReference>( 863private static readonly Lazy<PortableExecutableReference> s_CSharp = new Lazy<PortableExecutableReference>( 870private static readonly Lazy<PortableExecutableReference> s_regress40025 = new Lazy<PortableExecutableReference>( 877private static readonly Lazy<PortableExecutableReference> s_simpleWithEvents = new Lazy<PortableExecutableReference>( 885private static readonly Lazy<PortableExecutableReference> s_delegatesWithoutInvoke = new Lazy<PortableExecutableReference>( 890private static readonly Lazy<PortableExecutableReference> s_delegateByRefParamArray = new Lazy<PortableExecutableReference>( 898private static readonly Lazy<PortableExecutableReference> s_invalidCharactersInAssemblyName2 = new Lazy<PortableExecutableReference>( 903private static readonly Lazy<PortableExecutableReference> s_MDTestAttributeDefLib = new Lazy<PortableExecutableReference>( 908private static readonly Lazy<PortableExecutableReference> s_MDTestAttributeApplicationLib = new Lazy<PortableExecutableReference>( 913private static readonly Lazy<PortableExecutableReference> s_attributeInterop01 = new Lazy<PortableExecutableReference>( 918private static readonly Lazy<PortableExecutableReference> s_attributeInterop02 = new Lazy<PortableExecutableReference>( 923private static readonly Lazy<PortableExecutableReference> s_attributeTestLib01 = new Lazy<PortableExecutableReference>( 928private static readonly Lazy<PortableExecutableReference> s_attributeTestDef01 = new Lazy<PortableExecutableReference>( 933private static readonly Lazy<PortableExecutableReference> s_dynamicAttributeLib = new Lazy<PortableExecutableReference>( 941private static readonly Lazy<PortableExecutableReference> s_unavailable = new Lazy<PortableExecutableReference>( 946private static readonly Lazy<PortableExecutableReference> s_CSharp = new Lazy<PortableExecutableReference>( 951private static readonly Lazy<PortableExecutableReference> s_IL = new Lazy<PortableExecutableReference>( 959private static readonly Lazy<PortableExecutableReference> s_AR_SA = new Lazy<PortableExecutableReference>( 964private static readonly Lazy<PortableExecutableReference> s_EN_US = new Lazy<PortableExecutableReference>( 969private static readonly Lazy<PortableExecutableReference> s_C1 = new Lazy<PortableExecutableReference>( 974private static readonly Lazy<PortableExecutableReference> s_C2 = new Lazy<PortableExecutableReference>(
TestBase.cs (29)
78private static readonly Lazy<MetadataReference[]> s_lazyDefaultVbReferences = new Lazy<MetadataReference[]>( 83private static readonly Lazy<MetadataReference[]> s_lazyLatestVbReferences = new Lazy<MetadataReference[]>( 96private static readonly Lazy<MetadataReference[]> s_winRtRefs = new Lazy<MetadataReference[]>( 129private static readonly Lazy<MetadataReference[]> s_portableRefsMinimal = new Lazy<MetadataReference[]>( 144private static readonly Lazy<MetadataReference> s_systemCoreRef = 150private static readonly Lazy<MetadataReference> s_systemCoreRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 155private static readonly Lazy<MetadataReference> s_systemRuntimeSerializationRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 160private static readonly Lazy<MetadataReference> s_systemCoreRef_v46 = new Lazy<MetadataReference>( 165private static readonly Lazy<MetadataReference> s_systemWindowsFormsRef = new Lazy<MetadataReference>( 170private static readonly Lazy<MetadataReference> s_systemDrawingRef = new Lazy<MetadataReference>( 175private static readonly Lazy<MetadataReference> s_systemDataRef = new Lazy<MetadataReference>( 180private static readonly Lazy<MetadataReference> s_mscorlibRef = new Lazy<MetadataReference>( 185private static readonly Lazy<MetadataReference> s_aacorlibRef = new Lazy<MetadataReference>( 212private static readonly Lazy<MetadataReference> s_mscorlibRef_v46 = new Lazy<MetadataReference>( 242private static readonly Lazy<MetadataReference> s_desktopCSharpRef = new Lazy<MetadataReference>( 247private static readonly Lazy<MetadataReference> s_std20Ref = new Lazy<MetadataReference>( 253private static readonly Lazy<MetadataReference> s_systemRef = new Lazy<MetadataReference>( 258private static readonly Lazy<MetadataReference> s_systemRef_v46 = new Lazy<MetadataReference>( 263private static readonly Lazy<MetadataReference> s_systemRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 268private static readonly Lazy<MetadataReference> s_systemRef_v20 = new Lazy<MetadataReference>( 273private static readonly Lazy<MetadataReference> s_systemXmlRef = new Lazy<MetadataReference>( 278private static readonly Lazy<MetadataReference> s_systemXmlLinqRef = new Lazy<MetadataReference>( 283private static readonly Lazy<MetadataReference> s_mscorlibFacadeRef = new Lazy<MetadataReference>( 288private static readonly Lazy<MetadataReference> s_systemRuntimeFacadeRef = new Lazy<MetadataReference>( 293private static readonly Lazy<MetadataReference> s_systemThreadingFacadeRef = new Lazy<MetadataReference>( 298private static readonly Lazy<MetadataReference> s_systemThreadingTasksFacadeRef = new Lazy<MetadataReference>( 303private static readonly Lazy<MetadataReference> s_mscorlibPP7Ref = new Lazy<MetadataReference>( 308private static readonly Lazy<MetadataReference> s_systemRuntimePP7Ref = new Lazy<MetadataReference>( 313private static readonly Lazy<MetadataReference> s_FSharpTestLibraryRef = new Lazy<MetadataReference>(
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\SuppressMessageAttributeCompilerTests.cs (1)
37private static readonly Lazy<ImmutableArray<MetadataReference>> s_references = new Lazy<ImmutableArray<MetadataReference>>(() =>
Microsoft.CodeAnalysis.Workspaces (32)
Diagnostics\DocumentAnalysisScope.cs (1)
19private readonly Lazy<AdditionalText> _lazyAdditionalFile;
Diagnostics\HostDiagnosticAnalyzers.cs (1)
40private readonly Lazy<ImmutableDictionary<object, ImmutableArray<DiagnosticAnalyzer>>> _lazyHostDiagnosticAnalyzersPerReferenceMap;
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex.cs (1)
19private readonly Lazy<HashSet<DeclaredSymbolInfo>> _declaredSymbolInfoSet;
Log\FunctionIdExtensions.cs (1)
13private static readonly Lazy<ImmutableDictionary<FunctionId, string>> s_functionIdsToString = new(
Options\GlobalOptionService.cs (3)
22[ImportMany] IEnumerable<Lazy<IOptionPersisterProvider>> optionPersisterProviders) : IGlobalOptionService 28private readonly Lazy<ImmutableArray<IOptionPersister>> _optionPersisters = new(() => GetOptionPersisters(optionPersisterProviders)); 35private static ImmutableArray<IOptionPersister> GetOptionPersisters(IEnumerable<Lazy<IOptionPersisterProvider>> optionPersisterProviders)
Serialization\SerializerService.cs (1)
43private readonly Lazy<TemporaryStorageService> _storageService = new(() => (TemporaryStorageService)workspaceServices.GetRequiredService<ITemporaryStorageServiceInternal>());
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\IMefHostExportProvider.cs (1)
13IEnumerable<Lazy<TExtension>> GetExports<TExtension>();
Storage\SQLite\v2\SQLitePersistentStorageService.cs (1)
39private static readonly Lazy<bool> s_initialized = new(TryInitializeLibrariesLazy);
Workspace\Host\Mef\MefHostServices.cs (1)
58IEnumerable<Lazy<TExtension>> IMefHostExportProvider.GetExports<TExtension>()
Workspace\Host\Metadata\IAnalyzerAssemblyLoaderProvider.cs (1)
39private readonly Lazy<IAnalyzerAssemblyLoaderInternal> _shadowCopyLoader;
Workspace\ProjectSystem\FileWatchedPortableExecutableReferenceFactory.cs (1)
30private readonly Lazy<IFileChangeContext> _fileReferenceChangeContext;
Workspace\Solution\ProjectState.AnalyzerConfigOptionsCache.cs (1)
28private readonly Lazy<AnalyzerConfigData> _global = new(() => new AnalyzerConfigData(configSet.GlobalConfigOptions, StructuredAnalyzerConfigOptions.Empty));
Workspace\Solution\SolutionCompilationState.CompilationTracker.CompilationTrackerState.cs (2)
67public readonly Lazy<Compilation> LazyCompilationWithoutGeneratedDocuments; 87Lazy<Compilation> compilationWithoutGeneratedDocuments,
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (2)
801var lazyCompilationWithoutGeneratedDocuments = new Lazy<Compilation>(() => 837var compilationWithoutGeneratedDocuments = inProgressState.LazyCompilationWithoutGeneratedDocuments;
Workspace\Solution\SolutionState.cs (3)
68private readonly Lazy<HostDiagnosticAnalyzers> _lazyAnalyzers; 87Lazy<HostDiagnosticAnalyzers>? lazyAnalyzers) 110static Lazy<HostDiagnosticAnalyzers> CreateLazyHostDiagnosticAnalyzers(IReadOnlyList<AnalyzerReference> analyzerReferences)
Workspace\Solution\SourceGeneratedDocumentState.cs (5)
17private readonly Lazy<Checksum> _lazyContentHash; 77var lazyTextChecksum = new Lazy<Checksum>(() => originalSourceTextChecksum ?? ComputeContentHash(generatedSourceText)); 87Lazy<Checksum> lazyTextChecksum, 142Lazy<Checksum> lazyContentHash, 241var lazyTextChecksum = new Lazy<Checksum>(() => ComputeContentHash(sourceText));
Microsoft.CodeAnalysis.Workspaces.Desktop (2)
Workspace\Host\Mef\MefV1HostServices.cs (2)
96public IEnumerable<Lazy<TExtension>> GetExports<TExtension>() 105return (IEnumerable<Lazy<TExtension>>)exports;
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (4)
MEF\TestComposition.cs (1)
76private readonly Lazy<IExportProviderFactory> _exportProviderFactory;
MEF\UseExportProviderAttribute.cs (1)
234IEnumerable<Lazy<TExtension>> IMefHostExportProvider.GetExports<TExtension>()
Remote\InProcRemoteHostClientProvider.cs (2)
64private readonly Lazy<WorkspaceManager> _lazyManager; 65private readonly Lazy<RemoteHostClient> _lazyClient;
Microsoft.CommonLanguageServerProtocol.Framework.Package (15)
AbstractLanguageServer.cs (3)
30private readonly Lazy<IRequestExecutionQueue<TRequestContext>> _queue; 31private readonly Lazy<ILspServices> _lspServices; 32private readonly Lazy<AbstractHandlerProvider> _handlerProvider;
HandlerProvider.cs (7)
21private FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>>? _requestHandlers; 31if (!requestHandlers.TryGetValue(requestHandlerMetadata, out var lazyHandler)) 45private FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>> GetRequestHandlers() 48private static FrozenDictionary<RequestHandlerMetadata, Lazy<IMethodHandler>> CreateMethodToHandlerMap(ILspServices lspServices, AbstractTypeRefResolver typeRefResolver) 50var builder = new Dictionary<RequestHandlerMetadata, Lazy<IMethodHandler>>(); 98static Lazy<IMethodHandler> GetLazyHandlerFromInstance(IMethodHandler instance) 103static Lazy<IMethodHandler> GetLazyHandlerFromTypeRef(ILspServices lspServices, AbstractTypeRefResolver typeRefResolver, TypeRef handlerTypeRef)
RequestExecutionQueue.cs (5)
76private readonly FrozenDictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata Metadata, IMethodHandler Handler, MethodInfo MethodInfo)>>> _handlerInfoMap; 94private static FrozenDictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>> BuildHandlerMap(AbstractHandlerProvider handlerProvider, AbstractTypeRefResolver typeRefResolver) 96var genericMethodMap = new Dictionary<string, FrozenDictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>>(); 103var languages = new Dictionary<string, Lazy<(RequestHandlerMetadata, IMethodHandler, MethodInfo)>>(); 419if (handlersForMethod.TryGetValue(language, out var lazyData) ||
Microsoft.DotNet.Deployment.Tasks.Links (1)
Microsoft.DotNet.Helix.Sdk (1)
CommandPayload.cs (1)
17private readonly Lazy<DirectoryInfo> _directoryInfo = new Lazy<DirectoryInfo>(CreateDirectory);
Microsoft.DotNet.XUnitExtensions (13)
src\Microsoft.DotNet.XUnitExtensions.Shared\DiscovererHelpers.cs (1)
15private static readonly Lazy<bool> s_isMonoRuntime = new Lazy<bool>(() => Type.GetType("Mono.RuntimeStructs") != null);
src\Microsoft.DotNet.XUnitExtensions.Shared\Discoverers\SkipOnCoreClrDiscoverer.cs (12)
17private static readonly Lazy<bool> s_isJitStress = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitStress); 18private static readonly Lazy<bool> s_isJitStressRegs = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitStressRegs); 19private static readonly Lazy<bool> s_isJitMinOpts = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitMinOpts); 20private static readonly Lazy<bool> s_isTailCallStress = new Lazy<bool>(() => CoreClrConfigurationDetection.IsTailCallStress); 21private static readonly Lazy<bool> s_isZapDisable = new Lazy<bool>(() => CoreClrConfigurationDetection.IsZapDisable); 22private static readonly Lazy<bool> s_isGCStress3 = new Lazy<bool>(() => CoreClrConfigurationDetection.IsGCStress3); 23private static readonly Lazy<bool> s_isGCStressC = new Lazy<bool>(() => CoreClrConfigurationDetection.IsGCStressC); 24private static readonly Lazy<bool> s_isCheckedRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsCheckedRuntime); 25private static readonly Lazy<bool> s_isReleaseRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsReleaseRuntime); 26private static readonly Lazy<bool> s_isDebugRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsDebugRuntime); 27private static readonly Lazy<bool> s_isStressTest = new Lazy<bool>(() => CoreClrConfigurationDetection.IsStressTest); 28private static readonly Lazy<bool> s_isCoreClrInterpreter = new Lazy<bool>(() => CoreClrConfigurationDetection.IsCoreClrInterpreter);
Microsoft.DotNet.XUnitV3Extensions (13)
src\Microsoft.DotNet.XUnitExtensions.Shared\Attributes\SkipOnCoreClrAttribute.cs (12)
18private static readonly Lazy<bool> s_isJitStress = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitStress); 19private static readonly Lazy<bool> s_isJitStressRegs = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitStressRegs); 20private static readonly Lazy<bool> s_isJitMinOpts = new Lazy<bool>(() => CoreClrConfigurationDetection.IsJitMinOpts); 21private static readonly Lazy<bool> s_isTailCallStress = new Lazy<bool>(() => CoreClrConfigurationDetection.IsTailCallStress); 22private static readonly Lazy<bool> s_isZapDisable = new Lazy<bool>(() => CoreClrConfigurationDetection.IsZapDisable); 23private static readonly Lazy<bool> s_isGCStress3 = new Lazy<bool>(() => CoreClrConfigurationDetection.IsGCStress3); 24private static readonly Lazy<bool> s_isGCStressC = new Lazy<bool>(() => CoreClrConfigurationDetection.IsGCStressC); 25private static readonly Lazy<bool> s_isCheckedRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsCheckedRuntime); 26private static readonly Lazy<bool> s_isReleaseRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsReleaseRuntime); 27private static readonly Lazy<bool> s_isDebugRuntime = new Lazy<bool>(() => CoreClrConfigurationDetection.IsDebugRuntime); 28private static readonly Lazy<bool> s_isStressTest = new Lazy<bool>(() => CoreClrConfigurationDetection.IsStressTest); 29private static readonly Lazy<bool> s_isCoreClrInterpreter = new Lazy<bool>(() => CoreClrConfigurationDetection.IsCoreClrInterpreter);
src\Microsoft.DotNet.XUnitExtensions.Shared\DiscovererHelpers.cs (1)
15private static readonly Lazy<bool> s_isMonoRuntime = new Lazy<bool>(() => Type.GetType("Mono.RuntimeStructs") != null);
Microsoft.Extensions.DataIngestion.Tests (1)
Readers\MarkItDownConditionAttribute.cs (1)
18internal static readonly Lazy<bool> IsInstalled = new(CanInvokeMarkItDown);
Microsoft.Extensions.DependencyInjection.Abstractions (1)
ActivatorUtilities.cs (1)
31private static readonly Lazy<ConditionalWeakTable<Type, ConstructorInfoEx[]>> s_collectibleConstructorInfos = new();
Microsoft.Extensions.DependencyModel (1)
DependencyContext.cs (1)
17private static readonly Lazy<DependencyContext?> _defaultContext = new(LoadDefault);
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Windows\WindowsContainerResourceQuotaProvider.cs (1)
13private readonly Lazy<MEMORYSTATUSEX> _memoryStatus;
Microsoft.Extensions.Http (10)
DefaultHttpClientFactory.cs (10)
26private readonly Func<string, Lazy<ActiveHandlerTrackingEntry>> _entryFactory; 27private readonly Lazy<ILogger> _logger; 51internal readonly ConcurrentDictionary<string, Lazy<ActiveHandlerTrackingEntry>> _activeHandlers; 79_activeHandlers = new ConcurrentDictionary<string, Lazy<ActiveHandlerTrackingEntry>>(StringComparer.Ordinal); 199bool removed = _activeHandlers.TryRemove(active.Name, out Lazy<ActiveHandlerTrackingEntry>? found); 347public static void CleanupCycleStart(Lazy<ILogger> loggerLazy, int initialCount) 355public static void CleanupCycleEnd(Lazy<ILogger> loggerLazy, TimeSpan duration, int disposedCount, int finalCount) 363public static void CleanupItemFailed(Lazy<ILogger> loggerLazy, string clientName, Exception exception) 371public static void HandlerExpired(Lazy<ILogger> loggerLazy, string clientName, TimeSpan lifetime) 379private static bool TryGetLogger(Lazy<ILogger> loggerLazy, [NotNullWhen(true)] out ILogger? logger)
Microsoft.Extensions.Options (4)
OptionsCache.cs (4)
18private readonly ConcurrentDictionary<string, Lazy<TOptions>> _cache = new ConcurrentDictionary<string, Lazy<TOptions>>(concurrencyLevel: 1, capacity: 31, StringComparer.Ordinal); // 31 == default capacity 36Lazy<TOptions> value; 80if (_cache.TryGetValue(name ?? Options.DefaultName, out Lazy<TOptions>? lazy))
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (1)
Resolver\LoopbackDnsTestBase.cs (1)
21private readonly Lazy<DnsResolver> _resolverLazy;
Microsoft.Extensions.Telemetry (5)
src\Shared\Memoization\Memoize.cs (1)
16/// Memoize is like a <see cref="Lazy{T}" />, but for functions instead of values.
src\Shared\Memoization\MemoizedFunction.cs (4)
58private readonly ConcurrentDictionary<Arg, Lazy<TResult>> _values; 77if (_values.TryGetValue(arg, out var result)) 131private readonly ConcurrentDictionary<Args, Lazy<TResult>> _values; 150if (_values.TryGetValue(args, out var result))
Microsoft.Interop.LibraryImportGenerator (4)
Analyzers\CustomMarshallerAttributeFixer.cs (4)
214Lazy<SyntaxNode> unmanagedTypeSyntax = new(CreateUnmanagedTypeSyntax, isThreadSafe: false); 215Lazy<ITypeSymbol> managedElementTypeSymbol = new(CreateManagedElementTypeSymbol, isThreadSafe: false); 410Lazy<SyntaxNode> unmanagedTypeSyntax = new(CreateUnmanagedTypeSyntax, isThreadSafe: false); 411Lazy<ITypeSymbol> managedElementTypeSymbol = new(CreateManagedElementTypeSymbol, isThreadSafe: false);
Microsoft.Maui (4)
Hosting\MauiAppBuilder.cs (2)
19 private readonly Lazy<ConfigurationManager> _configuration; 26 var configuration = new Lazy<ConfigurationManager>(() => new ConfigurationManager());
MauiContext.cs (1)
10 readonly Lazy<IMauiHandlersFactory> _handlers;
VisualDiagnostics\VisualDiagnostics.cs (1)
16 static Lazy<bool> isVisualDiagnosticsEnvVarSet = new Lazy<bool>(() => Environment.GetEnvironmentVariable("ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO") is { } value && value == "1");
Microsoft.Maui.Controls (45)
ActivityIndicator\ActivityIndicator.cs (1)
19 readonly Lazy<PlatformConfigurationRegistry<ActivityIndicator>> _platformConfigurationRegistry;
Application\Application.cs (2)
22 readonly Lazy<PlatformConfigurationRegistry<Application>> _platformConfigurationRegistry; 25 readonly Lazy<IResourceDictionary?> _systemResources;
BoxView\BoxView.cs (1)
18 readonly Lazy<PlatformConfigurationRegistry<BoxView>> _platformConfigurationRegistry;
Button\Button.cs (1)
146 readonly Lazy<PlatformConfigurationRegistry<Button>> _platformConfigurationRegistry;
CarouselPage\CarouselPage.cs (1)
9 readonly Lazy<PlatformConfigurationRegistry<CarouselPage>> _platformConfigurationRegistry;
Cells\Cell.cs (2)
23 readonly Lazy<ElementConfiguration> _elementConfiguration; 347 readonly Lazy<PlatformConfigurationRegistry<Cell>> _platformConfigurationRegistry;
CheckBox\CheckBox.cs (1)
12 readonly Lazy<PlatformConfigurationRegistry<CheckBox>> _platformConfigurationRegistry;
DatePicker\DatePicker.cs (1)
48 readonly Lazy<PlatformConfigurationRegistry<DatePicker>> _platformConfigurationRegistry;
Editor\Editor.cs (1)
60 readonly Lazy<PlatformConfigurationRegistry<Editor>> _platformConfigurationRegistry;
Entry\Entry.cs (1)
88 readonly Lazy<PlatformConfigurationRegistry<Entry>> _platformConfigurationRegistry;
FlyoutPage\FlyoutPage.cs (1)
317 readonly Lazy<PlatformConfigurationRegistry<FlyoutPage>> _platformConfigurationRegistry;
Frame\Frame.cs (1)
23 readonly Lazy<PlatformConfigurationRegistry<Frame>> _platformConfigurationRegistry;
Image\Image.cs (1)
30 readonly Lazy<PlatformConfigurationRegistry<Image>> _platformConfigurationRegistry;
ImageButton\ImageButton.cs (1)
59 readonly Lazy<PlatformConfigurationRegistry<ImageButton>> _platformConfigurationRegistry;
Label\Label.cs (1)
118 readonly Lazy<PlatformConfigurationRegistry<Label>> _platformConfigurationRegistry;
LegacyLayouts\AbsoluteLayout.cs (2)
24 readonly Lazy<PlatformConfigurationRegistry<AbsoluteLayout>> _platformConfigurationRegistry; 166 var sizeRequest = new Lazy<SizeRequest>(() => view.Measure(double.PositiveInfinity, double.PositiveInfinity, MeasureFlags.IncludeMargins));
LegacyLayouts\Grid.cs (1)
69 readonly Lazy<PlatformConfigurationRegistry<Grid>> _platformConfigurationRegistry;
LegacyLayouts\RelativeLayout.cs (1)
36 readonly Lazy<PlatformConfigurationRegistry<RelativeLayout>> _platformConfigurationRegistry;
LegacyLayouts\StackLayout.cs (1)
22 readonly Lazy<PlatformConfigurationRegistry<StackLayout>> _platformConfigurationRegistry;
ListView\ListView.cs (1)
87 readonly Lazy<PlatformConfigurationRegistry<ListView>> _platformConfigurationRegistry;
NavigationPage\NavigationPage.cs (2)
416 readonly Lazy<PlatformConfigurationRegistry<NavigationPage>> _platformConfigurationRegistry; 720 readonly Lazy<ReadOnlyCastingList<Page, Element>> _castingList;
NavigationPage\NavigationPage.Legacy.cs (1)
258 readonly Lazy<ReadOnlyCastingList<Page, Element>> _castingList;
NavigationProxy.cs (2)
25 Lazy<NavigatingStepRequestList> _modalStack = new Lazy<NavigatingStepRequestList>(() => new NavigatingStepRequestList()); 27 Lazy<List<Page>> _pushStack = new Lazy<List<Page>>(() => new List<Page>());
Page\Page.cs (1)
70 readonly Lazy<PlatformConfigurationRegistry<Page>> _platformConfigurationRegistry;
Picker\Picker.cs (1)
68 readonly Lazy<PlatformConfigurationRegistry<Picker>> _platformConfigurationRegistry;
ProgressBar\ProgressBar.cs (1)
21 readonly Lazy<PlatformConfigurationRegistry<ProgressBar>> _platformConfigurationRegistry;
RadioButton\RadioButton.cs (1)
51 readonly Lazy<PlatformConfigurationRegistry<RadioButton>> _platformConfigurationRegistry;
RefreshView\RefreshView.cs (1)
17 readonly Lazy<PlatformConfigurationRegistry<RefreshView>> _platformConfigurationRegistry;
Registrar.cs (1)
317 static readonly Lazy<Dictionary<string, IList<StylePropertyAttribute>>> LazyStyleProperties = new Lazy<Dictionary<string, IList<StylePropertyAttribute>>>(LoadStyleSheets);
ScrollView\ScrollView.cs (1)
135 readonly Lazy<PlatformConfigurationRegistry<ScrollView>> _platformConfigurationRegistry;
SearchBar\SearchBar.cs (1)
73 readonly Lazy<PlatformConfigurationRegistry<SearchBar>> _platformConfigurationRegistry;
Shell\ShellItem.cs (1)
151 Lazy<PlatformConfigurationRegistry<ShellItem>> _platformConfigurationRegistry;
Slider\Slider.cs (1)
58 readonly Lazy<PlatformConfigurationRegistry<Slider>> _platformConfigurationRegistry;
Stepper\Stepper.cs (1)
53 readonly Lazy<PlatformConfigurationRegistry<Stepper>> _platformConfigurationRegistry;
SwipeView\SwipeView.cs (1)
14 readonly Lazy<PlatformConfigurationRegistry<SwipeView>> _platformConfigurationRegistry;
Switch\Switch.cs (1)
51 readonly Lazy<PlatformConfigurationRegistry<Switch>> _platformConfigurationRegistry;
TabbedPage\TabbedPage.cs (1)
26 readonly Lazy<PlatformConfigurationRegistry<TabbedPage>> _platformConfigurationRegistry;
TableView\TableView.cs (1)
24 readonly Lazy<PlatformConfigurationRegistry<TableView>> _platformConfigurationRegistry;
TimePicker\TimePicker.cs (1)
43 readonly Lazy<PlatformConfigurationRegistry<TimePicker>> _platformConfigurationRegistry;
WebView\WebView.cs (1)
53 readonly Lazy<PlatformConfigurationRegistry<WebView>> _platformConfigurationRegistry;
Microsoft.Maui.Controls.DesignTools (2)
ColorDesignTypeConverter.cs (2)
180 static readonly Lazy<Regex> RxColorHex = new(() => new Regex(RxColorHexPattern, RegexOptions.Compiled | RegexOptions.Singleline)); 189 static readonly Lazy<Regex> RxFuncExpr = new(() => new Regex(RxFuncPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline));
Microsoft.Maui.Controls.Foldable (3)
DualScreenInfo.cs (1)
54 static Lazy<DualScreenInfo> _dualScreenInfo { get; } = new Lazy<DualScreenInfo>(OnCreate);
NoPlatformFoldableService.cs (1)
18 static Lazy<NoPlatformFoldableService> _Instance = new Lazy<NoPlatformFoldableService>(() => new NoPlatformFoldableService());
TwoPaneViewLayoutGuide.cs (1)
17 static Lazy<TwoPaneViewLayoutGuide> _twoPaneViewLayoutGuide = new Lazy<TwoPaneViewLayoutGuide>(() => new TwoPaneViewLayoutGuide());
Microsoft.Maui.Resizetizer (1)
ColorTable.cs (1)
13 static readonly Lazy<Dictionary<string, SKColor>> ColorConstants = new Lazy<Dictionary<string, SKColor>>(GetColors);
Microsoft.ML.AutoML (2)
ColumnInference\PurposeInference.cs (2)
49private readonly Lazy<DataViewType> _type; 50private readonly Lazy<string> _columnName;
Microsoft.ML.CodeAnalyzer.Tests (15)
Code\BestFriendOnPublicDeclarationTest.cs (2)
18private readonly Lazy<string> _sourceAttribute = TestUtils.LazySource("BestFriendAttribute.cs"); 19private readonly Lazy<string> _sourceDeclaration = TestUtils.LazySource("BestFriendOnPublicDeclaration.cs");
Code\BestFriendTest.cs (3)
26private readonly Lazy<string> _sourceAttribute = TestUtils.LazySource("BestFriendAttribute.cs"); 27private readonly Lazy<string> _sourceDeclaration = TestUtils.LazySource("BestFriendDeclaration.cs"); 28private readonly Lazy<string> _sourceUser = TestUtils.LazySource("BestFriendUser.cs");
Code\ContractsCheckTest.cs (9)
20private readonly Lazy<string> _source = TestUtils.LazySource("ContractsCheckResource.cs"); 21private readonly Lazy<string> _sourceContracts = TestUtils.LazySource("Contracts.cs"); 22private readonly Lazy<string> _sourceFriend = TestUtils.LazySource("BestFriendAttribute.cs"); 89private readonly Lazy<string> _sourcePreFix = TestUtils.LazySource("ContractsCheckBeforeFix.cs"); 90private readonly Lazy<string> _sourcePostFix = TestUtils.LazySource("ContractsCheckAfterFix.cs"); 92private readonly Lazy<string> _sourceArgAttr = TestUtils.LazySource("ArgumentAttribute.cs"); 93private readonly Lazy<string> _sourceArgType = TestUtils.LazySource("ArgumentType.cs"); 94private readonly Lazy<string> _sourceBestAttr = TestUtils.LazySource("BestFriendAttribute.cs"); 95private readonly Lazy<string> _sourceDefArgAttr = TestUtils.LazySource("DefaultArgumentAttribute.cs");
Helpers\TestUtils.cs (1)
34public static Lazy<string> LazySource(string resourceName)
Microsoft.ML.Data (2)
Transforms\ColumnBindingsBase.cs (1)
269private readonly Lazy<DataViewSchema> _convertedSchema;
Transforms\RowToRowTransformerBase.cs (1)
61protected readonly Lazy<DataViewSchema.DetachedColumn[]> OutputColumns;
Microsoft.ML.FastTree (3)
Dataset\SegmentIntArray.cs (2)
52public static Lazy<PerformSegmentFindOptimalCost> SegmentFindOptimalCost = new(() => 64public static Lazy<PerformSegmentFindOptimalPath> SegmentFindOptimalPath = new(() =>
Training\Test.cs (1)
463private readonly Lazy<WinLossCalculator> _winLossCalculator;
Microsoft.VisualStudio.LanguageServices (41)
CallHierarchy\CallHierarchyProvider.cs (2)
32private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter; 44Lazy<IStreamingFindUsagesPresenter> streamingPresenter)
Diagnostics\VisualStudioDiagnosticAnalyzerProvider.cs (1)
36private readonly Lazy<ImmutableArray<(AnalyzerFileReference reference, string extensionId)>> _lazyAnalyzerReferences;
DocumentationComments\VisualStudioDocumentationProvider.cs (1)
19private readonly Lazy<IVsXMLMemberIndex> _lazyMemberIndex;
EditAndContinue\EditAndContinueFeedbackDiagnosticFileProvider.cs (2)
48private readonly Lazy<EditAndContinueLanguageService>? _encService; 53[Import(AllowDefault = true)] Lazy<EditAndContinueLanguageService>? encService = null)
FindReferences\StreamingFindUsagesPresenter.cs (1)
48private readonly Lazy<IClassificationFormatMap> _lazyClassificationFormatMap;
LanguageService\AbstractLanguageService`2.cs (2)
39private readonly Lazy<VsLanguageDebugInfo> _languageDebugInfo; 41internal readonly Lazy<VisualStudioWorkspaceImpl> Workspace;
Library\ObjectBrowser\AbstractObjectBrowserLibraryManager.cs (1)
36private readonly Lazy<ILibraryService> _libraryService;
NavigateTo\VisualStudioNavigateToPreviewServiceFactory.cs (1)
16private readonly Lazy<INavigateToPreviewService> _singleton =
Options\VisualStudioOptionPersisterProvider.cs (3)
26private readonly Lazy<ILegacyGlobalOptionService> _legacyGlobalOptions; 33private readonly Lazy<IOptionPersister> _lazyPersister; 40Lazy<ILegacyGlobalOptionService> legacyGlobalOptions)
Packaging\PackageInstallerServiceFactory.cs (6)
66private readonly Lazy<IVsPackageInstaller2>? _packageInstaller; 67private readonly Lazy<IVsPackageUninstaller>? _packageUninstaller; 68private readonly Lazy<IVsPackageSourceProvider>? _packageSourceProvider; 106[Import(AllowDefault = true)] Lazy<IVsPackageInstaller2>? packageInstaller, 107[Import(AllowDefault = true)] Lazy<IVsPackageUninstaller>? packageUninstaller, 108[Import(AllowDefault = true)] Lazy<IVsPackageSourceProvider>? packageSourceProvider)
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceProviderServiceFactory.cs (1)
26private readonly Lazy<VisualStudioMetadataReferenceManager> _manager = new(
ProjectSystem\MetadataReferences\VisualStudioPortableExecutableReference.cs (1)
34private readonly Lazy<DateTime> _timestamp;
ProjectSystem\MiscellaneousFilesWorkspace.cs (3)
35private readonly Lazy<IMetadataAsSourceFileService> _fileTrackingMetadataAsSourceService; 51private readonly Lazy<ImmutableArray<MetadataReference>> _metadataReferences; 59Lazy<IMetadataAsSourceFileService> fileTrackingMetadataAsSourceService,
ProjectSystem\OpenTextBufferProvider.cs (1)
42private readonly Lazy<IVsRunningDocumentTable4> _runningDocumentTable;
ProjectSystem\SdkAnalyzerAssemblyRedirector.cs (1)
56private readonly Lazy<ImmutableDictionary<string, List<AnalyzerInfo>>> _analyzerMap;
ProjectSystem\VisualStudioWorkspaceImpl.cs (2)
117private readonly Lazy<IProjectCodeModelFactory> _projectCodeModelFactory; 118private readonly Lazy<ExternalErrorDiagnosticUpdateSource> _lazyExternalErrorDiagnosticUpdateSource;
ProjectSystem\VisualStudioWorkspaceImpl.OpenFileTracker.cs (2)
37private readonly Lazy<IEditorOptionsFactoryService> _editorOptionsFactoryService; 65Lazy<IEditorOptionsFactoryService> editorOptionsFactoryService,
Telemetry\VisualStudioWorkspaceTelemetryService.cs (2)
27Lazy<VisualStudioWorkspace> workspace, 31private readonly Lazy<VisualStudioWorkspace> _workspace = workspace;
Workspace\GlobalUndoServiceFactory.cs (3)
33Lazy<VisualStudioWorkspace> workspace) 46private readonly Lazy<VisualStudioWorkspace> _lazyVSWorkspace; 49public GlobalUndoService(IThreadingContext threadingContext, ITextUndoHistoryRegistry undoHistoryRegistry, SVsServiceProvider serviceProvider, Lazy<VisualStudioWorkspace> lazyVSWorkspace)
Workspace\VisualStudioDocumentNavigationService.cs (2)
42Lazy<SourceGeneratedFileManager> sourceGeneratedFileManager) 49private readonly Lazy<SourceGeneratedFileManager> _sourceGeneratedFileManager = sourceGeneratedFileManager;
Workspace\VisualStudioSourceGeneratorTelemetryCollectorWorkspaceServiceFactory.cs (2)
48private readonly Lazy<VisualStudioWorkspace> _visualStudioWorkspace; 52public VisualStudioSourceGeneratorTelemetryCollectorWorkspaceServiceFactory(IThreadingContext threadingContext, IAsynchronousOperationListenerProvider listenerProvider, Lazy<VisualStudioWorkspace> visualStudioWorkspace)
Workspace\VisualStudioSymbolNavigationService.cs (1)
84foreach (var lazyService in solution.Services.ExportProvider.GetExports<ICrossLanguageSymbolNavigationService>())
Microsoft.VisualStudio.LanguageServices.CodeLens (2)
ReferenceCodeLensProvider.cs (2)
45private readonly Lazy<ICodeLensCallbackService> _lazyCodeLensCallbackService; 54public ReferenceCodeLensProvider(Lazy<ICodeLensCallbackService> codeLensCallbackService)
Microsoft.VisualStudio.LanguageServices.CSharp (5)
SemanticSearch\SemanticSearchQueryExecutor.cs (2)
32private readonly Lazy<ConcurrentStack<(DocumentId documentId, ImmutableArray<TextChange> changes)>> _lazyDocumentUpdates = new(); 33private readonly Lazy<ConcurrentDictionary<string, string?>> _lazyTextFileUpdates = new();
SemanticSearch\SemanticSearchToolWindowImpl.cs (3)
62Lazy<ISemanticSearchSolutionService> semanticSearchService, 75private static readonly Lazy<ControlTemplate> s_buttonTemplate = new(CreateButtonTemplate); 80private readonly Lazy<SemanticSearchEditorWorkspace> _semanticSearchWorkspace
Microsoft.VisualStudio.LanguageServices.Implementation (3)
ProjectSystem\CPS\CPSProject_IWorkspaceProjectContext.cs (1)
39private readonly Lazy<ProjectExternalErrorReporter?> _externalErrorReporter;
RoslynVisualStudioWorkspace.cs (2)
40private readonly Lazy<IStreamingFindUsagesPresenter> _streamingPresenter; 47Lazy<IStreamingFindUsagesPresenter> streamingPresenter,
MinimalValidationSample (1)
artifacts\obj\MinimalValidationSample\Release\net11.0\generated\Microsoft.Extensions.Validation.ValidationsGenerator\Microsoft.Extensions.Validation.ValidationsGenerator\ValidatableInfoResolver.g.cs (1)
193private static readonly global::System.Lazy<global::System.Collections.Concurrent.ConcurrentDictionary<global::System.Type, global::System.ComponentModel.DataAnnotations.ValidationAttribute[]>> _lazyTypeCache = new (() => new ());
MSBuild (16)
DebugUtils.cs (1)
160private static readonly Lazy<NodeMode?> ProcessNodeMode = new(
FrameworkLocationHelper.cs (3)
237private static readonly Lazy<VisualStudioSpec[]> VisualStudioSpecs = new(() => 433private static readonly Lazy<IReadOnlyDictionary<Version, DotNetFrameworkSpec>> DotNetFrameworkSpecDict = new(() => DotNetFrameworkSpecs().ToDictionary(spec => spec.Version)); 434private static readonly Lazy<IReadOnlyDictionary<Version, VisualStudioSpec>> VisualStudioSpecDict = new(() => VisualStudioSpecs.Value.ToDictionary(spec => spec.Version));
PrintLineDebugger.cs (3)
25private static readonly Lazy<PropertyInfo> CommonWriterProperty = new Lazy<PropertyInfo>( 37public static Lazy<PrintLineDebugger> Default = 40public static Lazy<PrintLineDebugger> DefaultWithProcessInfo =
PrintLineDebuggerWriters.cs (1)
71private static readonly Lazy<string> _artifactsLogs = new Lazy<string>(
RegisteredTaskObjectCacheBase.cs (7)
24private static readonly Lazy<ConcurrentDictionary<object, object>> s_appDomainLifetimeObjects = new Lazy<ConcurrentDictionary<object, object>>(); 29private Lazy<ConcurrentDictionary<object, object>> _buildLifetimeObjects = new Lazy<ConcurrentDictionary<object, object>>(); 51var lazyCollection = GetLazyCollectionForLifetime(lifetime); 105Lazy<ConcurrentDictionary<object, object>> dict = GetLazyCollectionForLifetime(lifetime); 119protected Lazy<ConcurrentDictionary<object, object>> GetLazyCollectionForLifetime(RegisteredTaskObjectLifetime lifetime) 121Lazy<ConcurrentDictionary<object, object>> dict = null; 139private static void DisposeObjects(Lazy<ConcurrentDictionary<object, object>> lifetimeObjects)
TypeLoader.cs (1)
84private static readonly Lazy<string[]> runtimeAssembliesCLR35_20 = new Lazy<string[]>(FindRuntimeAssembliesWithMicrosoftBuildFrameworkCLR2CLR35);
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
355[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Lazy<>))]
netstandard (1)
netstandard.cs (1)
978[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Lazy<>))]
PresentationFramework (27)
MS\Internal\WindowsRuntime\Generated\Windows.Data.Text.cs (3)
33private readonly Lazy<global::MS.Internal.WindowsRuntime.ABI.Windows.Data.Text.IAlternateWordForm> _defaultLazy; 251private readonly Lazy<global::MS.Internal.WindowsRuntime.ABI.Windows.Data.Text.IWordSegment> _defaultLazy; 317private readonly Lazy<global::MS.Internal.WindowsRuntime.ABI.Windows.Data.Text.IWordsSegmenter> _defaultLazy;
MS\Internal\WindowsRuntime\Generated\Windows.Globalization.cs (1)
69private readonly Lazy<global::MS.Internal.WindowsRuntime.ABI.Windows.Globalization.ILanguage> _defaultLazy;
MS\Internal\WindowsRuntime\Generated\WinRT.cs (1)
195private static Lazy<WinrtModule> _instance = new Lazy<WinrtModule>();
System\Windows\Markup\Baml2006\Baml2006SchemaContext.cs (9)
660private static readonly Lazy<XamlMember> _xStaticMemberProperty 663private static readonly Lazy<XamlMember> _xTypeTypeProperty 666private static readonly Lazy<XamlMember> _resourceDictionaryDefContentProperty 669private static readonly Lazy<XamlType> _resourceDictionaryType 672private static readonly Lazy<XamlType> _eventSetterType 675private static readonly Lazy<XamlMember> _eventSetterEventProperty 678private static readonly Lazy<XamlMember> _eventSetterHandlerProperty 681private static readonly Lazy<XamlMember> _frameworkTemplateTemplateProperty 684private static readonly Lazy<XamlType> _staticResourceExtensionType
System\Windows\Markup\Baml2006\WpfSharedBamlSchemaContext.cs (9)
349private static readonly Lazy<XamlMember> _xStaticMemberProperty 352private static readonly Lazy<XamlMember> _xTypeTypeProperty 355private static readonly Lazy<XamlMember> _resourceDictionaryDefContentProperty 358private static readonly Lazy<XamlType> _resourceDictionaryType 361private static readonly Lazy<XamlType> _eventSetterType 364private static readonly Lazy<XamlMember> _eventSetterEventProperty 367private static readonly Lazy<XamlMember> _eventSetterHandlerProperty 370private static readonly Lazy<XamlMember> _frameworkTemplateTemplateProperty 373private static readonly Lazy<XamlType> _staticResourceExtensionType
System\Windows\Markup\WpfXamlLoader.cs (1)
17private static Lazy<XamlMember> XmlSpace = new Lazy<XamlMember>(() => new WpfXamlMember(XmlAttributeProperties.XmlSpaceProperty, true));
System\Windows\Markup\XamlReader.cs (3)
1172private static readonly Lazy<WpfSharedBamlSchemaContext> _bamlSharedContext = 1174private static readonly Lazy<WpfSharedXamlSchemaContext> _xamlSharedContext = 1176private static readonly Lazy<WpfSharedXamlSchemaContext> _xamlV3SharedContext =
Roslyn.Diagnostics.Analyzers (16)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\IMefHostExportProvider.cs (1)
13IEnumerable<Lazy<TExtension>> GetExports<TExtension>();
Roslyn.Test.PdbUtilities (1)
EditAndContinue\EditAndContinueTest.GenerationVerifier.cs (1)
27private readonly Lazy<MetadataVisualizer> _lazyVisualizer = new(() => new MetadataVisualizer(readers, TextWriter.Null, MetadataVisualizerOptions.None));
Shared (5)
Memoization\Memoize.cs (1)
16/// Memoize is like a <see cref="Lazy{T}" />, but for functions instead of values.
Memoization\MemoizedFunction.cs (4)
58private readonly ConcurrentDictionary<Arg, Lazy<TResult>> _values; 77if (_values.TryGetValue(arg, out var result)) 131private readonly ConcurrentDictionary<Args, Lazy<TResult>> _values; 150if (_values.TryGetValue(args, out var result))
Sockets.BindTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6ScopeIdPresentConditionAttribute.cs (1)
14private static readonly Lazy<bool> _ipv6ScopeIdPresent = new Lazy<bool>(IPv6ScopeIdAddressPresent);
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6SupportedConditionAttribute.cs (1)
14private static readonly Lazy<bool> _ipv6Supported = new Lazy<bool>(CanBindToIPv6Address);
Sockets.FunctionalTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6ScopeIdPresentConditionAttribute.cs (1)
14private static readonly Lazy<bool> _ipv6ScopeIdPresent = new Lazy<bool>(IPv6ScopeIdAddressPresent);
src\Servers\Kestrel\shared\test\TransportTestHelpers\IPv6SupportedConditionAttribute.cs (1)
14private static readonly Lazy<bool> _ipv6Supported = new Lazy<bool>(CanBindToIPv6Address);
System.ComponentModel.Annotations (1)
System\ComponentModel\DataAnnotations\CustomValidationAttribute.cs (1)
62private readonly Lazy<string?> _malformedErrorMessage;
System.ComponentModel.Composition (91)
Microsoft\Internal\LazyServices.cs (1)
10public static T GetNotNullValue<T>(this Lazy<T> lazy, string argument)
System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs (1)
42public Lazy<Type> GetLazyPartType()
System\ComponentModel\Composition\CompositionContractMismatchException.cs (1)
11/// <see cref="Lazy{T}"/> or <see cref="Lazy{T, TMetadataView}"/> object cannot be
System\ComponentModel\Composition\ExportServices.cs (1)
92internal static Lazy<T> CreateStronglyTypedLazyOfT<T>(Export export)
System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs (7)
49var addedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => item.ToArray(), LazyThreadSafetyMode.PublicationOnly); 103var removedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => catalogs.SelectMany(catalog => catalog).ToArray(), LazyThreadSafetyMode.PublicationOnly); 187var removedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => item.ToArray(), LazyThreadSafetyMode.PublicationOnly); 295Lazy<IEnumerable<ComposablePartDefinition>>? addedDefinitions, 296Lazy<IEnumerable<ComposablePartDefinition>>? removedDefinitions) 315Lazy<IEnumerable<ComposablePartDefinition>>? addedDefinitions, 316Lazy<IEnumerable<ComposablePartDefinition>>? removedDefinitions,
System\ComponentModel\Composition\Hosting\CompositionContainer.cs (5)
406/// Releases the <see cref="Lazy{T}"/> from the <see cref="CompositionContainer"/>. The behavior 412/// an <see cref="Lazy{T}"/> if it comes from a <see cref="ComposablePart"/> that was constructed 424public void ReleaseExport<T>(Lazy<T> export) 466public void ReleaseExports<T>(IEnumerable<Lazy<T>> exports) 470foreach (Lazy<T> export in exports)
System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs (26)
21/// The type of the <see cref="Lazy{T}"/> object to return. The contract name is also 25/// The <see cref="Lazy{T}"/> object with the contract name derived from 30/// The returned <see cref="Lazy{T}"/> object is an instance of 47/// There are zero <see cref="Lazy{T}"/> objects with the contract name derived 52/// There are more than one <see cref="Lazy{T}"/> objects with the contract name 59public Lazy<T>? GetExport<T>() 69/// The type of the <see cref="Lazy{T}"/> object to return. 72/// A <see cref="string"/> containing the contract name of the <see cref="Lazy{T}"/> 77/// The <see cref="Lazy{T}"/> object with the specified contract name. 81/// The returned <see cref="Lazy{T}"/> object is an instance of 98/// There are zero <see cref="Lazy{T}"/> objects with the specified contract name 103/// There are more than one <see cref="Lazy{T}"/> objects with the specified contract 110public Lazy<T>? GetExport<T>(string? contractName) 279/// The type of the <see cref="Lazy{T}"/> objects to return. The contract name is also 283/// An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{T}"/> objects 289/// The returned <see cref="Lazy{T}"/> objects are instances of 307public IEnumerable<Lazy<T>> GetExports<T>() 316/// The type of the <see cref="Lazy{T}"/> objects to return. 319/// A <see cref="string"/> containing the contract name of the <see cref="Lazy{T}"/> 324/// An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{T}"/> objects 330/// The returned <see cref="Lazy{T}"/> objects are instances of 348public IEnumerable<Lazy<T>> GetExports<T>(string? contractName) 735private Collection<Lazy<T>> GetExportsCore<T>(string? contractName) 739Collection<Lazy<T>> result = new Collection<Lazy<T>>(); 766private Lazy<T>? GetExportCore<T>(string? contractName)
System\ComponentModel\Composition\Hosting\TypeCatalog.cs (1)
32private readonly Lazy<Dictionary<string, List<ComposablePartDefinition>>> _contractPartIndex;
System\ComponentModel\Composition\Primitives\Export.cs (2)
190/// The current instance is an instance of <see cref="Lazy{T}"/> and the underlying 223/// The current instance is an instance of <see cref="Lazy{T}"/> and the underlying
System\ComponentModel\Composition\ReflectionModel\GenericSpecializationPartCreationInfo.cs (19)
24private readonly Lazy<Type> _lazyPartType; 26private List<Lazy<ParameterInfo>>? _parameters; 28private Dictionary<Lazy<ParameterInfo>, ParameterInfo>? _parametersTable; 65public Lazy<Type> GetLazyPartType() 117private ParameterInfo GetParameter(Lazy<ParameterInfo> originalParameter) 135List<Lazy<ParameterInfo>>? parameters = null; 154Dictionary<Lazy<ParameterInfo>, ParameterInfo>? parametersTable = BuildParametersTable(parameters); 236private Dictionary<Lazy<ParameterInfo>, ParameterInfo>? BuildParametersTable(List<Lazy<ParameterInfo>>? parameters) 240Dictionary<Lazy<ParameterInfo>, ParameterInfo> parametersTable = new Dictionary<Lazy<ParameterInfo>, ParameterInfo>(); 243foreach (var lazyParameter in parameters) 256private List<ImportDefinition> PopulateImports(List<LazyMemberInfo> members, List<Lazy<ParameterInfo>> parameters) 275private ImportDefinition TranslateImport(ReflectionImportDefinition reflectionImport, List<LazyMemberInfo> members, List<Lazy<ParameterInfo>> parameters) 336Lazy<ParameterInfo> lazyParameter = parameterImport.ImportingLazyParameter; 337Lazy<ParameterInfo> parameter = new Lazy<ParameterInfo>(() => GetParameter(lazyParameter)); 402Lazy<IDictionary<string, object?>> lazyMetadata = new Lazy<IDictionary<string, object?>>(() => TranslateExportMetadata(capturedReflectionExport)); 471List<Lazy<ParameterInfo>> parameters = new List<Lazy<ParameterInfo>>();
System\ComponentModel\Composition\ReflectionModel\ImportType.cs (1)
14private static readonly Type LazyOfTType = typeof(Lazy<>);
System\ComponentModel\Composition\ReflectionModel\IReflectionPartCreationInfo.cs (1)
13Lazy<Type> GetLazyPartType();
System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs (1)
17Lazy<ParameterInfo> importingLazyParameter,
System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs (1)
36public Lazy<Type> GetLazyPartType()
System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs (20)
17public static Lazy<Type> GetPartType(ComposablePartDefinition partDefinition) 73public static Lazy<ParameterInfo> GetImportingParameter(ImportDefinition importDefinition) 127Lazy<Type> partType, 129Lazy<IEnumerable<ImportDefinition>>? imports, 130Lazy<IEnumerable<ExportDefinition>>? exports, 131Lazy<IDictionary<string, object?>>? metadata, 149Lazy<IDictionary<string, object?>> metadata, 248Lazy<ParameterInfo> parameter, 260Lazy<ParameterInfo> parameter, 319private readonly Lazy<Type> _partType; 320private readonly Lazy<IEnumerable<ImportDefinition>>? _imports; 321private readonly Lazy<IEnumerable<ExportDefinition>>? _exports; 322private readonly Lazy<IDictionary<string, object?>>? _metadata; 328Lazy<Type> partType, 330Lazy<IEnumerable<ImportDefinition>>? imports, 331Lazy<IEnumerable<ExportDefinition>>? exports, 332Lazy<IDictionary<string, object?>>? metadata, 350public Lazy<Type> GetLazyPartType() 465private readonly Lazy<IDictionary<string, object?>> _metadata; 467public LazyExportDefinition(string contractName, Lazy<IDictionary<string, object?>> metadata)
System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs (3)
14private readonly Lazy<ParameterInfo> _importingLazyParameter; 17Lazy<ParameterInfo> importingLazyParameter, 37public Lazy<ParameterInfo> ImportingLazyParameter
System.ComponentModel.TypeConverter (2)
src\libraries\Common\src\System\Drawing\ColorTable.cs (1)
12private static readonly Lazy<Dictionary<string, Color>> s_colorConstants = new Lazy<Dictionary<string, Color>>(GetColors);
System\Drawing\ColorConverter.cs (1)
17private static readonly Lazy<StandardValuesCollection> s_valuesLazy = new Lazy<StandardValuesCollection>(() =>
System.Composition.Hosting (9)
System\Composition\Hosting\Core\CycleBreakingExportDescriptor.cs (2)
11private readonly Lazy<ExportDescriptor> _exportDescriptor; 13public CycleBreakingExportDescriptor(Lazy<ExportDescriptor> exportDescriptor)
System\Composition\Hosting\Core\CycleBreakingMetadataDictionary.cs (2)
11private readonly Lazy<ExportDescriptor> _exportDescriptor; 13public CycleBreakingMetadataDictionary(Lazy<ExportDescriptor> exportDescriptor)
System\Composition\Hosting\Core\ExportDescriptorPromise.cs (2)
19private readonly Lazy<ReadOnlyCollection<CompositionDependency>> _dependencies; 20private readonly Lazy<ExportDescriptor> _descriptor;
System\Composition\Hosting\Core\ExportDescriptorProvider.cs (1)
42/// <see cref="Lazy{T}"/>; otherwise, dependencies should only be queried within execution of the function provided
System\Composition\Hosting\Providers\Lazy\LazyExportDescriptorProvider.cs (2)
19if (!exportKey.ContractType.IsConstructedGenericType || exportKey.ContractType.GetGenericTypeDefinition() != typeof(Lazy<>)) 32Formatters.Format(typeof(Lazy<TValue>)),
System.Composition.TypedParts (2)
System\Composition\TypedParts\Discovery\DiscoveredPart.cs (2)
26private readonly Lazy<IDictionary<string, object>> _partMetadata; 43Lazy<IDictionary<string, object>> partMetadata)
System.Console (1)
System\ConsolePal.Unix.cs (1)
44private static readonly Lazy<TerminalFormatStrings> s_terminalFormatStringsInstance = new(() => new TerminalFormatStrings(TermInfo.DatabaseFactory.ReadActiveDatabase()));
System.Core (1)
System.Core.cs (1)
118[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Lazy<>))]
System.Drawing.Primitives (1)
src\libraries\Common\src\System\Drawing\ColorTable.cs (1)
12private static readonly Lazy<Dictionary<string, Color>> s_colorConstants = new Lazy<Dictionary<string, Color>>(GetColors);
System.Formats.Tar (1)
System\Formats\Tar\TarHelpers.Unix.cs (1)
12private static readonly Lazy<UnixFileMode> s_umask = new Lazy<UnixFileMode>(DetermineUMask);
System.Net.Http (1)
System\Net\Http\SocketsHttpHandler\SystemProxyInfo.cs (1)
10private static readonly Lazy<IWebProxy> s_proxy = new Lazy<IWebProxy>(ConstructSystemProxy);
System.Net.Ping (3)
src\libraries\Common\src\System\Net\NetworkInformation\UnixCommandLinePing.cs (1)
21private static readonly Lazy<bool> s_isBusybox = new Lazy<bool>(() => IsBusyboxPing(s_discoveredPing4UtilityPath));
src\libraries\Common\src\System\Net\RawSocketPermissions.cs (2)
10private static readonly Lazy<bool> s_canUseRawIPv4Sockets = new Lazy<bool>(() => CheckRawSocketPermissions(AddressFamily.InterNetwork)); 11private static readonly Lazy<bool> s_canUseRawIPv6Sockets = new Lazy<bool>(() => CheckRawSocketPermissions(AddressFamily.InterNetworkV6));
System.Net.Quic (1)
System\Net\Quic\Internal\MsQuicApi.cs (1)
56private static readonly Lazy<MsQuicApi> _api = new Lazy<MsQuicApi>(AllocateMsQuicApi);
System.Net.Security (3)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (1)
34private static readonly Lazy<string[]> s_defaultSigAlgs = new(GetDefaultSignatureAlgorithms);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\GssSafeHandles.cs (1)
73private static readonly Lazy<bool> s_IsNtlmInstalled = new Lazy<bool>(InitIsNtlmInstalled);
System\Net\NegotiateAuthenticationPal.Unix.cs (1)
22private static readonly Lazy<bool> _hasSystemNetSecurityNative = new Lazy<bool>(CheckHasSystemNetSecurityNative);
System.Private.CoreLib (32)
src\libraries\System.Private.CoreLib\src\System\Lazy.cs (19)
179/// By default, all public and protected members of <see cref="Lazy{T}"/> are thread-safe and may be used 201/// Initializes a new instance of the <see cref="Lazy{T}"/> class that 213/// Initializes a new instance of the <see cref="Lazy{T}"/> class that 226/// Initializes a new instance of the <see cref="Lazy{T}"/> class that uses a 244/// Initializes a new instance of the <see cref="Lazy{T}"/> 255/// Initializes a new instance of the <see cref="Lazy{T}"/> 266/// Initializes a new instance of the <see cref="Lazy{T}"/> class 282/// Initializes a new instance of the <see cref="Lazy{T}"/> class 472/// <summary>Gets a value indicating whether the <see cref="Lazy{T}"/> has been initialized. 474/// <value>true if the <see cref="Lazy{T}"/> instance has been initialized; 477/// The initialization of a <see cref="Lazy{T}"/> instance may result in either 484/// cref="Lazy{T}"/>.</summary> 486/// cref="Lazy{T}"/>.</value> 488/// The <see cref="Lazy{T}"/> was initialized to use the default constructor 492/// The <see cref="Lazy{T}"/> was initialized to use the default constructor 496/// The <see cref="Lazy{T}"/> was constructed with the <see cref="LazyThreadSafetyMode.ExecutionAndPublication"/> or 501/// Please <see cref="LazyThreadSafetyMode"/> for more information on how <see cref="Lazy{T}"/> will behave if an exception is thrown 513private readonly Lazy<T> _lazy; 517public LazyDebugView(Lazy<T> lazy)
src\libraries\System.Private.CoreLib\src\System\Threading\LazyThreadSafetyMode.cs (13)
13/// Specifies how a <see cref="Lazy{T}"/> instance should synchronize access among multiple threads. 18/// This mode makes no guarantees around the thread-safety of the <see cref="Lazy{T}"/> instance. If used from multiple threads, the behavior of the <see cref="Lazy{T}"/> is undefined. 19/// This mode should be used when a <see cref="Lazy{T}"/> is guaranteed to never be initialized from more than one thread simultaneously and high performance is crucial. 20/// If valueFactory throws an exception when the <see cref="Lazy{T}"/> is initialized, the exception will be cached and returned on subsequent accesses to Value. Also, if valueFactory recursively 21/// accesses Value on this <see cref="Lazy{T}"/> instance, a <see cref="InvalidOperationException"/> will be thrown. 26/// When multiple threads attempt to simultaneously initialize a <see cref="Lazy{T}"/> instance, this mode allows each thread to execute the 27/// valueFactory but only the first thread to complete initialization will be allowed to set the final value of the <see cref="Lazy{T}"/>. 31/// the valueFactory delegate re-executing. Also, if valueFactory recursively accesses Value on this <see cref="Lazy{T}"/> instance, an exception will NOT be thrown. 36/// This mode uses locks to ensure that only a single thread can initialize a <see cref="Lazy{T}"/> instance in a thread-safe manner. In general, 37/// taken if this mode is used in conjunction with a <see cref="Lazy{T}"/> valueFactory delegate that uses locks internally, a deadlock can occur if not 38/// handled carefully. If valueFactory throws an exception when the<see cref="Lazy{T}"/> is initialized, the exception will be cached and returned on 39/// subsequent accesses to Value. Also, if valueFactory recursively accesses Value on this <see cref="Lazy{T}"/> instance, a <see cref="InvalidOperationException"/> will be thrown.
System.Private.Windows.Core.TestUtilities (2)
XUnit\UseCultureAttribute.cs (2)
21private readonly Lazy<CultureInfo> _culture; 22private readonly Lazy<CultureInfo> _uiCulture;
System.Private.Xml (1)
System\Xml\Serialization\SourceInfo.cs (1)
25private static readonly Lazy<MethodInfo> s_iListGetItemMethod = new Lazy<MethodInfo>(
System.Reflection.Metadata (1)
System\Reflection\PortableExecutable\PEBuilder.cs (1)
18private readonly Lazy<ImmutableArray<Section>> _lazySections;
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net11.0\System.Runtime.Forwards.cs (1)
342[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Lazy<>))]
System.Security.Cryptography (7)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSslAvailable.cs (1)
14private static readonly Lazy<bool> s_openSslAvailable =
src\libraries\Common\src\System\Security\Cryptography\DSAOpenSsl.cs (1)
25private Lazy<SafeDsaHandle>? _key;
src\libraries\Common\src\System\Security\Cryptography\ECDiffieHellmanOpenSsl.cs (1)
12private Lazy<SafeEvpPKeyHandle>? _key;
src\libraries\Common\src\System\Security\Cryptography\ECDsaOpenSsl.cs (1)
18private Lazy<SafeEvpPKeyHandle>? _key;
src\libraries\Common\src\System\Security\Cryptography\ECOpenSsl.cs (1)
11private Lazy<SafeEcKeyHandle> _key = null!; // Always initialized
src\libraries\Common\src\System\Security\Cryptography\RSAOpenSsl.cs (1)
18private Lazy<SafeEvpPKeyHandle>? _key;
System\Security\Cryptography\X509Certificates\X500NameEncoder.cs (1)
33private static readonly Lazy<Dictionary<string, EncodingRules>> s_lazyEncodingRulesLookup = new(CreateEncodingRulesLookup);
System.ServiceModel.Http (1)
System\ServiceModel\Channels\HttpChannelFactory.cs (1)
41private Lazy<string> _webSocketSoapContentType;
System.ServiceModel.Primitives (1)
System\ServiceModel\Dispatcher\InvokerUtil.cs (1)
22private static readonly Lazy<bool> s_useLegacyInvokeDelegate = new Lazy<bool>(() =>
System.Threading.RateLimiting (7)
System\Threading\RateLimiting\DefaultPartitionedRateLimiter.cs (7)
19private readonly Dictionary<TKey, Lazy<RateLimiter>> _limiters; 26private readonly List<KeyValuePair<TKey, Lazy<RateLimiter>>> _cachedLimiters = new(); 45_limiters = new Dictionary<TKey, Lazy<RateLimiter>>(equalityComparer); 90Lazy<RateLimiter>? limiter; 128foreach (KeyValuePair<TKey, Lazy<RateLimiter>> limiter in _limiters) 163foreach (KeyValuePair<TKey, Lazy<RateLimiter>> limiter in _limiters) 228foreach (KeyValuePair<TKey, Lazy<RateLimiter>> rateLimiter in _cachedLimiters)
System.Windows.Forms.Primitives.TestUtilities (1)
PlatformDetection.cs (1)
29private static readonly Lazy<bool> s_largeArrayIsNotSupported = new(IsLargeArrayNotSupported);
System.Xaml (56)
System\Xaml\AttachablePropertyServices.cs (1)
120private Lazy<ConditionalWeakTable<object, Dictionary<AttachableMemberIdentifier, object>>> instanceStorage =
System\Xaml\XamlLanguage.cs (55)
55private static Lazy<XamlSchemaContext> s_schemaContext = 58private static Lazy<XamlType> s_array = 60private static Lazy<XamlType> s_null = 62private static Lazy<XamlType> s_reference = 64private static Lazy<XamlType> s_static = 66private static Lazy<XamlType> s_type = 68private static Lazy<XamlType> s_string = 70private static Lazy<XamlType> s_double = 72private static Lazy<XamlType> s_int32 = 74private static Lazy<XamlType> s_boolean = 76private static Lazy<XamlType> s_member = 78private static Lazy<XamlType> s_property = 80private static Lazy<XamlType> s_xDataHolder = 83private static Lazy<XamlType> s_object = 85private static Lazy<XamlType> s_listOfObject = 87private static Lazy<XamlType> s_listOfMembers = 89private static Lazy<XamlType> s_listOfAttributes = 92private static Lazy<XamlType> s_markupExtension = 94private static Lazy<XamlType> s_iNameScope = 96private static Lazy<XamlType> s_iXmlSerializable = 99private static Lazy<XamlType> s_positionalParameterDescriptor = 102private static Lazy<XamlType> s_char = 104private static Lazy<XamlType> s_single = 106private static Lazy<XamlType> s_byte = 108private static Lazy<XamlType> s_int16 = 110private static Lazy<XamlType> s_int64 = 112private static Lazy<XamlType> s_decimal = 114private static Lazy<XamlType> s_uri = 116private static Lazy<XamlType> s_timespan = 119private static Lazy<ReadOnlyCollection<XamlType>> s_allTypes = 122private static Lazy<XamlDirective> s_asyncRecords = 125private static Lazy<XamlDirective> s_arguments = 128private static Lazy<XamlDirective> s_class = 130private static Lazy<XamlDirective> s_classModifier = 132private static Lazy<XamlDirective> s_code = 134private static Lazy<XamlDirective> s_connectionId = 137private static Lazy<XamlDirective> s_factoryMethod = 140private static Lazy<XamlDirective> s_fieldModifier = 142private static Lazy<XamlDirective> s_items = 145private static Lazy<XamlDirective> s_initialization = 148private static Lazy<XamlDirective> s_key = 151private static Lazy<XamlDirective> s_members = 154private static Lazy<XamlDirective> s_classAttributes = 157private static Lazy<XamlDirective> s_name = 159private static Lazy<XamlDirective> s_positionalParameters = 162private static Lazy<XamlDirective> s_shared = 164private static Lazy<XamlDirective> s_subclass = 166private static Lazy<XamlDirective> s_synchronousMode = 168private static Lazy<XamlDirective> s_typeArguments = 170private static Lazy<XamlDirective> s_uid = 172private static Lazy<XamlDirective> s_unknownContent = 175private static Lazy<XamlDirective> s_base = 177private static Lazy<XamlDirective> s_lang = 179private static Lazy<XamlDirective> s_space = 182private static Lazy<ReadOnlyCollection<XamlDirective>> s_allDirectives =
Test.Utilities (15)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
Text.Analyzers (16)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
26private static readonly Lazy<Encoding> s_fallbackEncoding = new(CreateFallbackEncoding); 130Lazy<Encoding> getEncoding, 275internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded)
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (8)
31ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.Empty); 33private readonly Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? _globalOptions; 34private readonly ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> _perTreeOptions; 36private AggregateCategorizedAnalyzerConfigOptions(Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions, ImmutableDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>> perTreeOptions) 60Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>? globalOptions; 67var perTreeOptionsBuilder = PooledDictionary<SyntaxTree, Lazy<SyntaxTreeCategorizedAnalyzerConfigOptions>>.GetInstance(); 129return _perTreeOptions.TryGetValue(tree, out var lazyTreeOptions) &&
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
62private readonly Lazy<ImmutableArray<IAssemblySymbol>> _referencedAssemblies;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\StructuredAnalyzerConfigOptions.cs (1)
25private readonly Lazy<NamingStylePreferences> _lazyNamingStylePreferences;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (1)
23private readonly Lazy<ImmutableArray<Section>> _sections = new(() => Options.SelectAsArray(x => x.Section).Distinct());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
217=> compilation.GetTypeByMetadataName(typeof(Lazy<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Workspace\Mef\IMefHostExportProvider.cs (1)
13IEnumerable<Lazy<TExtension>> GetExports<TExtension>();
xunit.assert (4)
Sdk\AssertEqualityComparer.cs (1)
142 readonly Lazy<IEqualityComparer> innerComparer;
Sdk\AssertHelper.cs (3)
70 static readonly Lazy<TypeInfo?> fileSystemInfoTypeInfo = new Lazy<TypeInfo?>(() => Type.GetType(fileSystemInfoFqn)?.GetTypeInfo()); 71 static readonly Lazy<PropertyInfo?> fileSystemInfoFullNameProperty = new Lazy<PropertyInfo?>(() => Type.GetType(fileSystemInfoFqn)?.GetTypeInfo().GetDeclaredProperty("FullName")); 79 static readonly Lazy<Assembly[]> getAssemblies = new Lazy<Assembly[]>(() =>
xunit.console (4)
common\AssemblyResolution\DependencyContextAssemblyCache.cs (1)
29readonly Lazy<string> fallbackRuntimeIdentifier;
common\AssemblyResolution\Microsoft.DotNet.PlatformAbstractions\Native\PlatformApis.cs (2)
18private static readonly Lazy<Platform> _platform = new Lazy<Platform>(DetermineOSPlatform); 19private static readonly Lazy<DistroInfo> _distroInfo = new Lazy<DistroInfo>(LoadDistroInfo);
common\AssemblyResolution\Microsoft.Extensions.DependencyModel\DependencyContext.cs (1)
13private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);