diff --git a/Rules/AvoidAlias.cs b/Rules/AvoidAlias.cs index a94664269..4262ac608 100644 --- a/Rules/AvoidAlias.cs +++ b/Rules/AvoidAlias.cs @@ -184,21 +184,21 @@ private IScriptExtent GetCommandExtent(CommandAst commandAst) /// Retruns a list of suggested corrections private List GetCorrectionExtent(CommandAst cmdAst, string cmdletName) { - var ext = cmdAst.Extent; var corrections = new List(); var alias = cmdAst.GetCommandName(); - string description = string.Format( + var description = string.Format( CultureInfo.CurrentCulture, Strings.AvoidUsingCmdletAliasesCorrectionDescription, alias, cmdletName); + var cmdExtent = GetCommandExtent(cmdAst); corrections.Add(new CorrectionExtent( - ext.StartLineNumber, - ext.EndLineNumber, - cmdAst.CommandElements[0].Extent.StartColumnNumber, - cmdAst.CommandElements[0].Extent.EndColumnNumber, + cmdExtent.StartLineNumber, + cmdExtent.EndLineNumber, + cmdExtent.StartColumnNumber, + cmdExtent.EndColumnNumber, cmdletName, - ext.File, + cmdAst.Extent.File, description)); return corrections; }