Skip to content

Blazor: ApplicationContextManagerBlazor/InMemory does not await a task which could have an exception #3897

@StefanOssendorf

Description

@StefanOssendorf

As discuessed in #3815 (comment) there is a potential bug in ApplicationContextManagerBlazor and ApplicationContextManagerInMemory.

See the following code:

try
{
task = AuthenticationStateProvider.GetAuthenticationStateAsync();
}
catch (InvalidOperationException ex)

try
{
task = AuthenticationStateProvider.GetAuthenticationStateAsync();
}
catch (InvalidOperationException ex)

In both cases the task is retrieved but not awaited which means an implementation of GetAuthenticationStateAsync() with real async code does not raise any exception here.
The ServerAuthenticationStateProvider throws an exception without bein async which means the exception is immediately thrown and not when the task is awaited. (c.f. #3815 (reply in thread))

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions