Currently we are running AutoMapper 1.0.1.156 in production on a WCF webservice and after about a week or so we will start to get the following error (note this was also happening in 0.4.0.126 but we couldn't get a stack trace because we only had the .dll from codeplex and no .pdb):
Trying to map DataAccess.Call to DataTypes.Call.
Using mapping configuration for DataAccess.Call to DataTypes.Call
Exception of type 'AutoMapper.AutoMapperMappingException' was thrown.
at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContext context) in C:\Work\AutoMapper\src\AutoMapper\MappingEngine.cs:line 154
at AutoMapper.MappingEngine.Map(Object source, Type sourceType, Type destinationType) in C:\Work\AutoMapper\src\AutoMapper\MappingEngine.cs:line 104
at AutoMapper.MappingEngine.Map[TSource,TDestination](TSource source) in C:\Work\AutoMapper\src\AutoMapper\MappingEngine.cs:line 34
at AutoMapper.Mapper.Map[TSource,TDestination](TSource source) in C:\Work\AutoMapper\src\AutoMapper\Mapper.cs:line 21
Here is the mapping configuration for the Map being executed when the error happens:
Mapper.CreateMap<DataAccess.Call, DataTypes.Call>()
.ForMember(dest => dest.CallTypeId, opt => opt.MapFrom(src => src.CallType))
.ForMember(dest => dest.CallType, opt => opt.MapFrom(src => (DataTypes.CallType)src.CallType));
The code runs find for about a week or so with no errors. Once we start getting errors, if we recycle the application pool for the WCF webservice, the error goes away.
I have double checked, triple checked, and rechecked that src.CallType can not possibly contain any values which are not in the enum DataTypes.CallType.
The class/enum definitions are at http://pastebin.com/2pF0gFZ2
Searched all over and couldn't find anybody else having this issue.