Wednesday, August 13, 2014

AutoMapper And LoaderExceptions Problems

When setting up a website in IIS6 with a bunch of NuGet packages installed and having only just pulled down a fresh copy of the code base from SVN I discovered a number of baffling problems. They all boiled down to the same basic issue.

Firstly, there was the "Retrieve the LoaderExceptions" message on the yellow screen of death. This was not helpful but the most I could discern was that the objects that AutoMapper was trying to instantiate were not accessible for some reason. Initially this looked like a database connectivity failure, but it turned out to be the wrong version of AutoMapper. Although the base project had the correct version of the DLL, one of the dependency projects was referencing the wrong DLL - all this through auto-update with NuGet. Here's what the exception looked like:

The second problem was the "Value cannot be null" which equates to the same problem - that one of the objects cannot be instantiated because AutoMapper is the wrong version and not compatible.

The last option is to try changing the App Pool in IIS if you see this:

Here are some references from StackOverflow:


No comments:

Post a Comment