microsoft / microsoft/winget-cli
Microsoft.DSC/Include fails in two ways: relative configurationFile resolves from DSC install dir, and valid included config fails with Object vs Array error
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Relevant area(s)
WinGet CLI, DSC Resource
Relevant command(s)
winget configure
Brief description of your issue
Microsoft.DSC/Include appears to fail under winget configure in two separate ways:
-
Relative include paths resolve incorrectly
configurationFile: ./sdk/node.wingetis resolved relative to the installed DSC package directory, not the parent configuration file.
-
Valid included configs fail during test
- If I use a path that does resolve to the child config,
winget configurefails while testingMicrosoft.DSC/Includewith:The requested operation requires an element of type 'Object', but the target element has type 'Array'.
- If I use a path that does resolve to the child config,
The included file succeeds when run directly with winget configure, so the child config itself appears valid.
Steps to reproduce
Repro files
Parent config: configuration.sdk.winget
# yaml-language-server: $schema=https://aka.ms/dsc/schemas/v3/bundled/config/document.vscode.json
# The new Microsoft DSC schema is not aligned (yet) with WinGet Studio
# See https://github.com/microsoft/winget-studio/issues/193
# yaml-language-server-disable https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/config/document.json
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
metadata:
winget:
processor:
identifier: dscv3
resources:
- type: Microsoft.DSC/Include
name: NodeJS
metadata:
description: Install Node.js LTS
properties:
configurationFile: "${WinGetConfigRoot}/sdk/node.winget"
Child config: sdk/node.winget
# yaml-language-server: $schema=https://aka.ms/dsc/schemas/v3/bundled/config/document.vscode.json
# The new Microsoft DSC schema is not aligned (yet) with WinGet Studio
# See https://github.com/microsoft/winget-studio/issues/193
# yaml-language-server-disable https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/config/document.json
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
metadata:
winget:
processor:
identifier: dscv3
resources:
- type: Microsoft.WinGet/Package
name: NodeJS
metadata:
description: Installing Node.js LTS
properties:
id: OpenJS.NodeJS.LTS
source: winget
useLatest: true
Repro steps
Case 1: child config directly
Run the child config directly:
winget configure --accept-configuration-agreements -f .\sdk\node.winget
Case 2: parent config using Include
Run the parent config:
winget configure --accept-configuration-agreements -f .\configuration.sdk.winget
Expected behavior
Both commands should succeed.
In particular:
Microsoft.DSC/Includeshould resolve relativeconfigurationFilepaths from the parent config file location.- A child config that succeeds directly should also succeed when included.
Actual behavior
Relative path case
If I change the parent to use a relative path:
configurationFile: ./sdk/node.winget
the include fails because the path is resolved against the installed DSC package directory:
The configuration unit failed while attempting to test the current system state.
2026-06-06T03:29:25.156426Z ERROR trace_message="PID 27884: Failed to open included file 'C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration_3.2.1.0_x64__8wekyb3d8bbwe\\./sdk/node.winget': The system cannot find the path specified. (os error 3)"
2026-06-06T03:29:25.158673Z ERROR Failed to run process 'dsc': Command: Resource 'dsc' [exit code 2] manifest description: Resource error…
<See the log file for additional details>
Some of the configuration was not applied successfully.
Expanded/absolute path case
If I use a path that does resolve to the child config, the include still fails during test:
2026-06-06 13:17:20.360 [CONF] Configuration unit Microsoft.DSC/Include[NodeJS] failed with code 0x80131509 and error message:
The requested operation requires an element of type 'Object', but the target element has type 'Array'.
System.InvalidOperationException: The requested operation requires an element of type 'Object', but the target element has type 'Array'.
at System.Text.Json.ThrowHelper.ThrowJsonElementWrongTypeException(JsonTokenType expectedType, JsonTokenType actualType)
at System.Text.Json.JsonDocument.TryGetNamedPropertyValue(Int32 index, ReadOnlySpan`1 propertyName, JsonElement& value)
at System.Text.Json.JsonElement.TryGetProperty(ReadOnlySpan`1 propertyName, JsonElement& value)
at System.Text.Json.JsonElement.TryGetProperty(String propertyName, JsonElement& value)
at Microsoft.Management.Configuration.Processor.DSCv3.Schema_2024_04.Outputs.FullItemBase`2.CreateFrom(JsonDocument document, JsonSerializerOptions options)
at Microsoft.Management.Configuration.Processor.DSCv3.Schema_2024_04.DSCv3.TestResource(ConfigurationUnitInternal unitInternal, ProcessorRunSettings runSettings)
at Microsoft.Management.Configuration.Processor.DSCv3.Unit.DSCv3ConfigurationUnitProcessor.TestSettingsInternal()
at Microsoft.Management.Configuration.Processor.Unit.ConfigurationUnitProcessorBase.TestSettings()
Notes
- The child file works when run directly, so this seems specific to the
Microsoft.DSC/Includepath. - This may be either:
- a
winget configureintegration issue, - a DSC v3 importer/result-shape issue,
- or a version/schema mismatch in how include/test results are handled.
- a
- If switching to relative path, and using
dsc config set --file .\configuration.sdk.winget, it works perfectly fine
Environment
- WinGet: `1.29.140-preview`
- Package: `Microsoft.DesktopAppInstaller v1.29.140.0`
- OS: `Windows.Desktop v10.0.26220.8544`
- System Architecture: x64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two cases with configuration.sdk.winget and sdk/node.winget using winget configure, then trace the Microsoft.DSC/Include handling and DSC v3 test-result path. Done means the child config works directly and through the parent, relative paths resolve from the parent file, and the included test no longer reports an Object-versus-Array error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, powershell
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100