Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-WikiModuleVersion: Invalid Encoding parameter value #45

Closed
SphenicPaul opened this issue Dec 13, 2020 · 1 comment · Fixed by #46
Closed

Set-WikiModuleVersion: Invalid Encoding parameter value #45

SphenicPaul opened this issue Dec 13, 2020 · 1 comment · Fixed by #46
Labels
bug The issue is a bug.

Comments

@SphenicPaul
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring

This module gets used as part of the SqlServerDsc build (and likely others), and raises the following error/exception off an initial run from a freshly cloned repository:

Set-WikiModuleVersion : Cannot validate argument on parameter 'Encoding'. The argument "System.Text.ASCIIEncoding" does not belong to the set "unknown,string,unicode,bigendianunicode,utf8,utf7,utf32,ascii,default,oem" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.

Steps to reproduce the problem

  • Take a fresh, local clone of the SqlServerDsc repository
  • Run .\build.ps1 -ResolveDependency from within the local repository/directory
  • Throws error when generating the wiki

Expected behavior

I'd presume this shouldn't error and the Wiki would be generated/updated successfully.

Current behavior

Error/Exception is thrown:

Set-WikiModuleVersion : Cannot validate argument on parameter 'Encoding'. The argument "System.Text.ASCIIEncoding" does not belong to the set "unknown,string,unicode,bigendianunicode,utf8,utf7,utf32,ascii,default,oem" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.

Suggested solution to the issue

Update Set-WikiModuleVersion.ps1 to change ...

Out-File -InputObject $markdownContent -FilePath $Path -Encoding ([System.Text.Encoding]::ASCII) -NoNewline

..to...

Out-File -InputObject $markdownContent -FilePath $Path -Encoding 'ascii' -NoNewline

Making this change seemed to remove the error when tried locally.

The operating system the target node is running

OsName : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture : 64-bit
WindowsVersion : 2004
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-GB
OsMuiLanguages : {en-GB}

Version and build of PowerShell the target node is running

PSVersion 5.1.19041.610
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.610
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the module that was used

0.7.1

SphenicPaul added a commit to SphenicPaul/DscResource.DocGenerator that referenced this issue Dec 13, 2020
@SphenicPaul
Copy link
Contributor Author

Note that I noticed that the Encoding values were also incorrect in New-WikiFooter and New-WikiHeader - I've added/updated both of these fixes into the PR (#46).

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Jan 2, 2021
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Jan 17, 2021
johlju pushed a commit that referenced this issue Jan 17, 2021
- New-WikiFooter
  - Fixed `Encoding`, parameter value passed to `Out-File` to use `ascii` rather
    than `[System.Text.Encoding]::ASCII` (issue #45).
- New-WikiSidebar
  - Fixed `Encoding`, parameter value passed to `Out-File` to use `ascii` rather
    than `[System.Text.Encoding]::ASCII` (issue #45).
- Set-WikiModuleVersion
  - Fixed `Encoding`, parameter value passed to `Out-File` to use `ascii` rather
    than `[System.Text.Encoding]::ASCII` (issue #45).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants