Skip to content

ConvertTo-MOFInstance: Include resource properties with empty array value #127

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DoLearnWhileAlive
Copy link

PR Summary

Fixes #126

PR Context

When switching from Windows PowerShell 5.1 to PowerShell 7 for DSC MOF compilation people are expecting no changes to the resulting MOF files. This is currently not the case for resource properties with an empty array value.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where resource properties with empty array values were being excluded from MOF file compilation in PowerShell 7, creating inconsistency with Windows PowerShell 5.1 behavior.

  • Removes conditional logic that excluded empty array properties from MOF generation
  • Ensures consistent MOF compilation behavior across PowerShell versions

Copy link
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

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

This looks fine to me, although I don't have the history of why the original code excluded empty arrays. @TravisEz13 do you have any recollection of this behavior since the conditional check is very explicit (although it could simply be wrong).

Copy link
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

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

Can you add a test to cover this use case?

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.

A resource property with an empty array value does not land in the compiled MOF file
2 participants