The type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception. Error with Automapper.

Recently while doing some conversions with Automapper I ran into an error while running it. I was getting the “The type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception.” with an inner exception of “This type is not supported on this platform IDictionaryFactory”. After doing some debugging I finally figured out that it was due to the Automapper dll itself not being copied over during the build process in Visual Studio. After making sure that the dll was copied correctly it fixed the issue.

For some reason Visual Studio occasionally has issues with copying over the dlls that should be copied over. Please note this occurred with Visual Studio 2012.

Edit : @jbogard tweeted that this should be fixed in the current pre-release of Automapper. So this problem should be fixed in the version after 3.0.0.

Mike GriffithThe type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception. Error with Automapper.