GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix error message when 'HelpMessage' property of 'ParameterAttribute'… · PowerShell/PowerShell@0cd7a4a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/System.Management.Automation/engine
    • Attributes.cs
    • CommandDiscovery.cs
  • test/powershell/engine
    • Attributes.Tests.ps1
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/System.Management.Automation/engine/Attributes.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/Attributes.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ public string HelpMessage
686686
{
687687
if (string.IsNullOrEmpty(value))
688688
{
689-
throw PSTraceSource.NewArgumentException("value");
689+
throw PSTraceSource.NewArgumentException("HelpMessage");
690690
}
691691
_helpMessage = value;
692692
}
@@ -707,7 +707,7 @@ public string HelpMessageBaseName
707707
{
708708
if (string.IsNullOrEmpty(value))
709709
{
710-
throw PSTraceSource.NewArgumentException("value");
710+
throw PSTraceSource.NewArgumentException("HelpMessageBaseName");
711711
}
712712
_helpMessageBaseName = value;
713713
}
@@ -728,7 +728,7 @@ public string HelpMessageResourceId
728728
{
729729
if (string.IsNullOrEmpty(value))
730730
{
731-
throw PSTraceSource.NewArgumentException("value");
731+
throw PSTraceSource.NewArgumentException("HelpMessageResourceId");
732732
}
733733
_helpMessageResourceId = value;
734734
}
Collapse file

‎src/System.Management.Automation/engine/CommandDiscovery.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/CommandDiscovery.cs
-10Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -775,16 +775,6 @@ internal CommandProcessorBase LookupCommandProcessor(CommandInfo commandInfo,
775775
new CommandNotFoundException(reqSyntaxException.Message, reqSyntaxException);
776776
throw e;
777777
}
778-
catch (PSArgumentException argException)
779-
{
780-
CommandNotFoundException e =
781-
new CommandNotFoundException(
782-
commandInfo.Name,
783-
argException,
784-
"ScriptRequiresInvalidFormat",
785-
DiscoveryExceptions.ScriptRequiresInvalidFormat);
786-
throw e;
787-
}
788778
break;
789779
case CommandTypes.Filter:
790780
case CommandTypes.Function:
Collapse file

‎test/powershell/engine/Attributes.Tests.ps1‎

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Describe "Attribute tests" -Tags "CI" {
2+
BeforeEach {
3+
Remove-Item $testdrive/test.ps1 -Force -ErrorAction SilentlyContinue
4+
}
5+
6+
It "<attribute> attribute returns argument error if empty" -TestCases @(
7+
@{Attribute="HelpMessage"},
8+
@{Attribute="HelpMessageBaseName"},
9+
@{Attribute="HelpMessageResourceId"}
10+
) {
11+
param($attribute)
12+
13+
$script = @"
14+
[CmdletBinding()]
15+
Param (
16+
[Parameter($attribute="")]
17+
[String]`$Parameter1
18+
)
19+
Write-Output "Hello"
20+
"@
21+
New-Item -Path $testdrive/test.ps1 -Value $script -ItemType File
22+
{ & $testdrive/test.ps1 } | ShouldBeErrorId "Argument"
23+
}
24+
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.