I have a class CustomConfigurationProvider : ConfigurationProvider
with the method:
public override void Load()
{
// Load values into this.Data
...
//
this.OnReload();
}
This loads options classes that are configured in startup:services.Configure<MyOptions>(this.Configuration.GetSection("path:to:myOptions"));
Then I inject an IOptionsMonitor<MyOptions>
into the class that needs these options.
This was all working fine in .NET core 2.2, with the IOptionsMonitor getting new values when they were updated. After upgrading to 3.1, I see the CustomConfigurationProvider load new values into the dictionary and call OnReload, but the IOptionsMonitor never gets new values.
An IOptionsSnapshot will get new values, so it seems the provider is loading them correctly. The IOptionsMonitors just never get notified, and I can't use snapshots everywhere because I have a singleton taking options.
Am I missing something? Maybe related to ChangeTokens?