From f3bf79f187c0fc60c7a136679a4569b783d6b0ea Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Fri, 20 Apr 2018 03:32:44 -0700 Subject: [PATCH 1/3] Clean up WorkflowInfo and CommandTypes.Workflow related code --- .../DefaultFormatters/HelpV3_format_ps1xml.cs | 54 ----------------- .../DefaultFormatters/Help_format_ps1xml.cs | 49 ++++++--------- .../engine/CmdletInfo.cs | 2 +- .../engine/CommandDiscovery.cs | 1 - .../engine/CommandSearcher.cs | 2 +- .../engine/CommonCommandParameters.cs | 34 +---------- .../engine/FunctionInfo.cs | 2 +- .../engine/GetCommandCommand.cs | 9 ++- .../engine/Modules/ModuleIntrinsics.cs | 16 +---- .../engine/Modules/ModuleUtils.cs | 10 ---- .../engine/MshCommandRuntime.cs | 2 +- .../engine/ParameterSetInfo.cs | 58 ++---------------- .../engine/SessionStateFunctionAPIs.cs | 5 -- .../engine/SessionStateScope.cs | 4 -- .../engine/WorkflowInfo.cs | 6 +- .../engine/debugger/debugger.cs | 34 +---------- .../help/DefaultCommandHelpObjectBuilder.cs | 60 ++++--------------- .../help/HelpCommentsParser.cs | 19 +----- .../resources/HelpDisplayStrings.resx | 16 ----- .../resources/Modules.resx | 3 - .../security/SecurityManager.cs | 1 - 21 files changed, 51 insertions(+), 336 deletions(-) diff --git a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/HelpV3_format_ps1xml.cs b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/HelpV3_format_ps1xml.cs index b29fb2c5dad..d1d5a16477b 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/HelpV3_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/HelpV3_format_ps1xml.cs @@ -254,19 +254,11 @@ private static IEnumerable ViewsOf_ExtendedCmdletHelpInfo( .EndEntry() .EndControl(); - var control6 = CustomControl.Create() - .StartEntry() - .AddText(StringUtil.Format("[{0}]", HelpDisplayStrings.CommonWorkflowParameters)) - .EndEntry() - .EndControl(); - var control5 = CustomControl.Create() .StartEntry() .AddPropertyExpressionBinding(@"name") .AddText(" ") .AddPropertyExpressionBinding(@"Parameter", enumerateCollection: true, customControl: sharedControls[1]) - .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.WorkflowCommonParameters -eq $true", customControl: control6) - .AddText(" ") .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.CommonParameters -eq $true", customControl: control7) .AddNewline() .AddNewline() @@ -340,18 +332,6 @@ private static IEnumerable ViewsOf_ExtendedCmdletHelpInfo_ .EndEntry() .EndControl(); - var control15 = CustomControl.Create() - .StartEntry() - .AddText(HelpDisplayStrings.CommonWorkflowParameters) - .AddNewline() - .StartFrame(leftIndent: 4) - .AddText(HelpDisplayStrings.BaseWorkflowCmdletInformation) - .EndFrame() - .AddNewline() - .AddNewline() - .EndEntry() - .EndControl(); - var control14 = CustomControl.Create() .StartEntry() .AddText("-") @@ -376,21 +356,11 @@ private static IEnumerable ViewsOf_ExtendedCmdletHelpInfo_ .EndEntry() .EndControl(); - var control11 = CustomControl.Create() - .StartEntry() - .AddText("[") - .AddText(HelpDisplayStrings.CommonWorkflowParameters) - .AddText("]") - .EndEntry() - .EndControl(); - var control10 = CustomControl.Create() .StartEntry() .AddPropertyExpressionBinding(@"name") .AddText(" ") .AddPropertyExpressionBinding(@"Parameter", enumerateCollection: true, customControl: sharedControls[1]) - .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.WorkflowCommonParameters -eq $true", customControl: control11) - .AddText(" ") .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.CommonParameters -eq $true", customControl: control12) .AddNewline() .AddNewline() @@ -429,7 +399,6 @@ private static IEnumerable ViewsOf_ExtendedCmdletHelpInfo_ .AddNewline() .StartFrame(leftIndent: 4) .AddPropertyExpressionBinding(@"Parameters", customControl: control13) - .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.WorkflowCommonParameters -eq $true", customControl: control15) .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.CommonParameters -eq $true", customControl: control16) .AddScriptBlockExpressionBinding(@" ", selectedByScript: "($_.CommonParameters -eq $false) -and ($_.parameters.parameter.count -eq 0)", customControl: control17) .EndFrame() @@ -499,18 +468,6 @@ private static IEnumerable ViewsOf_ExtendedCmdletHelpInfo_ .EndEntry() .EndControl(); - var control29 = CustomControl.Create() - .StartEntry() - .AddText(HelpDisplayStrings.CommonWorkflowParameters) - .AddNewline() - .StartFrame(leftIndent: 4) - .AddText(HelpDisplayStrings.BaseWorkflowCmdletInformation) - .EndFrame() - .AddNewline() - .AddNewline() - .EndEntry() - .EndControl(); - var control28 = CustomControl.Create() .StartEntry() .AddText(HelpDisplayStrings.NamedParameter) @@ -584,21 +541,11 @@ private static IEnumerable ViewsOf_ExtendedCmdletHelpInfo_ .EndEntry() .EndControl(); - var control21 = CustomControl.Create() - .StartEntry() - .AddText("[") - .AddText(HelpDisplayStrings.CommonWorkflowParameters) - .AddText("]") - .EndEntry() - .EndControl(); - var control20 = CustomControl.Create() .StartEntry() .AddPropertyExpressionBinding(@"name") .AddText(" ") .AddPropertyExpressionBinding(@"Parameter", enumerateCollection: true, customControl: sharedControls[1]) - .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.WorkflowCommonParameters -eq $true", customControl: control21) - .AddText(" ") .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.CommonParameters -eq $true", customControl: control22) .AddNewline() .AddNewline() @@ -637,7 +584,6 @@ private static IEnumerable ViewsOf_ExtendedCmdletHelpInfo_ .AddNewline() .StartFrame(leftIndent: 4) .AddPropertyExpressionBinding(@"Parameters", customControl: control23) - .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.WorkflowCommonParameters -eq $true", customControl: control29) .AddScriptBlockExpressionBinding(@" ", selectedByScript: "$_.CommonParameters -eq $true", customControl: control30) .AddScriptBlockExpressionBinding(@" ", selectedByScript: "($_.CommonParameters -eq $false) -and ($_.parameters.parameter.count -eq 0)", customControl: control31) .AddNewline() diff --git a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/Help_format_ps1xml.cs b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/Help_format_ps1xml.cs index e9f8842ee9a..42fb408a116 100644 --- a/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/Help_format_ps1xml.cs +++ b/src/System.Management.Automation/FormatAndOutput/DefaultFormatters/Help_format_ps1xml.cs @@ -140,16 +140,6 @@ internal static IEnumerable GetFormatData() .EndEntry() .EndControl(); - var CommonWorkflowParametersControl = CustomControl.Create() - .StartEntry() - .AddScriptBlockExpressionBinding(StringUtil.Format(@"$wfp = $_.psobject.Properties['WorkflowCommonParameters'] -if ($null -ne $wfp -and $wfp.Value) -{{ - '[{0}] ' -}}", HelpDisplayStrings.CommonWorkflowParameters)) - .EndEntry() - .EndControl(); - var RelatedLinksHelpInfoControl = CustomControl.Create() .StartEntry() .StartFrame(leftIndent: 4) @@ -270,7 +260,6 @@ internal static IEnumerable GetFormatData() .AddPropertyExpressionBinding(@"name") .AddText(" ") .AddPropertyExpressionBinding(@"Parameter", enumerateCollection: true, customControl: MamlParameterControl) - .AddCustomControlExpressionBinding(CommonWorkflowParametersControl) .AddText("[" + HelpDisplayStrings.CommonParameters + "]") .AddNewline(2) .EndEntry() @@ -413,7 +402,6 @@ internal static IEnumerable GetFormatData() MamlPossibleValueControl, MamlTrueFalseShortControl, MamlIndentedSyntaxControl, - CommonWorkflowParametersControl, MamlSyntaxControl, MamlTypeWithDescriptionControl, RelatedLinksHelpInfoControl, @@ -578,7 +566,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo(Cus .AddText(HelpDisplayStrings.RelatedLinks) .AddNewline() .StartFrame(leftIndent: 4) - .AddPropertyExpressionBinding(@"relatedLinks", customControl: sharedControls[20]) + .AddPropertyExpressionBinding(@"relatedLinks", customControl: sharedControls[19]) .EndFrame() .AddNewline() .AddText(HelpDisplayStrings.RemarksSection) @@ -597,7 +585,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo(Cus .AddScriptBlockExpressionBinding(@"""get-help "" + $_.Details.Name + "" -full""") .AddText(@""".") .AddNewline() - .AddCustomControlExpressionBinding(sharedControls[19]) + .AddCustomControlExpressionBinding(sharedControls[18]) .EndFrame() .EndEntry() .EndControl()); @@ -634,7 +622,6 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Det .AddNewline() .StartFrame(leftIndent: 4) .AddPropertyExpressionBinding(@"Parameters", customControl: control9) - .AddCustomControlExpressionBinding(sharedControls[16]) .AddText(HelpDisplayStrings.CommonParameters) .AddNewline() .StartFrame(leftIndent: 4) @@ -664,7 +651,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Det .AddScriptBlockExpressionBinding(@"""get-help "" + $_.Details.Name + "" -full""") .AddText(@""".") .AddNewline() - .AddCustomControlExpressionBinding(sharedControls[19]) + .AddCustomControlExpressionBinding(sharedControls[18]) .EndFrame() .EndEntry() .EndControl()); @@ -711,7 +698,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Ful .AddText(HelpDisplayStrings.NonHyphenTerminatingErrors) .AddNewline() .StartFrame(leftIndent: 4) - .AddPropertyExpressionBinding(@"nonTerminatingError", enumerateCollection: true, customControl: sharedControls[21]) + .AddPropertyExpressionBinding(@"nonTerminatingError", enumerateCollection: true, customControl: sharedControls[20]) .EndFrame() .EndEntry() .EndControl(); @@ -721,20 +708,20 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Ful .AddText(HelpDisplayStrings.TerminatingErrors) .AddNewline() .StartFrame(leftIndent: 4) - .AddPropertyExpressionBinding(@"terminatingError", enumerateCollection: true, customControl: sharedControls[21]) + .AddPropertyExpressionBinding(@"terminatingError", enumerateCollection: true, customControl: sharedControls[20]) .EndFrame() .EndEntry() .EndControl(); var control12 = CustomControl.Create() .StartEntry() - .AddPropertyExpressionBinding(@"ReturnValue", enumerateCollection: true, customControl: sharedControls[18]) + .AddPropertyExpressionBinding(@"ReturnValue", enumerateCollection: true, customControl: sharedControls[17]) .EndEntry() .EndControl(); var control11 = CustomControl.Create() .StartEntry() - .AddPropertyExpressionBinding(@"InputType", enumerateCollection: true, customControl: sharedControls[18]) + .AddPropertyExpressionBinding(@"InputType", enumerateCollection: true, customControl: sharedControls[17]) .EndEntry() .EndControl(); @@ -747,7 +734,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Ful .AddText(HelpDisplayStrings.Parameters) .AddNewline() .StartFrame(leftIndent: 4) - .AddPropertyExpressionBinding(@"Parameters", customControl: sharedControls[23]) + .AddPropertyExpressionBinding(@"Parameters", customControl: sharedControls[22]) .EndFrame() .AddText(HelpDisplayStrings.InputType) .AddNewline() @@ -778,7 +765,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Ful .AddText(HelpDisplayStrings.RelatedLinks) .AddNewline() .StartFrame(leftIndent: 4) - .AddPropertyExpressionBinding(@"relatedLinks", customControl: sharedControls[20]) + .AddPropertyExpressionBinding(@"relatedLinks", customControl: sharedControls[19]) .EndFrame() .EndEntry() .EndControl()); @@ -946,7 +933,7 @@ private static IEnumerable ViewsOf_ProviderHelpInfo(Custom .AddText(HelpDisplayStrings.RelatedLinks) .AddNewline() .StartFrame(leftIndent: 4) - .AddPropertyExpressionBinding(@"relatedLinks", customControl: sharedControls[20]) + .AddPropertyExpressionBinding(@"relatedLinks", customControl: sharedControls[19]) .EndFrame() .EndEntry() .EndControl()); @@ -1085,7 +1072,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Par CustomControl.Create() .StartEntry() .StartFrame(leftIndent: 4) - .AddCustomControlExpressionBinding(sharedControls[23]) + .AddCustomControlExpressionBinding(sharedControls[22]) .EndFrame() .EndEntry() .EndControl()); @@ -1096,7 +1083,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Par yield return new FormatViewDefinition("MamlCommandParameterView", CustomControl.Create() .StartEntry() - .AddScriptBlockExpressionBinding(@"$_", customControl: sharedControls[22]) + .AddScriptBlockExpressionBinding(@"$_", customControl: sharedControls[21]) .EndEntry() .EndControl()); } @@ -1106,7 +1093,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_Syn yield return new FormatViewDefinition("MamlCommandSyntax", CustomControl.Create() .StartEntry() - .AddScriptBlockExpressionBinding(@"$_", customControl: sharedControls[17]) + .AddScriptBlockExpressionBinding(@"$_", customControl: sharedControls[16]) .EndEntry() .EndControl()); } @@ -1126,7 +1113,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_inp yield return new FormatViewDefinition("MamlInputTypes", CustomControl.Create() .StartEntry() - .AddPropertyExpressionBinding(@"InputType", enumerateCollection: true, customControl: sharedControls[18]) + .AddPropertyExpressionBinding(@"InputType", enumerateCollection: true, customControl: sharedControls[17]) .EndEntry() .EndControl()); } @@ -1136,7 +1123,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_non yield return new FormatViewDefinition("MamlNonTerminatingErrors", CustomControl.Create() .StartEntry() - .AddPropertyExpressionBinding(@"nonTerminatingError", enumerateCollection: true, customControl: sharedControls[21]) + .AddPropertyExpressionBinding(@"nonTerminatingError", enumerateCollection: true, customControl: sharedControls[20]) .EndEntry() .EndControl()); } @@ -1146,7 +1133,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_ter yield return new FormatViewDefinition("MamlTerminatingErrors", CustomControl.Create() .StartEntry() - .AddPropertyExpressionBinding(@"terminatingError", enumerateCollection: true, customControl: sharedControls[21]) + .AddPropertyExpressionBinding(@"terminatingError", enumerateCollection: true, customControl: sharedControls[20]) .EndEntry() .EndControl()); } @@ -1156,7 +1143,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_rel yield return new FormatViewDefinition("MamlRelatedLinks", CustomControl.Create() .StartEntry() - .AddScriptBlockExpressionBinding(@"$_", customControl: sharedControls[20]) + .AddScriptBlockExpressionBinding(@"$_", customControl: sharedControls[19]) .EndEntry() .EndControl()); } @@ -1166,7 +1153,7 @@ private static IEnumerable ViewsOf_MamlCommandHelpInfo_ret yield return new FormatViewDefinition("MamlReturnTypes", CustomControl.Create() .StartEntry() - .AddPropertyExpressionBinding(@"ReturnValue", enumerateCollection: true, customControl: sharedControls[18]) + .AddPropertyExpressionBinding(@"ReturnValue", enumerateCollection: true, customControl: sharedControls[17]) .EndEntry() .EndControl()); } diff --git a/src/System.Management.Automation/engine/CmdletInfo.cs b/src/System.Management.Automation/engine/CmdletInfo.cs index b12c2a87195..8cba81f5ed6 100644 --- a/src/System.Management.Automation/engine/CmdletInfo.cs +++ b/src/System.Management.Automation/engine/CmdletInfo.cs @@ -297,7 +297,7 @@ public override string Definition _verb, StringLiterals.CommandVerbNounSeparator, _noun, - parameterSet.ToString((this.CommandType & CommandTypes.Workflow) == CommandTypes.Workflow))); + parameterSet.ToString())); } } else diff --git a/src/System.Management.Automation/engine/CommandDiscovery.cs b/src/System.Management.Automation/engine/CommandDiscovery.cs index 0c601330f9a..1b661569ad9 100644 --- a/src/System.Management.Automation/engine/CommandDiscovery.cs +++ b/src/System.Management.Automation/engine/CommandDiscovery.cs @@ -651,7 +651,6 @@ internal CommandProcessorBase LookupCommandProcessor(CommandInfo commandInfo, break; case CommandTypes.Filter: case CommandTypes.Function: - case CommandTypes.Workflow: case CommandTypes.Configuration: FunctionInfo functionInfo = (FunctionInfo)commandInfo; processor = CreateCommandProcessorForScript(functionInfo, Context, useLocalScope ?? true, sessionState); diff --git a/src/System.Management.Automation/engine/CommandSearcher.cs b/src/System.Management.Automation/engine/CommandSearcher.cs index d585dd004d1..570d4bb6cd9 100644 --- a/src/System.Management.Automation/engine/CommandSearcher.cs +++ b/src/System.Management.Automation/engine/CommandSearcher.cs @@ -268,7 +268,7 @@ private CommandInfo SearchForFunctions() CommandInfo currentMatch = null; if (_context.EngineSessionState != null && - (_commandTypes & (CommandTypes.Function | CommandTypes.Filter | CommandTypes.Workflow | CommandTypes.Configuration)) != 0) + (_commandTypes & (CommandTypes.Function | CommandTypes.Filter | CommandTypes.Configuration)) != 0) { currentMatch = GetNextFunction(); } diff --git a/src/System.Management.Automation/engine/CommonCommandParameters.cs b/src/System.Management.Automation/engine/CommonCommandParameters.cs index 5de830fa3bb..819e7d1fb92 100644 --- a/src/System.Management.Automation/engine/CommonCommandParameters.cs +++ b/src/System.Management.Automation/engine/CommonCommandParameters.cs @@ -35,40 +35,8 @@ internal CommonParameters(MshCommandRuntime commandRuntime) } _commandRuntime = commandRuntime; } // ctor - #endregion ctor - - internal static string[] CommonWorkflowParameters = { "PSComputerName", "JobName", "PSApplicationName", "PSCredential", "PSPort", "PSConfigurationName", - "PSConnectionURI", "PSSessionOption", "PSAuthentication", "PSAuthenticationLevel", "PSCertificateThumbprint", - "PSConnectionRetryCount", "PSConnectionRetryIntervalSec", "PSRunningTimeoutSec", "PSElapsedTimeoutSec", - "PSPersist", "PSPrivateMetadata", "InputObject", "PSParameterCollection", - "AsJob", "PSUseSSL", "PSAllowRedirection" }; -#if !CORECLR // Workflow Not Supported On CSS - internal static Type[] CommonWorkflowParameterTypes = { - /* PSComputerName */ typeof(string[]), - /* JobName */ typeof(string), - /* PSApplicationName */ typeof(string), - /* PSCredential */ typeof(PSCredential), - /* PSPort */ typeof(uint), - /* PSConfigurationName */ typeof(string), - /* PSConnectionURI */ typeof(string[]), - /* PSSessionOption */ typeof(PSSessionOption), - /* PSAuthentication */ typeof(AuthenticationMechanism), - /* PSAuthenticationLevel */ typeof(AuthenticationLevel), - /* PSCertificateThumbprint */ typeof(string), - /* PSConnectionRetryCount */ typeof(uint), - /* PSConnectionRetryIntervalSec */ typeof(uint), - /* ??? PSRunningTimeoutSec */ typeof(int), - /* ??? PSElapsedTimeoutSec */ typeof(int), - /* PSPersist */ typeof(bool), - /* ??? PSPrivateMetadata */ typeof(object), - /* ??? InputObject */ typeof(object), - /* ??? PSParameterCollection */ typeof(Hashtable), - /* AsJob */ typeof(bool), - /* PSUseSSL */ typeof(bool), - /* PSAllowRedirection */ typeof(bool), - }; -#endif + #endregion ctor #region parameters diff --git a/src/System.Management.Automation/engine/FunctionInfo.cs b/src/System.Management.Automation/engine/FunctionInfo.cs index 2414c20090d..2778000fd57 100644 --- a/src/System.Management.Automation/engine/FunctionInfo.cs +++ b/src/System.Management.Automation/engine/FunctionInfo.cs @@ -484,7 +484,7 @@ internal override string Syntax Globalization.CultureInfo.CurrentCulture, "{0} {1}", Name, - parameterSet.ToString((this.CommandType & CommandTypes.Workflow) == CommandTypes.Workflow))); + parameterSet.ToString())); } return synopsis.ToString(); diff --git a/src/System.Management.Automation/engine/GetCommandCommand.cs b/src/System.Management.Automation/engine/GetCommandCommand.cs index 4c0f522ccd6..7796a665f48 100644 --- a/src/System.Management.Automation/engine/GetCommandCommand.cs +++ b/src/System.Management.Automation/engine/GetCommandCommand.cs @@ -574,7 +574,7 @@ public int Compare(CommandInfo x, CommandInfo y) private void AccumulateMatchingCmdlets() { - _commandType = CommandTypes.Cmdlet | CommandTypes.Function | CommandTypes.Filter | CommandTypes.Alias | CommandTypes.Workflow | CommandTypes.Configuration; + _commandType = CommandTypes.Cmdlet | CommandTypes.Function | CommandTypes.Filter | CommandTypes.Alias | CommandTypes.Configuration; Collection commandNames = new Collection(); commandNames.Add("*"); @@ -683,7 +683,7 @@ private void AccumulateMatchingCommands(IEnumerable commandNames) options |= SearchResolutionOptions.ResolveAliasPatterns; } - if ((this.CommandType & (CommandTypes.Function | CommandTypes.Filter | CommandTypes.Workflow | CommandTypes.Configuration)) != 0) + if ((this.CommandType & (CommandTypes.Function | CommandTypes.Filter | CommandTypes.Configuration)) != 0) { options |= SearchResolutionOptions.ResolveFunctionPatterns; } @@ -1108,14 +1108,13 @@ private bool IsCommandMatch(ref CommandInfo current, out bool isDuplicate) isCommandMatch = true; } - // If the command in question is a cmdlet or (a function/filter/workflow/configuration/alias and we are filtering on nouns or verbs), - // then do the verb/moun check + // If the command in question is a cmdlet or (a function/filter/configuration/alias and we are filtering on nouns or verbs), + // then do the verb/noun check if (current.CommandType == CommandTypes.Cmdlet || ((_verbs.Length > 0 || _nouns.Length > 0) && (current.CommandType == CommandTypes.Function || current.CommandType == CommandTypes.Filter || - current.CommandType == CommandTypes.Workflow || current.CommandType == CommandTypes.Configuration || current.CommandType == CommandTypes.Alias))) { diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index 8b754371749..93a97302560 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -1166,24 +1166,12 @@ internal static void ExportModuleMembers(PSCmdlet cmdlet, SessionStateInternal s if (SessionStateUtilities.MatchesAnyWildcardPattern(entry.Key, functionPatterns, false)) { - string message; - - if (entry.Value.CommandType == CommandTypes.Workflow) - { - message = StringUtil.Format(Modules.ExportingWorkflow, entry.Key); - sessionState.ExportedWorkflows.Add((WorkflowInfo)entry.Value); - } - else - { - message = StringUtil.Format(Modules.ExportingFunction, entry.Key); - sessionState.ExportedFunctions.Add(entry.Value); - } - + sessionState.ExportedFunctions.Add(entry.Value); + string message = StringUtil.Format(Modules.ExportingFunction, entry.Key); cmdlet.WriteVerbose(message); } } SortAndRemoveDuplicates(sessionState.ExportedFunctions, delegate (FunctionInfo ci) { return ci.Name; }); - SortAndRemoveDuplicates(sessionState.ExportedWorkflows, delegate (WorkflowInfo ci) { return ci.Name; }); } if (cmdletPatterns != null) diff --git a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs index c3203888516..8556c742676 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs @@ -372,9 +372,6 @@ internal static IEnumerable GetMatchingCommands(string pattern, Exe case CommandTypes.Alias: current = new AliasInfo(entry.Value.Name, null, context); break; - case CommandTypes.Workflow: - current = new WorkflowInfo(entry.Value.Name, ScriptBlock.EmptyScriptBlock, context); - break; case CommandTypes.Function: current = new FunctionInfo(entry.Value.Name, ScriptBlock.EmptyScriptBlock, context); break; @@ -484,13 +481,6 @@ internal static IEnumerable GetMatchingCommands(string pattern, Exe Module = tempModuleInfo }; } - if ((commandTypes & CommandTypes.Workflow) == CommandTypes.Workflow) - { - yield return new WorkflowInfo(commandName, ScriptBlock.EmptyScriptBlock, context) - { - Module = tempModuleInfo - }; - } } } } diff --git a/src/System.Management.Automation/engine/MshCommandRuntime.cs b/src/System.Management.Automation/engine/MshCommandRuntime.cs index 36b7a484913..90ddd5927a3 100644 --- a/src/System.Management.Automation/engine/MshCommandRuntime.cs +++ b/src/System.Management.Automation/engine/MshCommandRuntime.cs @@ -3210,7 +3210,7 @@ internal ActionPreference ErrorAction } set { - if ((!(_commandInfo is WorkflowInfo)) && (value == ActionPreference.Suspend)) + if (value == ActionPreference.Suspend) { throw PSTraceSource.NewNotSupportedException(ErrorPackage.SuspendActionPreferenceSupportedOnlyOnWorkflow); } diff --git a/src/System.Management.Automation/engine/ParameterSetInfo.cs b/src/System.Management.Automation/engine/ParameterSetInfo.cs index bcbbc31f6b7..ddfd4c3a3a9 100644 --- a/src/System.Management.Automation/engine/ParameterSetInfo.cs +++ b/src/System.Management.Automation/engine/ParameterSetInfo.cs @@ -94,24 +94,11 @@ internal CommandParameterSetInfo( /// Gets the synopsis for the cmdlet as a string /// public override string ToString() - { - return ToString(false); - } - - /// - /// - /// - /// - /// This boolean is used to suppress common workflow parameters (or) display - /// them separately towards the end - /// - /// - internal string ToString(bool isCapabilityWorkflow) { Text.StringBuilder result = new Text.StringBuilder(); - GenerateParametersInDisplayOrder(isCapabilityWorkflow, - parameter => AppendFormatCommandParameterInfo(parameter, ref result), + GenerateParametersInDisplayOrder( + parameter => AppendFormatCommandParameterInfo(parameter, result), delegate (string str) { if (result.Length > 0) @@ -136,14 +123,10 @@ internal string ToString(bool isCapabilityWorkflow) /// to handle /// syntax generation etc. /// - /// - /// This boolean is used to suppress common workflow parameters (or) display - /// them separately towards the end - /// /// /// /// - internal void GenerateParametersInDisplayOrder(bool isCapabilityWorkflow, + internal void GenerateParametersInDisplayOrder( Action parameterAction, Action commonParameterAction) { @@ -187,9 +170,6 @@ internal void GenerateParametersInDisplayOrder(bool isCapabilityWorkflow, } } - // Now convert the sorted positional parameters into a string - List commonWorkflowParameter = new List(); - foreach (CommandParameterInfo parameter in sortedPositionalParameters) { if (parameter == null) @@ -197,14 +177,7 @@ internal void GenerateParametersInDisplayOrder(bool isCapabilityWorkflow, continue; } - if (!Internal.CommonParameters.CommonWorkflowParameters.Contains(parameter.Name, StringComparer.OrdinalIgnoreCase) || !isCapabilityWorkflow) - { - parameterAction(parameter); - } - else - { - commonWorkflowParameter.Add(parameter); - } + parameterAction(parameter); } // Now convert the named mandatory parameters into a string @@ -232,14 +205,7 @@ internal void GenerateParametersInDisplayOrder(bool isCapabilityWorkflow, bool isCommon = Cmdlet.CommonParameters.Contains(parameter.Name, StringComparer.OrdinalIgnoreCase); if (!isCommon) { - if (!Internal.CommonParameters.CommonWorkflowParameters.Contains(parameter.Name, StringComparer.OrdinalIgnoreCase) || !isCapabilityWorkflow) - { - parameterAction(parameter); - } - else - { - commonWorkflowParameter.Add(parameter); - } + parameterAction(parameter); } else { @@ -247,18 +213,6 @@ internal void GenerateParametersInDisplayOrder(bool isCapabilityWorkflow, } } - if (commonWorkflowParameter.Count == Internal.CommonParameters.CommonWorkflowParameters.Length) - { - commonParameterAction(HelpDisplayStrings.CommonWorkflowParameters); - } - else - { - foreach (CommandParameterInfo parameter in commonWorkflowParameter) - { - parameterAction(parameter); - } - } - // If all common parameters are present, group them together if (commonParameters.Count == Cmdlet.CommonParameters.Count) { @@ -278,7 +232,7 @@ internal void GenerateParametersInDisplayOrder(bool isCapabilityWorkflow, #region private members - private static void AppendFormatCommandParameterInfo(CommandParameterInfo parameter, ref Text.StringBuilder result) + private static void AppendFormatCommandParameterInfo(CommandParameterInfo parameter, Text.StringBuilder result) { if (result.Length > 0) { diff --git a/src/System.Management.Automation/engine/SessionStateFunctionAPIs.cs b/src/System.Management.Automation/engine/SessionStateFunctionAPIs.cs index b7c92b7587b..bac263bdcad 100644 --- a/src/System.Management.Automation/engine/SessionStateFunctionAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateFunctionAPIs.cs @@ -109,11 +109,6 @@ internal IDictionary GetFunctionTableAtScope(string scopeI /// internal List ExportedFunctions { get; } = new List(); - /// - /// List of workflows to export from this session state object... - /// - internal List ExportedWorkflows { get; } = new List(); - internal bool UseExportList { get; set; } = false; /// diff --git a/src/System.Management.Automation/engine/SessionStateScope.cs b/src/System.Management.Automation/engine/SessionStateScope.cs index e542da6480f..de2d55ad95a 100644 --- a/src/System.Management.Automation/engine/SessionStateScope.cs +++ b/src/System.Management.Automation/engine/SessionStateScope.cs @@ -1826,10 +1826,6 @@ private static FunctionInfo CreateFunction(string name, ScriptBlock function, Fu { newValue = new FilterInfo(name, (FilterInfo)originalFunction); } - else if (originalFunction is WorkflowInfo) - { - newValue = new WorkflowInfo(name, (WorkflowInfo)originalFunction); - } else if (originalFunction is ConfigurationInfo) { newValue = new ConfigurationInfo(name, (ConfigurationInfo)originalFunction); diff --git a/src/System.Management.Automation/engine/WorkflowInfo.cs b/src/System.Management.Automation/engine/WorkflowInfo.cs index 29122721485..225dc8287f8 100644 --- a/src/System.Management.Automation/engine/WorkflowInfo.cs +++ b/src/System.Management.Automation/engine/WorkflowInfo.cs @@ -8,7 +8,7 @@ namespace System.Management.Automation /// /// Provides information about a workflow that is stored in session state. /// - public class WorkflowInfo : FunctionInfo + internal class WorkflowInfo : FunctionInfo { #region ctor @@ -39,7 +39,7 @@ public class WorkflowInfo : FunctionInfo /// /// If is null. /// - public WorkflowInfo(string name, string definition, ScriptBlock workflow, string xamlDefinition, WorkflowInfo[] workflowsCalled) + internal WorkflowInfo(string name, string definition, ScriptBlock workflow, string xamlDefinition, WorkflowInfo[] workflowsCalled) : this(name, workflow, (ExecutionContext)null) { if (string.IsNullOrEmpty(xamlDefinition)) @@ -77,7 +77,7 @@ public WorkflowInfo(string name, string definition, ScriptBlock workflow, string /// /// If is null. /// - public WorkflowInfo(string name, string definition, ScriptBlock workflow, string xamlDefinition, WorkflowInfo[] workflowsCalled, PSModuleInfo module) + internal WorkflowInfo(string name, string definition, ScriptBlock workflow, string xamlDefinition, WorkflowInfo[] workflowsCalled, PSModuleInfo module) : this(name, definition, workflow, xamlDefinition, workflowsCalled) { this.Module = module; diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 034612b9397..14bdc48b26a 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -2971,7 +2971,7 @@ private void AddToJobRunningList(PSJobStartEventArgs jobArgs, DebuggerResumeActi startAction, _context.EngineHostInterface.ExternalHost, _context.SessionState.Path.CurrentLocation, - GetFunctionToSourceMap()); + new Dictionary()); } else { @@ -3022,38 +3022,6 @@ private void SetRunspaceListToStep(bool enableStepping) } } - private Dictionary GetFunctionToSourceMap() - { - Dictionary fnToSource = new Dictionary(); - - // Get workflow function source information for workflow debugger. - Collection items = _context.SessionState.InvokeProvider.Item.Get("function:\\*"); - foreach (var item in items) - { - var funcItem = item.BaseObject as WorkflowInfo; - if ((funcItem != null) && - (!string.IsNullOrEmpty(funcItem.Name))) - { - if ((funcItem.Module != null) && (funcItem.Module.Path != null)) - { - string scriptFile = funcItem.Module.Path; - string scriptSource = GetFunctionSource(scriptFile); - if (scriptSource != null) - { - fnToSource.Add( - funcItem.Name, - new DebugSource( - scriptSource, - scriptFile, - funcItem.XamlDefinition)); - } - } - } - } - - return fnToSource; - } - private string GetFunctionSource( string scriptFile) { diff --git a/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs b/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs index f71660a37ff..130127c481e 100644 --- a/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs +++ b/src/System.Management.Automation/help/DefaultCommandHelpObjectBuilder.cs @@ -68,18 +68,15 @@ internal static PSObject GetPSObjectFromCmdletInfo(CommandInfo input) { CmdletInfo cmdletInfo = commandInfo as CmdletInfo; bool common = false; - bool commonWorkflow = false; if (cmdletInfo.Parameters != null) { common = HasCommonParameters(cmdletInfo.Parameters); - commonWorkflow = ((cmdletInfo.CommandType & CommandTypes.Workflow) == CommandTypes.Workflow); } obj.Properties.Add(new PSNoteProperty("CommonParameters", common)); - obj.Properties.Add(new PSNoteProperty("WorkflowCommonParameters", commonWorkflow)); AddDetailsProperties(obj, cmdletInfo.Name, cmdletInfo.Noun, cmdletInfo.Verb, TypeNameForDefaultHelp); - AddSyntaxProperties(obj, cmdletInfo.Name, cmdletInfo.ParameterSets, common, commonWorkflow, TypeNameForDefaultHelp); - AddParametersProperties(obj, cmdletInfo.Parameters, common, commonWorkflow, TypeNameForDefaultHelp); + AddSyntaxProperties(obj, cmdletInfo.Name, cmdletInfo.ParameterSets, common, TypeNameForDefaultHelp); + AddParametersProperties(obj, cmdletInfo.Parameters, common, TypeNameForDefaultHelp); AddInputTypesProperties(obj, cmdletInfo.Parameters); AddRelatedLinksProperties(obj, commandInfo.CommandMetadata.HelpUri); @@ -109,13 +106,11 @@ internal static PSObject GetPSObjectFromCmdletInfo(CommandInfo input) { FunctionInfo funcInfo = commandInfo as FunctionInfo; bool common = HasCommonParameters(funcInfo.Parameters); - bool commonWorkflow = ((commandInfo.CommandType & CommandTypes.Workflow) == CommandTypes.Workflow); obj.Properties.Add(new PSNoteProperty("CommonParameters", common)); - obj.Properties.Add(new PSNoteProperty("WorkflowCommonParameters", commonWorkflow)); AddDetailsProperties(obj, funcInfo.Name, String.Empty, String.Empty, TypeNameForDefaultHelp); - AddSyntaxProperties(obj, funcInfo.Name, funcInfo.ParameterSets, common, commonWorkflow, TypeNameForDefaultHelp); - AddParametersProperties(obj, funcInfo.Parameters, common, commonWorkflow, TypeNameForDefaultHelp); + AddSyntaxProperties(obj, funcInfo.Name, funcInfo.ParameterSets, common, TypeNameForDefaultHelp); + AddParametersProperties(obj, funcInfo.Parameters, common, TypeNameForDefaultHelp); AddInputTypesProperties(obj, funcInfo.Parameters); AddRelatedLinksProperties(obj, funcInfo.CommandMetadata.HelpUri); @@ -194,16 +189,15 @@ internal static void AddDetailsProperties(PSObject obj, string name, string noun /// command name /// parameter sets /// common parameters - /// common workflow parameters /// type name for help - internal static void AddSyntaxProperties(PSObject obj, string cmdletName, ReadOnlyCollection parameterSets, bool common, bool commonWorkflow, string typeNameForHelp) + internal static void AddSyntaxProperties(PSObject obj, string cmdletName, ReadOnlyCollection parameterSets, bool common, string typeNameForHelp) { PSObject mshObject = new PSObject(); mshObject.TypeNames.Clear(); mshObject.TypeNames.Add(String.Format(CultureInfo.InvariantCulture, "{0}#syntax", typeNameForHelp)); - AddSyntaxItemProperties(mshObject, cmdletName, parameterSets, common, commonWorkflow, typeNameForHelp); + AddSyntaxItemProperties(mshObject, cmdletName, parameterSets, common, typeNameForHelp); obj.Properties.Add(new PSNoteProperty("Syntax", mshObject)); } @@ -215,9 +209,8 @@ internal static void AddSyntaxProperties(PSObject obj, string cmdletName, ReadOn /// cmdlet name, you can't get this from parameterSets /// a collection of parameter sets /// common parameters - /// common workflow parameters /// type name for help - private static void AddSyntaxItemProperties(PSObject obj, string cmdletName, ReadOnlyCollection parameterSets, bool common, bool commonWorkflow, string typeNameForHelp) + private static void AddSyntaxItemProperties(PSObject obj, string cmdletName, ReadOnlyCollection parameterSets, bool common, string typeNameForHelp) { ArrayList mshObjects = new ArrayList(); @@ -230,18 +223,15 @@ private static void AddSyntaxItemProperties(PSObject obj, string cmdletName, Rea mshObject.Properties.Add(new PSNoteProperty("name", cmdletName)); mshObject.Properties.Add(new PSNoteProperty("CommonParameters", common)); - mshObject.Properties.Add(new PSNoteProperty("WorkflowCommonParameters", commonWorkflow)); Collection parameters = new Collection(); // GenerateParameters parameters in display order // ie., Positional followed by // Named Mandatory (in alpha numeric) followed by // Named (in alpha numeric) - parameterSet.GenerateParametersInDisplayOrder(commonWorkflow, - parameters.Add, - delegate { }); + parameterSet.GenerateParametersInDisplayOrder(parameters.Add, delegate { }); - AddSyntaxParametersProperties(mshObject, parameters, common, commonWorkflow, parameterSet.Name); + AddSyntaxParametersProperties(mshObject, parameters, common, parameterSet.Name); mshObjects.Add(mshObject); } @@ -260,20 +250,14 @@ private static void AddSyntaxItemProperties(PSObject obj, string cmdletName, Rea /// Named (in alpha numeric) /// /// common parameters - /// common workflow /// Name of the parameter set for which the syntax is generated private static void AddSyntaxParametersProperties(PSObject obj, IEnumerable parameters, - bool common, bool commonWorkflow, string parameterSetName) + bool common, string parameterSetName) { ArrayList mshObjects = new ArrayList(); foreach (CommandParameterInfo parameter in parameters) { - if (commonWorkflow && IsCommonWorkflowParameter(parameter.Name)) - { - continue; - } - if (common && Cmdlet.CommonParameters.Contains(parameter.Name)) { continue; @@ -372,9 +356,8 @@ private static void AddParameterValueGroupProperties(PSObject obj, string[] valu /// HelpInfo object /// parameters /// common parameters - /// common workflow parameters /// type name for help - internal static void AddParametersProperties(PSObject obj, Dictionary parameters, bool common, bool commonWorkflow, string typeNameForHelp) + internal static void AddParametersProperties(PSObject obj, Dictionary parameters, bool common, string typeNameForHelp) { PSObject paramsObject = new PSObject(); @@ -397,11 +380,6 @@ internal static void AddParametersProperties(PSObject obj, Dictionary p return (commonParams.Count == Cmdlet.CommonParameters.Count); } - /// - /// Checks if a parameter is a common workflow parameter - /// - /// parameter name - /// true if it is a common parameter, false if not - private static bool IsCommonWorkflowParameter(string name) - { - foreach (string parameter in CommonParameters.CommonWorkflowParameters) - { - if (name == parameter) - return true; - } - - return false; - } - /// /// Checks if the module contains HelpInfoUri /// diff --git a/src/System.Management.Automation/help/HelpCommentsParser.cs b/src/System.Management.Automation/help/HelpCommentsParser.cs index e03c6201698..0e0c7175043 100644 --- a/src/System.Management.Automation/help/HelpCommentsParser.cs +++ b/src/System.Management.Automation/help/HelpCommentsParser.cs @@ -905,27 +905,10 @@ internal static HelpInfo CreateFromComments(ExecutionContext context, CommandInf HelpCategory.ExternalScript | HelpCategory.Filter | HelpCategory.Function | - HelpCategory.ScriptCommand | - HelpCategory.Workflow); + HelpCategory.ScriptCommand); } } - WorkflowInfo workflowInfo = commandInfo as WorkflowInfo; - if (workflowInfo != null) - { - bool common = DefaultCommandHelpObjectBuilder.HasCommonParameters(commandInfo.Parameters); - bool commonWorkflow = ((commandInfo.CommandType & CommandTypes.Workflow) == - CommandTypes.Workflow); - - localHelpInfo.FullHelp.Properties.Add(new PSNoteProperty("CommonParameters", common)); - localHelpInfo.FullHelp.Properties.Add(new PSNoteProperty("WorkflowCommonParameters", commonWorkflow)); - DefaultCommandHelpObjectBuilder.AddDetailsProperties(obj: localHelpInfo.FullHelp, name: workflowInfo.Name, - noun: workflowInfo.Noun, verb: workflowInfo.Verb, - typeNameForHelp: "MamlCommandHelpInfo", synopsis: localHelpInfo.Synopsis); - DefaultCommandHelpObjectBuilder.AddSyntaxProperties(localHelpInfo.FullHelp, workflowInfo.Name, - workflowInfo.ParameterSets, common, commonWorkflow, "MamlCommandHelpInfo"); - } - // Add HelpUri if necessary if (localHelpInfo.GetUriForOnlineHelp() == null) { diff --git a/src/System.Management.Automation/resources/HelpDisplayStrings.resx b/src/System.Management.Automation/resources/HelpDisplayStrings.resx index 195cd831da9..638f7fc968a 100644 --- a/src/System.Management.Automation/resources/HelpDisplayStrings.resx +++ b/src/System.Management.Automation/resources/HelpDisplayStrings.resx @@ -443,22 +443,6 @@ To update help again, add the Force parameter to your command. Saved {0} - - <WorkflowCommonParameters> - - - This cmdlet supports the workflow common parameters: - PSComputerName, JobName, PSApplicationName, PSCredential, - PSPort, PSConfigurationName, PSConnectionURI, PSSessionOption, - PSAuthentication, PSAuthenticationLevel, - PSCertificateThumbprint, PSConnectionRetryCount, - PSConnectionRetryIntervalSec, PSRunningTimeoutSec, - PSElapsedTimeoutSec, PSPersist, - PSPrivateMetadata, InputObject, - PSParameterCollection, AsJob, PSUseSSL, and PSAllowRedirection. - For more information, see about_Workflow_Common_Parameters - (https://go.microsoft.com/fwlink/?LinkID=222527). - The HelpInfoURI {0} does not start with HTTP. diff --git a/src/System.Management.Automation/resources/Modules.resx b/src/System.Management.Automation/resources/Modules.resx index fad0e9f7ef1..af889e15561 100644 --- a/src/System.Management.Automation/resources/Modules.resx +++ b/src/System.Management.Automation/resources/Modules.resx @@ -537,9 +537,6 @@ Running the Get-Module cmdlet against a remote computer can only list available modules. Add the ListAvailable parameter to your command, and then try again. - - Exporting workflow '{0}'. - The '{0}' module was not imported because the '{0}' snap-in was already imported. diff --git a/src/System.Management.Automation/security/SecurityManager.cs b/src/System.Management.Automation/security/SecurityManager.cs index f4e7a15fd51..06b670abab1 100644 --- a/src/System.Management.Automation/security/SecurityManager.cs +++ b/src/System.Management.Automation/security/SecurityManager.cs @@ -597,7 +597,6 @@ protected internal override bool ShouldRun(CommandInfo commandInfo, case CommandTypes.Function: case CommandTypes.Filter: - case CommandTypes.Workflow: case CommandTypes.Configuration: // // we do not check functions/filters. From a02fa5dc260e0882e2f18ed5e3119f17aba06cc9 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 23 Apr 2018 13:09:13 -0700 Subject: [PATCH 2/3] [Feature] Minor updates --- src/System.Management.Automation/engine/CommandInfo.cs | 4 ---- src/System.Management.Automation/engine/WorkflowInfo.cs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/System.Management.Automation/engine/CommandInfo.cs b/src/System.Management.Automation/engine/CommandInfo.cs index d62bb016a86..d07489055f5 100644 --- a/src/System.Management.Automation/engine/CommandInfo.cs +++ b/src/System.Management.Automation/engine/CommandInfo.cs @@ -277,10 +277,6 @@ internal void SetCommandType(CommandTypes newType) CommandType = newType; } - internal const int HasWorkflowKeyWord = 0x0008; - internal const int IsCimCommand = 0x0010; - internal const int IsFile = 0x0020; - /// /// A string representing the definition of the command. /// diff --git a/src/System.Management.Automation/engine/WorkflowInfo.cs b/src/System.Management.Automation/engine/WorkflowInfo.cs index 225dc8287f8..d16f906bb40 100644 --- a/src/System.Management.Automation/engine/WorkflowInfo.cs +++ b/src/System.Management.Automation/engine/WorkflowInfo.cs @@ -8,7 +8,7 @@ namespace System.Management.Automation /// /// Provides information about a workflow that is stored in session state. /// - internal class WorkflowInfo : FunctionInfo + public class WorkflowInfo : FunctionInfo { #region ctor From 26a87b26acead4e975a5c101223f78a178722716 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 26 Apr 2018 17:37:44 -0700 Subject: [PATCH 3/3] [Feature] Address Paul's feedback --- .../engine/debugger/debugger.cs | 88 +------------------ .../engine/remoting/client/Job.cs | 24 +---- 2 files changed, 3 insertions(+), 109 deletions(-) diff --git a/src/System.Management.Automation/engine/debugger/debugger.cs b/src/System.Management.Automation/engine/debugger/debugger.cs index 14bdc48b26a..c124d6d4425 100644 --- a/src/System.Management.Automation/engine/debugger/debugger.cs +++ b/src/System.Management.Automation/engine/debugger/debugger.cs @@ -216,49 +216,6 @@ public PSJobStartEventArgs(Job job, Debugger debugger, bool isAsync) #endregion - #region DebugSource - - /// - /// Contains debugger script and script file information. - /// - public sealed class DebugSource - { - /// - /// Full script. - /// - public string Script { get; private set; } - - /// - /// Script file for script or null. - /// - public string ScriptFile { get; private set; } - - /// - /// Xaml definition for Workflow script or null. - /// - public string XamlDefinition { get; private set; } - - /// - /// Constructor. - /// - /// Script text - /// Script file - /// Xaml definition - public DebugSource( - string script, - string scriptFile, - string xamlDefinition) - { - Script = script; - ScriptFile = scriptFile; - XamlDefinition = xamlDefinition; - } - - private DebugSource() { } - } - - #endregion - #region Runspace Debug Processing /// @@ -622,7 +579,7 @@ protected void RaiseCancelRunspaceDebugProcessingEvent() public abstract DebuggerStopEventArgs GetDebuggerStopArgs(); /// - /// Sets the parent debugger and breakpoints. + /// Sets the parent debugger, breakpoints and other debugging context information. /// /// Parent debugger /// List of breakpoints @@ -639,27 +596,6 @@ public virtual void SetParent( throw new PSNotImplementedException(); } - /// - /// Sets the parent debugger, breakpoints, function source and other - /// debugging context information. - /// - /// Parent debugger - /// List of breakpoints - /// Debugger mode - /// PowerShell host - /// Current path - /// Function to source map - public virtual void SetParent( - Debugger parent, - IEnumerable breakPoints, - DebuggerResumeAction? startAction, - PSHost host, - PathInfo path, - Dictionary functionSourceMap) - { - throw new PSNotImplementedException(); - } - /// /// Sets the debugger mode. /// @@ -2970,8 +2906,7 @@ private void AddToJobRunningList(PSJobStartEventArgs jobArgs, DebuggerResumeActi _idToBreakpoint.Values.ToArray(), startAction, _context.EngineHostInterface.ExternalHost, - _context.SessionState.Path.CurrentLocation, - new Dictionary()); + _context.SessionState.Path.CurrentLocation); } else { @@ -3022,25 +2957,6 @@ private void SetRunspaceListToStep(bool enableStepping) } } - private string GetFunctionSource( - string scriptFile) - { - if (System.IO.File.Exists(scriptFile)) - { - try - { - return System.IO.File.ReadAllText(scriptFile); - } - catch (ArgumentException) { } - catch (System.IO.IOException) { } - catch (UnauthorizedAccessException) { } - catch (NotSupportedException) { } - catch (System.Security.SecurityException) { } - } - - return null; - } - private void RemoveFromRunningJobList(Job job) { job.StateChanged -= HandleJobStateChanged; diff --git a/src/System.Management.Automation/engine/remoting/client/Job.cs b/src/System.Management.Automation/engine/remoting/client/Job.cs index ce757b16f76..9b512a7c611 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job.cs @@ -3882,35 +3882,13 @@ public override DebuggerStopEventArgs GetDebuggerStopArgs() } /// - /// Sets the parent debugger, breakpoints, function source and other - /// debugging context information. + /// Sets the parent debugger, breakpoints, and other debugging context information. /// /// Parent debugger /// List of breakpoints /// Debugger mode /// PowerShell host /// Current path - /// Function to source map - public override void SetParent( - Debugger parent, - IEnumerable breakPoints, - DebuggerResumeAction? startAction, - PSHost host, - PathInfo path, - Dictionary functionSourceMap) - { - // For now always enable step mode debugging. - SetDebuggerStepMode(true); - } - - /// - /// Sets the parent debugger and breakpoints. - /// - /// Parent debugger - /// List of breakpoints - /// Debugger mode - /// host - /// Current path public override void SetParent( Debugger parent, IEnumerable breakPoints,