dotnet / dotnet/aspnetcore

NET8 and Blazor in the user profile with Microsoft Identity raises an error

Open
#51,635 5 comments 0 reactions 0 assignees View on GitHub
area-identity enhancement feature-blazor-server-auth
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

I'm creating a new website with Blazor and the NET8 framework using the boilerplate from Visual Studio 2022 Preview. The source code of this test is on [GitHub](https://github.com/erossini/NET8BlazorIdentity).

I'm trying to customize the pages and in particular the _Index.razor_ under _Components > Pages > Account > Manage_. So, I added the properties in the `ApplicationUser` model. After those changes, when I click around the page, I often get this error

> A second operation was started on this context instance before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext. For more information on how to avoid threading issues with DbContext, see https://go.microsoft.com/fwlink/?linkid=2097913.

I recorded my actions in this screenshot.

![blazoridentity-error](https://github.com/dotnet/aspnetcore/assets/9497415/4fadda0c-346a-45f0-9463-c2d38af6a028)

### Expected Behavior

Not get this error

### Steps To Reproduce

In my repo on [GitHub](https://github.com/erossini/NET8BlazorIdentity) you have the full source code.

### Exceptions (if any)

A second operation was started on this context instance before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext. For more information on how to avoid threading issues with DbContext, see https://go.microsoft.com/fwlink/?linkid=2097913.

### .NET Version

8.0.0-rc.2.23480.1

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.