Skip to content

Show the invalid JSON when debugging or tracing #1266

@IlleNilsson

Description

@IlleNilsson

Summary of the new feature / enhancement

Creating resources with pwsh or other binaries could be simplified if when debugging or tracing show the output from binary after the error.

Repo for reproduction: https://github.com/IlleNilsson/Microsoft.DSC.v3.resource.venture

Command:

dsc -l trace -p default resource get -r Visity.DSC.Windows/Feature -i "{'name': 'TelnetClient'}"

Current output (see the last lines):

2025-11-14T19:45:10.596792Z  INFO dsc::util: 393: Trace-level is Trace
2025-11-14T19:45:10.597463Z DEBUG dsc: 44: Running DSC version: 3.1.2
2025-11-14T19:45:10.597949Z DEBUG dsc_lib::discovery::command_discovery: 473: Searching for resources: ["Visity.DSC.Windows/Feature"]
2025-11-14T19:45:10.598445Z  INFO dsc_lib::discovery::command_discovery: 196: Discovering 'Resource' using filter: *
2025-11-14T19:45:10.598631Z  INFO dsc_lib::discovery::command_discovery: 196: Discovering 'Extension' using filter: *
2025-11-14T19:45:10.598764Z DEBUG dsc_lib::discovery::command_discovery: 204: Using regex ^.*?$ as filter for adapter name
2025-11-14T19:45:10.599802Z DEBUG dsc_lib::util: 90: Found setting 'resourcePath' in C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration_3.1.2.0_x64__8wekyb3d8bbwe\dsc_default.settings.json
2025-11-14T19:45:10.600403Z DEBUG dsc_lib::util: 100: Found setting 'resourcePath' in C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration_3.1.2.0_x64__8wekyb3d8bbwe\dsc.settings.json
2025-11-14T19:45:10.600769Z DEBUG dsc_lib::util: 114: Setting 'resourcePath' not found in C:\ProgramData\dsc\dsc.settings.json
2025-11-14T19:45:10.601082Z DEBUG dsc_lib::discovery::command_discovery: 125: DSC_RESOURCE_PATH: "C:\\Program Files\\PowerShell\\7;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0;C:\\Users\\IlianNilsson\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration_3.1.1.0_x64__8wekyb3d8bbwe;D:\\Users\\ilian\\Source\\Environments\\.resources\\windows;"
2025-11-14T19:45:10.601429Z DEBUG dsc_lib::discovery::command_discovery: 179: Using Resource Path: C:\Program Files\PowerShell\7;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Users\IlianNilsson\AppData\Local\Microsoft\WindowsApps;C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration_3.1.1.0_x64__8wekyb3d8bbwe;D:\Users\ilian\Source\Environments\.resources\windows;
2025-11-14T19:45:10.621304Z DEBUG dsc_lib::discovery::command_discovery: 204: Using regex ^.*?$ as filter for adapter name
2025-11-14T19:45:10.623379Z DEBUG dsc_lib::util: 90: Found setting 'resourcePath' in C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration_3.1.2.0_x64__8wekyb3d8bbwe\dsc_default.settings.json
2025-11-14T19:45:10.624749Z DEBUG dsc_lib::util: 100: Found setting 'resourcePath' in C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration_3.1.2.0_x64__8wekyb3d8bbwe\dsc.settings.json
2025-11-14T19:45:10.625380Z DEBUG dsc_lib::util: 114: Setting 'resourcePath' not found in C:\ProgramData\dsc\dsc.settings.json
2025-11-14T19:45:10.625669Z DEBUG dsc_lib::discovery::command_discovery: 125: DSC_RESOURCE_PATH: "C:\\Program Files\\PowerShell\\7;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0;C:\\Users\\IlianNilsson\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration_3.1.1.0_x64__8wekyb3d8bbwe;D:\\Users\\ilian\\Source\\Environments\\.resources\\windows;"
2025-11-14T19:45:10.625988Z DEBUG dsc_lib::discovery::command_discovery: 179: Using Resource Path: C:\Program Files\PowerShell\7;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Users\IlianNilsson\AppData\Local\Microsoft\WindowsApps;C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration_3.1.1.0_x64__8wekyb3d8bbwe;D:\Users\ilian\Source\Environments\.resources\windows;
2025-11-14T19:45:10.642488Z TRACE dsc_lib::discovery::command_discovery: 243: Found resource manifest: D:\Users\ilian\Source\Environments\.resources\windows\feature.dsc.resource.yaml
2025-11-14T19:45:10.644564Z TRACE dsc_lib::discovery::command_discovery: 285: Resource 'Visity.DSC.Windows/Feature' found
2025-11-14T19:45:10.645907Z TRACE dsc::util: 430: Input: Some("{'name': 'TelnetClient'}"), File: None
2025-11-14T19:45:10.646148Z DEBUG dsc::util: 432: Reading input from command line parameter
2025-11-14T19:45:10.646395Z DEBUG dsc::resource_command: 25: Visity.DSC.Windows/Feature implemented as Command
2025-11-14T19:45:10.646546Z DEBUG dsc_lib::dscresources::dscresource: 219: Invoking get for 'Visity.DSC.Windows/Feature'
2025-11-14T19:45:10.646712Z DEBUG dsc_lib::dscresources::command_resource: 29: Invoking get for 'Visity.DSC.Windows/Feature'
2025-11-14T19:45:10.646868Z DEBUG dsc_lib::dscresources::command_resource: 776: Verify JSON for 'Visity.DSC.Windows/Feature'
2025-11-14T19:45:10.646996Z TRACE dsc_lib::dscresources::command_resource: 780: Validating against JSON: {"name":"TelnetClient"}
2025-11-14T19:45:10.647130Z TRACE dsc_lib::dscresources::command_resource: 432: Invoking validate on 'Visity.DSC.Windows/Feature' using '{"name":"TelnetClient"}'
2025-11-14T19:45:10.647262Z DEBUG dsc_lib::dscresources::command_resource: 759: Parsing input as stdin
2025-11-14T19:45:10.647390Z  INFO dsc_lib::dscresources::command_resource: 441: Invoking validate on 'Visity.DSC.Windows/Feature' using 'pwsh'
2025-11-14T19:45:10.647588Z DEBUG dsc_lib::dscresources::command_resource: 699: Invoking command 'pwsh' with args Some(["-NoLogo", "-NoProfile", "-NoProfileLoadTime", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", "$input | . ./feature.dsc.resource.ps1; Request-ResourceState -Validate"])
2025-11-14T19:45:10.662164Z TRACE dsc_lib::dscresources::command_resource: 616: Writing to command STDIN: {"name":"TelnetClient"}
2025-11-14T19:45:11.437968Z DEBUG dsc_lib::dscresources::command_resource: 660: Process 'pwsh' id 36148 exited with code 0
2025-11-14T19:45:11.439785Z ERROR dsc::resource_command: 64: JSON: expected ident at line 1 column 2

Here one would like to see what has validated wrong...

Proposed technical implementation details (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions