diff --git a/src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSource.cs b/src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSource.cs index cb1a0090b008d..72c722eebe097 100644 --- a/src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSource.cs +++ b/src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSource.cs @@ -24,7 +24,7 @@ internal class RazorComponentEndpointDataSource<[DynamicallyAccessedMembers(Comp private readonly IApplicationBuilder _applicationBuilder; private readonly RenderModeEndpointProvider[] _renderModeEndpointProviders; private readonly RazorComponentEndpointFactory _factory; - private readonly HotReloadService _hotReloadService; + private readonly HotReloadService? _hotReloadService; private List? _endpoints; private CancellationTokenSource _cancellationTokenSource; private IChangeToken _changeToken; @@ -38,7 +38,7 @@ public RazorComponentEndpointDataSource( IEnumerable renderModeEndpointProviders, IApplicationBuilder applicationBuilder, RazorComponentEndpointFactory factory, - HotReloadService hotReloadService) + HotReloadService? hotReloadService) { _builder = builder; _applicationBuilder = applicationBuilder; @@ -137,7 +137,7 @@ private void UpdateEndpoints() _cancellationTokenSource = new CancellationTokenSource(); _changeToken = new CancellationChangeToken(_cancellationTokenSource.Token); oldCancellationTokenSource?.Cancel(); - if (_hotReloadService.MetadataUpdateSupported) + if (_hotReloadService is { MetadataUpdateSupported : true }) { ChangeToken.OnChange(_hotReloadService.GetChangeToken, UpdateEndpoints); } diff --git a/src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSourceFactory.cs b/src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSourceFactory.cs index 3c93276ec8582..631fa918f6c60 100644 --- a/src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSourceFactory.cs +++ b/src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSourceFactory.cs @@ -14,12 +14,12 @@ internal class RazorComponentEndpointDataSourceFactory { private readonly RazorComponentEndpointFactory _factory; private readonly IEnumerable _providers; - private readonly HotReloadService _hotReloadService; + private readonly HotReloadService? _hotReloadService; public RazorComponentEndpointDataSourceFactory( RazorComponentEndpointFactory factory, IEnumerable providers, - HotReloadService hotReloadService) + HotReloadService? hotReloadService) { _factory = factory; _providers = providers;