/// <summary> /// Type initializer. Initialize the engine experimental feature list. /// </summary> static ExperimentalFeature() { // Initialize the readonly collection 'EngineExperimentalFeatures'. var engineFeatures = new ExperimentalFeature[] { /* Register engine experimental features here. Follow the same pattern as the example: * new ExperimentalFeature( * name: "PSFileSystemProviderV2", * description: "Replace the old FileSystemProvider with cleaner design and faster code"), */ new ExperimentalFeature( name: "PSImplicitRemotingBatching", description: "Batch implicit remoting proxy commands to improve performance"), new ExperimentalFeature( name: "PSCommandNotFoundSuggestion", description: "Recommend potential commands based on fuzzy search on a CommandNotFoundException"), new ExperimentalFeature( name: "PSForEachObjectParallel", description: "New parameter set for ForEach-Object to run script blocks in parallel"), new ExperimentalFeature( name: "PSTernaryOperator", description: "Support the ternary operator in PowerShell language"), new ExperimentalFeature( name: "PSErrorView", description: "New formatting for ErrorRecord"), new ExperimentalFeature( name: "PSUpdatesNotification", description: "Print notification message when new releases are available"), new ExperimentalFeature( name: "PSCoalescingOperators", description: "Support the null coalescing operator and null coalescing assignment operator in PowerShell language"), new ExperimentalFeature( name: "PSPipelineChainOperators", description: "Allow use of && and || as operators between pipeline invocations"), }; EngineExperimentalFeatures = new ReadOnlyCollection <ExperimentalFeature>(engineFeatures); // Initialize the readonly dictionary 'EngineExperimentalFeatureMap'. var engineExpFeatureMap = engineFeatures.ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase); EngineExperimentalFeatureMap = new ReadOnlyDictionary <string, ExperimentalFeature>(engineExpFeatureMap); // Initialize the readonly hashset 'EnabledExperimentalFeatureNames'. // The initialization of 'EnabledExperimentalFeatureNames' is deliberately made in the type initializer so that: // 1. 'EnabledExperimentalFeatureNames' can be declared as readonly; // 2. No need to deal with initialization from multiple threads; // 3. We don't need to decide where/when to read the config file for the enabled experimental features, // instead, it will be done when the type is used for the first time, which is always earlier than // any experimental features take effect. string[] enabledFeatures = Array.Empty <string>(); try { enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures(); } catch (Exception e) when(LogException(e)) { } EnabledExperimentalFeatureNames = ProcessEnabledFeatures(enabledFeatures); }
/// <summary> /// Type initializer. Initialize the engine experimental feature list. /// </summary> static ExperimentalFeature() { // Initialize the readonly collection 'EngineExperimentalFeatures'. var engineFeatures = new ExperimentalFeature[] { /* Register engine experimental features here. Follow the same pattern as the example: * new ExperimentalFeature( * name: "PSFileSystemProviderV2", * description: "Replace the old FileSystemProvider with cleaner design and faster code"), */ new ExperimentalFeature( name: "PSImplicitRemotingBatching", description: "Batch implicit remoting proxy commands to improve performance"), new ExperimentalFeature( name: "PSCommandNotFoundSuggestion", description: "Recommend potential commands based on fuzzy search on a CommandNotFoundException"), #if UNIX new ExperimentalFeature( name: "PSUnixFileStat", description: "Provide unix permission information for files and directories"), #endif new ExperimentalFeature( name: "PSNullConditionalOperators", description: "Support the null conditional member access operators in PowerShell language"), new ExperimentalFeature( name: "PSCultureInvariantReplaceOperator", description: "Use culture invariant to-string convertor for lval in replace operator"), new ExperimentalFeature( name: "PSNativePSPathResolution", description: "Convert PSPath to filesystem path, if possible, for native commands"), new ExperimentalFeature( name: "PSNotApplyErrorActionToStderr", description: "Don't have $ErrorActionPreference affect stderr output"), }; EngineExperimentalFeatures = new ReadOnlyCollection <ExperimentalFeature>(engineFeatures); // Initialize the readonly dictionary 'EngineExperimentalFeatureMap'. var engineExpFeatureMap = engineFeatures.ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase); EngineExperimentalFeatureMap = new ReadOnlyDictionary <string, ExperimentalFeature>(engineExpFeatureMap); // Initialize the readonly hashset 'EnabledExperimentalFeatureNames'. // The initialization of 'EnabledExperimentalFeatureNames' is deliberately made in the type initializer so that: // 1. 'EnabledExperimentalFeatureNames' can be declared as readonly; // 2. No need to deal with initialization from multiple threads; // 3. We don't need to decide where/when to read the config file for the enabled experimental features, // instead, it will be done when the type is used for the first time, which is always earlier than // any experimental features take effect. string[] enabledFeatures = Array.Empty <string>(); try { enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures(); } catch (Exception e) when(LogException(e)) { } EnabledExperimentalFeatureNames = ProcessEnabledFeatures(enabledFeatures); }
/// <summary> /// Type initializer. Initialize the engine experimental feature list. /// </summary> static ExperimentalFeature() { // Initialize the readonly collection 'EngineExperimentalFeatures'. var engineFeatures = new ExperimentalFeature[] { /* Register engine experimental features here. Follow the same pattern as the example: * new ExperimentalFeature( * name: "PSFileSystemProviderV2", * description: "Replace the old FileSystemProvider with cleaner design and faster code", * source: EngineSource, * isEnabled: false), */ new ExperimentalFeature( name: "PSImplicitRemotingBatching", description: "Batch implicit remoting proxy commands to improve performance", source: EngineSource, isEnabled: false), new ExperimentalFeature( name: "PSUseAbbreviationExpansion", description: "Allow tab completion of cmdlets and functions by abbreviation", source: EngineSource, isEnabled: false), new ExperimentalFeature( name: "PSTempDrive", description: "Create TEMP: PS Drive mapped to user's temporary directory path", source: EngineSource, isEnabled: false), }; EngineExperimentalFeatures = new ReadOnlyCollection <ExperimentalFeature>(engineFeatures); // Initialize the readonly dictionary 'EngineExperimentalFeatureMap'. var engineExpFeatureMap = engineFeatures.ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase); EngineExperimentalFeatureMap = new ReadOnlyDictionary <string, ExperimentalFeature>(engineExpFeatureMap); // Initialize the readonly hashset 'EnabledExperimentalFeatureNames'. // The initialization of 'EnabledExperimentalFeatureNames' is deliberately made in the type initializer so that: // 1. 'EnabledExperimentalFeatureNames' can be declared as readonly; // 2. No need to deal with initialization from multiple threads; // 3. We don't need to decide where/when to read the config file for the enabled experimental features, // instead, it will be done when the type is used for the first time, which is always earlier than // any experimental features take effect. string[] enabledFeatures = Utils.EmptyArray <string>(); try { enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures(); } catch (Exception e) when(LogException(e)) { } EnabledExperimentalFeatureNames = ProcessEnabledFeatures(enabledFeatures); }
/// <summary> /// Type initializer. Initialize the engine experimental feature list. /// </summary> static ExperimentalFeature() { // Initialize the readonly collection 'EngineExperimentalFeatures'. var engineFeatures = new ExperimentalFeature[] { /* Register engine experimental features here. Follow the same pattern as the example: * new ExperimentalFeature( * name: "PSFileSystemProviderV2", * description: "Replace the old FileSystemProvider with cleaner design and faster code"), */ new ExperimentalFeature( name: "PSImplicitRemotingBatching", description: "Batch implicit remoting proxy commands to improve performance"), new ExperimentalFeature( name: "PSCommandNotFoundSuggestion", description: "Recommend potential commands based on fuzzy search on a CommandNotFoundException"), }; EngineExperimentalFeatures = new ReadOnlyCollection <ExperimentalFeature>(engineFeatures); // Initialize the readonly dictionary 'EngineExperimentalFeatureMap'. var engineExpFeatureMap = engineFeatures.ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase); EngineExperimentalFeatureMap = new ReadOnlyDictionary <string, ExperimentalFeature>(engineExpFeatureMap); // Initialize the readonly hashset 'EnabledExperimentalFeatureNames'. // The initialization of 'EnabledExperimentalFeatureNames' is deliberately made in the type initializer so that: // 1. 'EnabledExperimentalFeatureNames' can be declared as readonly; // 2. No need to deal with initialization from multiple threads; // 3. We don't need to decide where/when to read the config file for the enabled experimental features, // instead, it will be done when the type is used for the first time, which is always earlier than // any experimental features take effect. string[] enabledFeatures = Array.Empty <string>(); try { enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures(); } catch (Exception e) when(LogException(e)) { } EnabledExperimentalFeatureNames = ProcessEnabledFeatures(enabledFeatures); }