Skip to content

Error while testing the winps_script.dsc.yaml example #818

Open
@FlippingBinary

Description

@FlippingBinary

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions