I have a blocking time in the automapper ProjectTo in .NET Framework App

33 Views Asked by At

I have some mysterious blocking time apparently in the mapper's ProjectTo method which I can't reproduce locally (probably because of the load). It works fine but after a while (random) response time and thread count spike.

Web App is in .NET Framework 4.8 and Automapper version is 10.1.1

This is what I saw in the profiler:

enter image description here

Mapping in question is very simple:

 items = context.Extras
     .Where(r => ...)
     .ProjectTo<ExtraDTO>(mapper.ConfigurationProvider,
                                          x => x.VehicleExtra)
     .ToList();

And mapping itself:

CreateMap<Extra, ExtraDTO>()
    .ForMember(dest => dest.VehicleRental, opt => opt.Ignore())
    .ForMember(dest => dest.VehicleExtra, opt => opt.ExplicitExpansion());

What caught my eye is that this is called in a loop for the problematic requests, maybe around 100 times or so. I know that this should be refactored so I have one call, but this block never happened before and this was not changed.

Any ideas why this might be happening? We are using Automapper for a while and this never happened.

0

There are 0 best solutions below