Skip to content

fix: add null-check fallback for DefaultEncoding in Update-ManifestField#15

Merged
yfridelance merged 1 commit into
developfrom
bugfix/fix-null-encoding-fallback
Feb 27, 2026
Merged

fix: add null-check fallback for DefaultEncoding in Update-ManifestField#15
yfridelance merged 1 commit into
developfrom
bugfix/fix-null-encoding-fallback

Conversation

@yfridelance
Copy link
Copy Markdown
Owner

Summary

  • Update-ManifestField crashes with Value cannot be null (Parameter 'encoding') when $Script:DefaultEncoding is not initialized
  • This occurs when Update-PSModuleVersion calls Update-ManifestField internally, as the caller has no way to set the module-scoped variable
  • Adds a null-check with fallback to UTF-8 BOM encoding (the intended default)

Test plan

  • Run existing Pester tests for Update-ManifestField
  • Run Update-PSModuleVersion without prior $Script:DefaultEncoding initialization
  • Verify manifest is written with correct UTF-8 BOM encoding

🤖 Generated with Claude Code

When Update-PSModuleVersion calls Update-ManifestField internally,
$Script:DefaultEncoding may not be initialized, causing WriteAllText
to fail with "Value cannot be null (Parameter 'encoding')".

Falls back to UTF-8 with BOM when $Script:DefaultEncoding is null.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yfridelance yfridelance changed the base branch from main to develop February 27, 2026 05:57
@yfridelance yfridelance merged commit c0b8107 into develop Feb 27, 2026
4 checks passed
@yfridelance yfridelance deleted the bugfix/fix-null-encoding-fallback branch February 27, 2026 05:57
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.

1 participant