Closed rramer-web-com closed 7 months ago
We have been able to recreate this in the repo by using the ShowToast<TComponent>
method where ToastSettings
is not a parameter. This method sets ToastSettings
to null which resulted in ShowProgressBar
also being null. According to this line, ShowProgressBar
cannot be null.
PR with a proposed fix here: https://github.com/Blazored/Toast/pull/255
Version is 4.2.1 and I have the issue: NullReferenceException: Object reference not set to an instance of an object. Blazored.Toast.BlazoredToast.OnInitializedAsync()
I just have <BlazoredToast />
in MainLayout.razor on the client and it throws on app startup in the browser.
If we need to provide ToastSettings it is very inconvenient because it requires a bunch of arguments provided.
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:
It looks like the breaking changes were in the following commit which changed ShowProgressBar from
bool
tobool?
Fix settings to allow instance settings to override global settings (https://github.com/Blazored/Toast/pull/226[)](https://github.com/Blazored/Toast/commit/1f0f1d839ea0177798f6712aff29646fbbacc78a)
BlazoredToasts.BuildCustomToastSettings(Action? settings) might need to define a sensible default.