Method 'GetEnumerator' in type Proxy<IEnumerable> does not have implementation

Method 'GetEnumerator' in type Proxy<IEnumerable> does not have implementation

method products
method company
method cleaning products where to buy
method disinfectant
method logo
method:crm
method hand soap
method laundry detergent

When using AutoMapper I get the following error

Method 'GetEnumerator' in type 'Proxy' from assembly 'AutoMapper.Proxies, Version=0.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005' does not have an implementation.

In my repository I have a private method

private IMapper GetMapper()
{
    var config = new MapperConfiguration(cfg => {
        cfg.CreateMap<MyClass, PersistenceModels.MyClass>();
        cfg.CreateMap<IEnumerable<PersistenceModels.MyClass>, IEnumerable<MyClass>>();
    });

    return new Mapper(config);
}

And then I use this as follows

var mapper = GetMapper();
var userInfo = mapper.Map<IEnumerable<PersistenceModels.MyClass>, IEnumerable<MyClass>>(userInfoRaw);

The MyClass types are identical and have an IEnumerable property

public IEnumerable<string> ImageUris { get; set; }

Any ideas how to solve this?

Edit

I am not mapping types defined by interface, I am mapping collections of concrete types, hence the IEnumerable interface.


The solution was not to use IEnumerable when creating maps, only when using the map.

So, in the configuration I changed from

cfg.CreateMap<IEnumerable<PersistenceModels.MyClass>, IEnumerable<MyClass>>();

to

cfg.CreateMap<PersistenceModels.MyClass, MyClass>();

and everything worked.

method – people against dirty, Shop Target for Method. For a wide assortment of Method visit Target.com today. Free shipping on orders of $35+ & save 5% with your Target RedCard. Get Method today with Drive Up, Pick Up or Same Day Delivery. Save 5% on Method with RedCard. Delivered in as little as 2 hours.


I hit the same problem. I guess AutoMapper wants to be told which implementation of IEnumerable to use for the target, so the following worked for me.

cfg.CreateMap<IEnumerable<PersistenceModels.MyClass>, List<MyClass>>();
                                                      ^^^^

shop, Everyday Clean. Can't find what you're looking for? We've got you covered. Discover our most loved products. Everyday Clean. method Foaming Hand Soap​  naturally-derived, biodegradable, non-toxic household cleaners, laundry supplies, personal care + soap. shop online or find out where to buy method.


This is older, but might help if you came here from Google...

Given:

cfg.CreateMap<PersistenceModels.MyClass, MyClass>();

You need to IEnumerable your destination:

var perData = dbContext.SomeDbSet.Where(.....);
var mapData = Mapper.Map<IEnumerable<MyClass>>(perData);

Method, Method All Purpose Cleaning Wipes. Use them anywhere. Handy in every room in the house. Oh and they are compostable** and smell great. Divine. Method is a professional esports organisation with teams, World of Warcraft Guides, Videos, Streams and News.


Same issue happens when using IList. So switch from IEnumerable or IList to List in destination type. It should work.

Method : Target, Buy Method All-Purpose Cleaner, French Lavender, 28 Ounce on Amazon.com ✓ FREE SHIPPING on qualified orders. method: [noun] a procedure or process for attaining an object: such as. a systematic procedure, technique, or mode of inquiry employed by or proper to a particular discipline or art. a systematic plan followed in presenting material for instruction. a way, technique, or process of or for doing something. a body of skills or techniques.


It is unneccessary : mapper.Map<IEnumerable<PersistenceModels.MyClass>, IEnumerable<MyClass>>(userInfoRaw); you must use just type map (without collections):

mapper.Map<PersistenceModels.MyClass, MyClass>(userInfoRaw);

method, Getting our start as a World of Warcraft guild, Method is now a global, world championship winning esports organisation. Founded in 2005 by Scott 'Sco' McMil Method definition, a procedure, technique, or way of doing something, especially in accordance with a definite plan: There are three possible methods of repairing this motor.


Method, We create value and impact through the design of meaningful brands, digital products, and service experiences. Directed by Nicholas James Reilly. With Bailey Anne Borders, Miska Kajanus, Callie Ott, Nicholas James Reilly. A young actress books the role of a lifetime only to discover just how far the director is willing to go to capture reality.


Method All-Purpose Cleaner, French Lavender, 28 , clean happy with method's nature inspired, non-toxic + non animal-tested cleaning products, laundry detergents, air fresheners, and hand + body wash.


Method, Method’s two-way integration with QuickBooks is the best in the industry — and we’ve got the patent to prove it. Learn more about our QuickBooks CRM Solutions for every workflow