API - Setting Chocolatey Config reloads previous in memory values when attempting to set empty values
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
### Checklist
- [x] I confirm there are no unresolved issues reported on the [Chocolatey Status page](https://status.chocolatey.org).
- [x] I have verified this is the correct repository for opening this issue.
- [x] I have verified no other issues exist related to my problem.
- [x] I have verified this is not an issue for a specific package.
- [x] I have verified this issue is not security related.
- [x] I confirm I am using **official**, and **not** unofficial, or modified, Chocolatey products.
### What You Are Seeing?
When attempting to set new values for the Chocolatey Configuration through the `Config.Set` method, and one of the changes properties (as an example the proxy URL) have changed from a valid URL to an empty string (or null), then the call reloads back to the URL that had previously been acquired, even when the configuration file on disk have unset (or set the value to empty).
### What is Expected?
I would expect the `Config.Set` method to honor the values that are specified on the Configuration object that is passed in to the handler, even when the property has been set to null or empty.
### How Did You Get This To Happen?
TODO: Need to update this with reproducible step once a simple example project is created.
### User Story
I as a maintainer of a program that uses the Chocolatey API to reload the configuration,
I want to have the ability to set the proper configuration values,
so that I do not have to relaunch the application to be up to date.
### System Details
* Operating System: Windows 11
* Windows PowerShell version: 5.1
* Chocolatey CLI Version: 2.7.2
* Chocolatey Licensed Extension version: 8.1.0
* Chocolatey License type: Business
* Terminal/Emulator: Tabby
### Installed Packages
```bash
N/A, it is completely unrelated to any packages installed.
```
### Output Log
```bash
Currently do not have any output log available for this.
```
### Additional Context
_No response_
### Acceptance Criteria
Unknown at this point. Could be a change to the API itself, or a fix to the config object.
### Related Issues
- https://github.com/chocolatey/ChocolateyGUI/issues/1098
┆Issue is synchronized with this [Clickup task](https://app.clickup.com/t/868jvv7ag) by [Unito](https://www.unito.io)
Contributor guide
Research direction
Start at the Config.Set API and the configuration object described in the issue, then create the promised simple example to reproduce changing a previously set value to an empty string or null. Trace how the in-memory configuration is reloaded and compare it with the configuration file on disk. Done means Config.Set preserves explicitly supplied empty values without requiring the application to relaunch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100