Skip to content

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. #13259

@chobo2

Description

@chobo2

Hi
I am getting this error

   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) 

The code it is pointing to is this

  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>>();

Starting and stopping IIS fixes this for a certain amount of time and then it comes back.

I found these related issues

#4970

DuendeArchive/IdentityServer4#2453

but I am using 2.2 for Aspnet Core and Ef Core 2.2.4 and they where using older versions.

edit

I ran on the the server this opersation

(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name

and I am getting version 2.2.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesquestion

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions