I am using asp.net core api with EF core and today I got this error message and it confuses me as of why it could have happened.
Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. at System.Collections.Generic.Dictionary`2.FindEntry(TKey key) at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) at Mapster.TypeAdapterConfig.Remove(TypeTuple key) at Mapster.TypeAdapterConfig.NewConfig[TSource,TDestination]() at InventoryService.GetCategories(Int32 inventoryCenterId) at Controllers.InventoriesController.GetCategories(Int32 centerId)
this is the code it is referring to.
TypeAdapterConfig<Category, CategoryDto> .NewConfig() .IgnoreIf((src, dest) => string.IsNullOrEmpty(src.MetaTitle), dest => dest.MetaTitle) .IgnoreIf((src, dest) => string.IsNullOrEmpty(src.MetaDescription), dest => dest.MetaDescription); var categories = dbContext.Centers.Where(x => x.Id == CenterId).SelectMany(x => x.Categories).OrderBy(x => x.Name).ToList(); return categories.Adapt<List<CategoryDto>>();
It seemed like anyone who tried to access that method go the same error. I did an IIS reset and all was good but I am trying to figure out what happened.
Not sure what else to add.