From time to time I get a null reference exception from RadzenTheme.Dispose(). Here's the exception:
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HNA3JDUNOT88", Request id "0HNA3JDUNOT88:00000001": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
at Radzen.Blazor.RadzenTheme.Dispose()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.DisposeAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Http.Features.RequestServicesFeature.g__Awaited|9_0(RequestServicesFeature servicesFeature, ValueTask vt)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.g__ProcessEvents|242_0(HttpProtocol protocol, Stack`1 events)
Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HNA3JDUNOT88", Request id "0HNA3JDUNOT88:00000001": An unhandled exception was thrown by the application.System.NullReferenceException: Object reference not set to an instance of an object.
at Radzen.Blazor.RadzenTheme.Dispose()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.DisposeAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Http.Features.RequestServicesFeature.g__Awaited|9_0(RequestServicesFeature servicesFeature, ValueTask vt)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.g__ProcessEvents|242_0(HttpProtocol protocol, Stack`1 events)
The program 'dotnet' has exited with code 0 (0x0).
When I look at the code of RadzenTheme.cs in GitHub I see 2 possible null reference possibilities: ThemeService is null or persistingSubscription is null.
/// <summary>
/// Releases all resources used by the component.
/// </summary>
public void Dispose()
{
ThemeService.ThemeChanged -= OnThemeChanged;
persistingSubscription.Dispose();
}