Update-PSScriptFileInfo modifies Description even when -Description parameter is not used
Prerequisites
- [x] Write a descriptive title.
- [x] Make sure you are able to repro it on the latest released version
- [x] Search the existing issues.
Steps to reproduce
When Update-PSScriptInfo is used to change script metadata, the Description property of Comment-based help is modified event when Description parameter is not used.
The sample script to test the problem: Update-PSInfo.ps1
Expected behavior
Both the placement of Description property is changed and also, the formatting of content is changed.
Expected behavior
PS> Get-Content Update-PSInfo.ps1
<#PSScriptInfo
.VERSION 1.0.0
. . .
#>
<#
.SYNOPSIS
A short synopsis
.DESCRIPTION
A longer description.
Second paragraph
. . .
PS> Update-PSScriptFileInfo -Path Update-PSInfo.ps1 -Version 1.1.0
PS> Get-Content Update-PSInfo.ps1
<#PSScriptInfo
.VERSION 1.1.0
. . .
#>
<#
.SYNOPSIS
A short synopsis
.DESCRIPTION
A longer description.
Second paragraph
. . .
Actual behavior
PS> Update-PSScriptFileInfo -Path Update-PSInfo.ps1 -Version 1.1.0
PS> Get-Content Update-PSInfo.ps1
<#PSScriptInfo
.VERSION 1.1.0
. . .
#>
<#
.DESCRIPTION
A longer description.
Second paragraph
.SYNOPSIS
A short synopsis
. . .
Error details
Environment data
- PowerShell version: 5.1, 7.5.1
- PSResourceGet version: 1.1.1
Visuals
No response
Aside from the aforementioned changing of content in the comment-help block, the lack of a blank line between the metadata and help comments breaks both Test-ScriptFileInfo from PowerShellGet and New-CommandHelp (...and dependent CMDlets) in PlatyPS.
Not sure if those should be a separate issue (or two?), but this would seem to be at the root.