Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor A second operation started on this context before a previous operation completed

$
0
0

I makes the NavMenu dynamically and return menu i the database by users and in the index page already i returned something in the database but when i run the application or reload it show me bellow error

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

NavMenu code,

List<Menu> menus = new List<Menu>();protected override async Task OnInitializedAsync(){     menus  = await MenuService.GetMenus();}

Index code

@if (priorities == null){<p><em>Loading...</em></p>}else{<table class="table"><thead><tr><th>Name</th> </tr></thead><tbody>            @foreach (var priority in priorities)            {<tr><td>@priority.Name</td></tr>            }</tbody></table>}@code {     List<Priority> priorities;    protected override async Task OnInitializedAsync()    {         priorities = await PriorityService.GetPriorities();    }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>