Open jchancellor-ms opened 11 months ago
@jchancellor-ms is that on dsc.exe
from latest main branch?
With the sample config code
I am hitting #260 .
In general, Error: JSON: expected value at line 1 column 1
happens when PS returns additional output - such as warnings or verbose text (e.g. when a PS module, containg the DSC resource, has functions/cmdlets that do Not follow PS naming convention). We've added a workaround for most of such cases, but looks like not all.
I'm using build Alpha.3 as I was trying to avoid figuring out how to build the latest dsc executable. After submitting issue #260, I added some temporary code to the powershell file to get around the inputs issue and see if I could get a functioning implementation for a customer demo for additional feedback. I was able to get past 260, but then ran into this issue where the output appears to return valid output, but fails the json check. I suspect the real issue for both these issues is that since we're wrapping Invoke-DSCResource, it needs to be smart enough to throw away unneeded inputs during a get, and have a way to return the output without extraneous characters.
Prerequisites
Steps to reproduce
When using dsc config set for a test powershellgroup resource, I get an error Operation: Failed to parse json from get pwsh|PSDscResources/MSFT_WindowsFeature. However, it then returns a valid json object so it is unclear why it is unable to parse the output.
Sample config code: `# example.dsc.config.yaml $schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json resources:
And example output:
{ "IncludeAllSubFeature": false, "DisplayName": "DNS Server", "Name": "DNS", "Ensure": "Absent" }
When running dsc set the additional error details is
Error: JSON: expected value at line 1 column 1
Expected behavior
Actual behavior
Error details
Environment data
Version
7.3.9
Visuals
No response