Preserving state in BlazorExample not working
Describe the bug currentCount is not preserved in Counter.razor in samples/BlazorExample
Version and Platform CSLA version: 10.0.0-beta-0011-gc72d4fb04f with .NET 10 OS: Windows 11 Platform: .NET 10
Version and Platform CSLA version: 9.1.0 with .NET 9 OS: Windows 11 Platform: .NET 9
Code that Fails
if (applicationContext.LocalContext.Contains("counter"))
{
var value = applicationContext.LocalContext["counter"];
currentCount = value == null ? 0 : (int)value;
}
When reentering the counter page,
applicationContext.LocalContext.Contains("counter")
is not existing any more.
I could provide the complete code, but it is basically the same as in the samples. I only updated some dlls in .NET 9 and changed to CSLA 9.10 and did the same in .NET 10.
Thank you @uwefms - I have confirmed that the solution fails. Don't know why yet, but I appreciate you finding the issue!
In digging deeper, it appears that something changed between net8.0 and net9.0 in terms of how the Blazor render pipeline works - at least that's my working theory since this used to work and now doesn't.
The solution appears to be to add middleware for aspnetcore to maintain the CSLA session id cookie before Blazor does any rendering. Testing that idea now.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.