Skip to content

Parser: Found error node parsing function while using user-defined functions #1136

Description

@Gijsreyn

Prerequisites

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

Summary

While writing the reference documentation for #1135, the following example throws an error:

$in = @'
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
functions:
- namespace: Environment
  members:
    getEnvironmentConfig:
      parameters:
      - name: isProduction
        type: bool
      output:
        type: object
        value: "[if(parameters('isProduction'), 
                   createObject('logLevel', 'error', 'debugMode', false()),
                   createObject('logLevel', 'debug', 'debugMode', true()))]"

resources:
- name: Echo production config
  type: Microsoft.DSC.Debug/Echo
  properties:
    output: "[Environment.getEnvironmentConfig(true())]"
- name: Echo development config
  type: Microsoft.DSC.Debug/Echo
  properties:
    output: "[Environment.getEnvironmentConfig(false())]"
'@
dsc config get --input $in

Steps to reproduce

Run the above code snippet from the description

Expected behavior

results:
- name: Echo production config
  type: Microsoft.DSC.Debug/Echo
  result:
    actualState:
      output:
        logLevel: error
        debugMode: false
- name: Echo development config
  type: Microsoft.DSC.Debug/Echo
  result:
    actualState:
      output:
        logLevel: debug
        debugMode: true
messages: []
hadErrors: false

Actual behavior

2025-09-26T04:52:27.274014Z TRACE dsc_lib::configure: 997: Invoke property expression for output: "[Environment.getEnvironmentConfig(true())]"
2025-09-26T04:52:27.274361Z DEBUG dsc_lib::parser: 48: Parsing statement: [Environment.getEnvironmentConfig(true())]
2025-09-26T04:52:27.274706Z DEBUG dsc_lib::parser: 89: Parsing expression
2025-09-26T04:52:27.275003Z DEBUG dsc_lib::parser::expressions: 43: Parsing function '{Node function (0, 1) - (0, 40)}'
2025-09-26T04:52:27.275529Z ERROR dsc::subcommand: 76: Parser: Found error node parsing function

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.3
PSEdition                      Core
GitCommitId                    7.5.3
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.5

Visuals

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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