Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.IO;
using System.Runtime.ExceptionServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;

Expand All @@ -33,10 +33,21 @@ public FileConfigurationProvider(FileConfigurationSource source)
{
_changeTokenRegistration = ChangeToken.OnChange(
() => Source.FileProvider.Watch(Source.Path!),
() =>
async () =>
{
Thread.Sleep(Source.ReloadDelay);
Comment thread
tarekgh marked this conversation as resolved.
Load(reload: true);
await Task.Delay(Source.ReloadDelay).ConfigureAwait(false);
try
{
Load(reload: true);
}
catch
{
// Load already surfaces reload failures through the
// FileConfigurationSource.OnLoadException callback. Any exception that
// escapes here is usually swallowed by OnChange or by the FileProvider,
// so swallow it here instead, to make it clear this is the intended behavior
// and to make it more consistent.
}
Comment thread
svick marked this conversation as resolved.
});
Comment thread
tarekgh marked this conversation as resolved.
}
}
Expand Down
Loading