PowerShell / PowerShell/DSC

Error while testing the `winps_script.dsc.yaml` example

Open
#818 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug Resolution-Answered
Dominant language
Rust
Stars
523
Forks
75
Avg merge
3d 16h
Merged PRs (30d)
24

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.
Summary

I am getting an error "You cannot call a method on a null-valued express" when trying the winps_script.dsc.yaml example with the stable release, or a manifest description: Error warning and error with the preview release. If I set the Process ExecutionPolicy to Bypass, the preview release gives the same error as the stable release.

I'm including trace outputs from both the stable and preview releases of the CLI to show the differences in impact the Process ExecutionPolicy has on the two different releases. I installed them with winget install --id Microsoft.DSC -e and winget install --id Microsoft.DSC.Preview -e (one at a time with the other uninstalled), so those are the names I use in the filenames of the attached trace output files. In each case, I had the CurrentUser and LocalMachine ExecutionPolicy set to Bypass (temporarily) and either set the Process ExecutionPolicy to Undefined or Bypass to show the impact that has on both releases.

Each trace output was generated with this command: dsc -l trace config test --file .\winps_script.dsc.yaml.

Microsoft.DSC.Preview-Bypass.txt
Microsoft.DSC.Preview-Undefined.txt
Microsoft.DSC-Bypass.txt
Microsoft.DSC-Undefined.txt

Steps to reproduce
  1. Save a local copy of the example script.
  2. Call test or any of the other methods on it. e.g. dsc config test --file .\winps_script.dsc.yaml
Expected behavior
No errors
Actual behavior
An error: `You cannot call a method on a null-valued expression.`
Error details
2025-05-17T18:30:40.366999Z ERROR PID 2420: Exception: You cannot call a method on a null-valued expression.
2025-05-17T18:30:40.386900Z ERROR Command: Resource 'powershell' [exit code 1] manifest description: Error
Environment data
Name                           Value
----                           -----
PSVersion                      7.5.1
PSEdition                      Core
GitCommitId                    7.5.1
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Version

dsc 3.1.0-preview.1 (or dsc 3.0.2)

Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the winps_script.dsc.yaml example and reproduce the failure using dsc -l trace config test --file .\winps_script.dsc.yaml under the stable and preview releases. Compare the attached traces with the PowerShell execution-policy settings and verify the example completes without the null-valued-expression error or manifest description warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, yaml
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.