0

Automapper throws mapping configuration errors when we try to run load tests (using Visual Studio) against our site.

There are no errors when we access the site through the browser normally, or when stepping through the code while debugging, etc. So it appears that the mappings are fine.

Does anyone know why Automapper would be throwing these exceptions during load testing?

camainc
  • 3,750
  • 7
  • 35
  • 46
  • 1
    Maybe you are experiencing some threading problems... http://stackoverflow.com/questions/10649250/is-mapper-map-in-automapper-thread-safe/10650440#10650440 – nemesv Mar 27 '14 at 16:19
  • AFAIK, AutoMapper configuration is only meant to be done once per process. So, at startup all the `CreateMap<>` calls should be made. – Davin Tryon Mar 27 '14 at 16:23
  • I had the code to create the maps in global.asax, but it was still happening. For now I have just removed AutoMapper until I can find out why this is happening. – camainc Mar 27 '14 at 18:54

1 Answers1

0

You can reset the mapper on initiation with

 Mapper.Reset();

This may help handle the multiple threads load testing will create.

Robert
  • 4,306
  • 11
  • 45
  • 95