Skip to content

Commit 80920b3

Browse files
committed
Fix initialization bugs
1 parent 895d4fd commit 80920b3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Engine/Helper.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ internal set
114114
/// </summary>
115115
private Helper()
116116
{
117-
_ruleArguments = new Dictionary<string, Dictionary<string, object>>(StringComparer.OrdinalIgnoreCase);
118117
_commandInfoCache = new Lazy<CommandInfoCache>(() => new CommandInfoCache());
118+
_ruleArguments = new Dictionary<string, Dictionary<string, object>>(StringComparer.OrdinalIgnoreCase);
119119
_cmdletToAliasDictionary = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
120120
_aliasToCmdletDictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
121121
_keywordBlockDictionary = new Dictionary<string, List<Tuple<int, int>>>(StringComparer.OrdinalIgnoreCase);
@@ -129,7 +129,7 @@ private Helper()
129129
/// A CommandInvocationIntrinsics instance for use in gathering
130130
/// information about available commands and aliases.
131131
/// </param>
132-
public Helper(CommandInvocationIntrinsics invokeCommand) : base()
132+
public Helper(CommandInvocationIntrinsics invokeCommand) : this()
133133
{
134134
_invokeCommand = invokeCommand;
135135
}
@@ -140,6 +140,10 @@ public Helper(CommandInvocationIntrinsics invokeCommand) : base()
140140
/// </summary>
141141
public void Initialize()
142142
{
143+
_aliasToCmdletDictionary.Clear();
144+
_cmdletToAliasDictionary.Clear();
145+
_keywordBlockDictionary.Clear();
146+
VariableAnalysisDictionary.Clear();
143147
if (_invokeCommand != null)
144148
{
145149
IEnumerable<CommandInfo> aliases = _invokeCommand.GetCommands("*", CommandTypes.Alias, nameIsPattern: true);

0 commit comments

Comments
 (0)