Toast
Toast copied to clipboard
[Bug] BlazoredToast.OnInitializedAsync null reference exception in 4.2.0
In 4.2.0, Settings.ShowProgressBar is null in BlazoredToast.OnInitializedAsync when using a ToastService.ShowToast method without explicitly providing optional settings that override ShowProgressBar.
ex. _toastService.ShowToast<Alert>(toastParameters);
This leads to the following runtime error:
Error: System.InvalidOperationException: Nullable object must have a value.
at System.Nullable`1.get_Value()
at Blazored.Toast.BlazoredToast.OnInitializedAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
It looks like the breaking changes were in the following commit which changed ShowProgressBar from bool to bool?
Fix settings to allow instance settings to override global settings (https://github.com/Blazored/Toast/pull/226)
BlazoredToasts.BuildCustomToastSettings(Action<ToastSettings>? settings) might need to define a sensible default.