Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Management.Automation;
using System.Management.Automation.Internal;

Expand Down Expand Up @@ -82,6 +83,16 @@ protected override void ProcessRecord()

AliasInfo result = null;

if (string.Equals(newAlias.Name, newAlias.Definition, StringComparison.OrdinalIgnoreCase))
{
PSArgumentException e = PSTraceSource.NewArgumentException("Value", NewObjectStrings.InvalidValue, newAlias.Name);
WriteError(
new ErrorRecord(
e.ErrorRecord,
e));
Comment thread
jserygit marked this conversation as resolved.
return;
}

try
{
if (string.IsNullOrEmpty(Scope))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Management.Automation;
using System.Management.Automation.Internal;

Expand Down Expand Up @@ -42,6 +43,16 @@ protected override void ProcessRecord()

AliasInfo result = null;

if (string.Equals(aliasToSet.Name, aliasToSet.Definition, StringComparison.OrdinalIgnoreCase))
{
PSArgumentException e = PSTraceSource.NewArgumentException("Value", NewObjectStrings.InvalidValue, aliasToSet.Name);
Comment thread
jserygit marked this conversation as resolved.
WriteError(
new ErrorRecord(
e.ErrorRecord,
e));
Comment thread
jserygit marked this conversation as resolved.
return;
}

try
{
if (string.IsNullOrEmpty(Scope))
Expand Down