Automapper Initialize Configuration does not return - possible infinite loop

109 Views Asked by At

We have just upgraded from Automapper 4 to Automapper 10 (I have also repeated the same problem on Automapper 8.1.1)

I am unable to initialise the Automapper. T is a Profile class with CreateMap calls.

  var configuration = new MapperConfiguration(cfg =>
        {
            cfg.AddProfile<T>();
                
        });

After cfg.AddProfile it disappears into endless loops and never returns. It consumes 2GB of Memory before I pull the pin (this takes a few minutes). I've debugged into AutoMapper (this is from 8.1.1) and inside MapperConfiguration it calls a method Seal(); This is where it goes into loops.

The Profile class has 1200 calls to CreateMap

Any suggestions? Automapper 4 worked well, except for a few cases where it would randomly return a null reference exception trying to find a map.

This is .Net Framework 4.7.2 and Automapper 8.1.1 (and also with Automapper 10).

0

There are 0 best solutions below