Why is Automapper.ProjectTo() throwing a null reference exception?
问题 I have a mapping: var config = new MapperConfiguration(cfg => { cfg.CreateMap<Foo, FooDto>() .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id)) .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name)) .ForMember(dest => dest.PhoneNumber, opt => opt.MapFrom(src => src.PhoneNumbers.Number)) //etc. }); and I'm trying to use it in a unit test calling into some mocked up EF objects: var ids = new List<string>() { "123"; "456"; "789"; }; var data = new List<Foo>(); foreach(var