Config reload not occuring
See original GitHub issueDescription
When you set the TimeSpan to reload the configuration in the sample, the configuration does not reload.
Reproduction Steps
- Run the sample code, with timespans placed in for reload of configuration. Provide an override level in the configuration:
config.AddSystemsManager($"/dotnet-aws-samples/systems-manager-sample/common", new System.TimeSpan(0, 0, 5) ); config.AddSystemsManager($"/dotnet-aws-samples/systems-manager-sample/{env.EnvironmentName}", new System.TimeSpan(0, 0, 5) );
The reload of 5 seconds never happens if I update the value of environment named configurations.
It seems that if I replace the IOptions with IOptionsSnapshot, the reload works.
I am not sure if this is a change in dotnet core or not, but it no longer seems to work.
Environment
- Build Version: 2.1.1
- OS Info: OSX - 10.15.7
- Build Environment: VSCode
- Targeted .NET Platform: 2.1 (according to sample) but we see same results in 5.0
Resolution
I guess the sample should be upgraded to use IOptionsSnapshot and maybe some documentation around that. Overall, the configuration management still works, but there is a bit of a rabbit hole to figure out the solution. I can for and create a PR if you like.
This is a 🐛 bug-report
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (4 by maintainers)
Top GitHub Comments
Hey @jsauter, that’s intended behavior.
You can see the details for IOptions and IOptionsSnapshot at Options pattern in ASP.NET Core
Specifically the lines:
IOptions<TOptions>:
IOptionsSnapshot<TOptions>:
@ashishdhingra great finding about the scope in the console application!