Hi @Franck J ,
According to your sample code, you are creating a Blazor Server application and use the Blazored SessionStorage, right?
I have tested your code on my side, if I set debugger on the GetItemAsync or ContainKeyAsync part of the code in the NavMenu.razor page, the session storage related code will not run continue and there is no error and exception. But if we move this part of code from the RecupInfo
method to the OnAfterRender
method, everything works well.
The result is like this:
So, the issue might relate the Blazored SessionStorage package, it not working in the onchange event. But from the usage of the Blazored SessionStorage, we can't find any description about that.
As a workaround, you could try to move the GetItemAsync or ContainKeyAsync part of the code from the RecupInfo
method to the OnAfterRender
method. And you could also submit feedback to Blazored SessionStorage.
Besides, you could also try to use the Protected Browser Storage to store the data, see ASP.NET Core Protected Browser Storage
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion