5

I have just upgraded to v8 of AutoMapper and the expression below fails but I really cannot see why.

cfg.CreateMap<string, Nmtoken>()
    .ConstructUsing(i => new Nmtoken(i))                
    .ForMember(m => m.Token, o => o.MapFrom(s => s));

I believe that the passed expressions are valid. I get no build errors and intellisense is happy. But I get runtime error:

System.MissingMethodException: 'Method not found: 
'AutoMapper.IMappingExpression`2<!0,!1> 
AutoMapper.IMappingExpression`2.ConstructUsing(System.Func`2<!0,!1>)'.'

I'm happy to admit that I don't understand the error message.

phil
  • 1,938
  • 4
  • 23
  • 33

2 Answers2

1

Apologies. I have two projects linked with a dependency and one of them was still using AutoMapper 7.

phil
  • 1,938
  • 4
  • 23
  • 33
1

I had the samme issue, but i was using AutoMapper v8.0.0. Upgrading to version v8.1.0 solved the issue.

Rasmus-E
  • 832
  • 1
  • 8
  • 15