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

Hotfix feature.json #2865

Merged

Conversation

ruxunderscore
Copy link
Contributor

Stray comma at the end of line 324, causing compiling issue in Powershell 5.

Type of Change

  • Bug fix
  • Hotfix

Description

Since JSON handling is different between Powershell 5 and Powershell 7. You only notice the error during Compiling on Powershell 5.

Testing

Debugged and tested compile in Powershell 5 and 7.

Issue related to PR

Fixes #2864

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • My changes generate no errors/warnings/merge conflicts.

- Stray comma at the end of line 324.
- Since JSON handling is different between Powershell 5 and Powershell 7. You only notice the error during Compiling on Powershell 5. Fixes ChrisTitusTech#2864
@ruxunderscore
Copy link
Contributor Author

For those that want an easy way to check for JSON error in Powershell, here is a quick Function I wrote that you can add to your Powershell Profile:

#region Validation
function Test-JsonValidity {
    param(
        [Parameter(Mandatory=$true)]
        [string]$Path
    )

    try {
        $jsonContent = Get-Content $Path -Raw
        $null = $jsonContent | ConvertFrom-Json
        Write-Host "JSON is valid" -ForegroundColor Green
        return $true
    } catch {
        Write-Host "Invalid JSON: $($_.Exception.Message)" -ForegroundColor Red
        return $false
    }
}
#endregion

Sidenote: regions are nice, since they show up as giant headers in the code map inside IDEs like VSCode.

Copy link
Contributor

@og-mrk og-mrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it on both PowerShell 5 & 7, it Compiled WinUtil successfully without any problems. Good commits @ruxunderscore 👍

Copy link
Contributor

@CodingWonders CodingWonders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiling with PowerShell 5 now works as expected. Thanks @ruxunderscore!

@ChrisTitusTech ChrisTitusTech merged commit e4565f1 into ChrisTitusTech:main Oct 7, 2024
1 check passed
@ruxunderscore ruxunderscore deleted the feature-json-format-fix branch October 10, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yet another compilation bug on PowerShell 5
4 participants