PowerShell / PowerShell/DSC

Parameter null value is not allowed

Open
#1,000 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ARM-Language-2.0 Issue-Bug
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

While developing the coalesce function and writing the documentation, I stumbled on the following error from example 3:

Parser: Parameter 'customValue' not found in context.

It looks like parameter default values set to null are not allowed.

Steps to reproduce

Run the following example from the branch comparison-function-coalesce:

$in = @'
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
parameters:
  customValue:
    type: string
    defaultValue: null
  timeout:
    type: int
    defaultValue: 0
resources:
- name: Configuration with fallbacks
  type: Microsoft.DSC.Debug/Echo
  properties:
    output:
      configValue: "[coalesce(parameters('customValue'), 'default-config')]"
      timeout:     "[coalesce(parameters('timeout'), 30)]"
'@
dsc config get --input $in
Expected behavior
The example would have returned null on `configValue`
Actual behavior
The error: Parser: Parameter 'customValue' not found in context occurs
Error details

Environment data
Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
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.2.0-preview.3

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 by running the dsc config get --input reproduction from the comparison-function-coalesce branch and trace parameter lookup for customValue when its defaultValue is null. Compare the result with the expected null configValue, then add or update coverage for null parameter defaults and confirm the existing timeout fallback still works.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.