An annoying error where the error message made sense but the cause was not obvious:

System.TypeInitializationException: The type initializer for 'MyCallingAssembly' threw an exception. ---> System.TypeLoadException: Method 'Set' in type 'MyAssemblyName.SmartDbContext' from assembly 'MyAssemblyName.DataAccess, Version=, Culture=neutral, PublicKeyToken=null' does not have an implementation

The type SmartDbContext inherits System.Data.Entity.DbContext, which DOES have a Set() method but for some reason, the StructureMap assembly scanner was erroring to say it didn't, and therefore SmartDbContext did not implement ISmartDbContext.Set().

Ignoring these two types in Scan() did not work.

The problem was simply that the consuming and the creating assemblies had different versions of EntityFramework installed. Not very different versions but maybe it was a missing redirect or maybe the interface did break between version.

Anyway, I simply updated both versions of EF to the same version and the error went away.

I am having an Assembly Redirect nightmare week - any suggestions welcome.