Authentication errors when upgrading from v8.0.0-R24031302 to v8.0.0-R24032503 / v8.0.1 #3815
Replies: 7 comments 24 replies
-
I did the same thing but rolled back because of the error, so I'm interested in this too. |
Beta Was this translation helpful? Give feedback.
-
Where does the service live? Is it in a hosted service besides the blazor stack? |
Beta Was this translation helpful? Give feedback.
-
Yes, there's a config change that's necessary. CSLA 8 defaults to using the new state management subsystem, and if you are doing a pure render mode (like .NET 7) app you need to use the "in memory" state management. builder.Services.AddCsla(o => o
.AddAspNetCore()
.AddServerSideBlazor(ssb => ssb.UseInMemoryApplicationContextManager = true)); cc @russblair as this is what we were just discussing |
Beta Was this translation helpful? Give feedback.
-
IMHO, I think .NET 8 release is way more than just a breaking change. I get the sense from reading the conversations here that it is a fundamental shift for Blazor communication. Does anyone know why such a change is warranted and what benefit it will bring? |
Beta Was this translation helpful? Give feedback.
-
I'm wondering if .NET 8 changed the error and message such that this little test we added in CSLA 6 and .NET 6 is no longer catching the condition (which would explain why it happens for both inmemory and not) : See both:
private void InitializeUser()
{
Task<AuthenticationState> task = default;
try
{
task = AuthenticationStateProvider.GetAuthenticationStateAsync();
}
catch (InvalidOperationException ex)
{
task = Task.FromResult(new AuthenticationState(UnauthenticatedPrincipal));
string message = ex.Message;
if (message.Contains(nameof(AuthenticationStateProvider.GetAuthenticationStateAsync))
&& message.Contains(nameof(IHostEnvironmentAuthenticationStateProvider.SetAuthenticationState)))
{
SetHostPrincipal(task);
}
else
{
throw;
}
}
AuthenticationStateProvider_AuthenticationStateChanged(task);
} If I get some time I will debug to see if we are hitting that condition and passing over it because the error message possibly no longer mentions the "SetAuthenticationState" part like it used to? |
Beta Was this translation helpful? Give feedback.
-
Will be fixed in #3903 (CSLA 9) |
Beta Was this translation helpful? Give feedback.
-
Should be fixed in #3964 |
Beta Was this translation helpful? Give feedback.
-
I have a pure server-side Blazor up that was successfully upgraded from .net 7 using csla 7 to .net 8 using v8.0.0-R24031302.
Since I am only using Blazor server-side, I have made no configuration changes for the new Blazor render modes.
Upgrading from v8.0.0-R24031302 to v8.0.0-R24032503 or v8.0.0 or v8.0.1 returns 2 exceptions. I am not sure if it is related.
The first one is due to the ApplicationContext.User.Identity that returns null. Previously this always had a value.

Screenshot of issue where the ApplicationContext was injected into a service:
The next one gives me the following error:
Is there any configuration changes required to use the latest version of csla or is this a possible bug?
Beta Was this translation helpful? Give feedback.
All reactions