Error since upgrading to 4.1

1 year ago
I am getting these errors now since I upgraded to 4.1. They happen even more when i am debugging the site in visual studio.

System.InvalidOperationException: A second operation started on this context before a previous operation completed. Any instance members are not guaranteed to be thread safe.
   at Microsoft.EntityFrameworkCore.Internal.ConcurrencyDetector.EnterCriticalSection()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
   at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Nop.Services.Catalog.ReviewTypeService.<>c__DisplayClass10_0.<GetProductReviewReviewTypeMappingsByProductReviewId>b__0() in C:\Projects\Main\NopCommerce\lifeseasons.com.4.1\Libraries\Nop.Services\Catalog\ReviewTypeService.cs:line 135
   at Nop.Core.Caching.MemoryCacheManager.Get[T](String key, Func`1 acquire, Nullable`1 cacheTime) in C:\Projects\Main\NopCommerce\lifeseasons.com.4.1\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 152
   at Nop.Services.Catalog.ReviewTypeService.GetProductReviewReviewTypeMappingsByProductReviewId(Int32 productReviewId) in C:\Projects\Main\NopCommerce\lifeseasons.com.4.1\Libraries\Nop.Services\Catalog\ReviewTypeService.cs:line 133
   at Nop.Web.Factories.ProductModelFactory.PrepareProductReviewsModel(ProductReviewsModel model, Product product) in C:\Projects\Main\NopCommerce\lifeseasons.com.4.1\Presentation\Nop.Web\Factories\ProductModelFactory.cs:line 1440
1 year ago
Have you customised the solution or are you using an special plugins ?

Maybe there are tasks running in the background that are acting on the same context you are debugging
1 year ago
Looks like there is some issue with "ReviewTypeService.cs" class. Do you have any customization or custom plugin or any third party plugin?

Looking at that might help you.
1 year ago
Thanks for the responses. I have not made any customizations to the core code. It happens randomly whether the call is made from custom plugin, custom thing, or regular core nop code
1 year ago
Does it always happen "at Nop.Services.Catalog.ReviewTypeService", or does that change in the error message?

Do you have any long running Scheduled Tasks?
1 year ago
it happens in other classes as well, and there are no long running tasks. in fact, on my dev machine, i have all scheduled tasks disabled, and it still happens