microsoft / microsoft/winget-cli
Configuration COM API always provides an input to dsc, even when none is specified
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)
COM API
Relevant command(s)
No response
Brief description of your issue
When using the COM API to run dsc resource get, it always passes an --input to the DSC command. Some resources, like Microsoft.WinGet/UserSettingsFile, don’t actually expect any input for the Get method. But since input is provided anyway, DSC tries to validate it against the schema, which in this case requires the settings property. To get around this, I just include an empty settings object in the input to satisfy the validation.
Steps to reproduce
ConfigurationStaticFunctions config = new();
var processor = await CreateConfigurationProcessorAsync(DSCv3);
var input = config.CreateConfigurationUnit();
input.Type = "Microsoft.WinGet/UserSettingsFile";
var result = await Task.Run(() => processor.GetUnitSettings(input));
Expected behavior
If you're using the COM API and don't have an input for a unit, just leave out the --input flag when running the dsc command.
Actual behavior
Even when no input is actually given, the --input flag is still included by default.
Environment
N/A
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 at the COM API path using ConfigurationStaticFunctions, CreateConfigurationProcessorAsync, and GetUnitSettings, then trace how the dsc command arguments are assembled. Compare the reproduced unit with the expected behavior and verify that --input is omitted when no input is provided.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100