I am getting the following exception when calling any of my Mapper.Map methods.
Inheritance security rules violated while overriding member: ‘Castle.Core.Logging.LevelFilteredLogger.InitializeLifetimeService()’.
Security accessibility of the overriding method must match the
security accessibility of the method being overriden.
I am using the latest build of AutoMapper downloaded from codeplex inside my S#arp 1.6 application running on .Net 4.0 (which is using version 1.2.0.6623 of Castle.Core).
I beleive it has something to do with the new .Net 4.0 security settings which I don’t quite understand.
Is there a way to fix it?
Paul
I tried something from a little googling which fixed my problem, i’m not sure if this is the ideal or recommended approach but it worked.
I added this to the Automapper projects ‘AssemblyInfo.cs’ file:
I recompiled and used the new DLL and everything worked fine.
Please leave comments if this isn’t reccomended or if there is a better approach.
For now though i will leave my own answer as the correct one.
Thanks for the help though!
UPDATE:
My mappings are pretty simple, sorry about all the code but thought it may help you:
Initialisation Code:
LeadsProfile.cs
Source Class
Destination Dto’s