-1



I am having some trouble getting AutoMapper (3.2.1.0) to work on a iPad during debug using Xamarin. I have setup the mac to work as a build host using Xamarin studio 3 and Xamarin.iOS 7.2.3.39. On my Windows system I use Visual Studio 2012.

In my solution I have two projects:
- PortableClassLibrary
- MySampleApplication

In the PortableClassLibrary project I have the following code:

Mapper.CreateMap<MyEntity, MyModel>()
    .ForMember(ev => ev.Name, m => m.MapFrom(a => a.MyName));

When run the debugger I get the following exception:

“Unhandled Exception:
System.ExecutionEngineException: Attempting to JIT compile method 
'AutoMapper.Internal.DictionaryFactory:CreateDictionary<AutoMapper.Impl.TypePair,
AutoMapper.TypeMap> ()' while running with --aot-only. See  
http://docs.xamarin.com/ios/about/limitations for more information.”

I did try to use
..\packages\AutoMapper.3.2.1\lib\portable-windows8+net40+wp8+wpa81+sl5+MonoAndroid+MonoTouch\AutoMapper.dll
And
..\packages\AutoMapper.3.2.1\lib\portable-windows8+net40+wp8+sl5+MonoAndroid+MonoTouch \AutoMapper.dll

But this makes no difference regarding the exception.

I look like that Automapper is trying to create a dictionary using value types, but is is one of the limitations described in the given url.

Is there something I am missing to get this working?

Cheers,

André

  • Did you find a fix to this? I am getting the exact same error... – Joseph Jun 15 '14 at 13:25
  • No, still having the problem. I did send a message to the AutoMapper-user mailing list, but for now there isn't a solution. To reproduce the problem a device is needed to debug. – André Barendse Jun 17 '14 at 11:21
  • I managed to fix the issue by cleaning my solution several times and then it went away. I'm not sure what the problem was, but I had exactly the same issue as you posted. – Joseph Jun 18 '14 at 11:15
  • Worked for me. I'm using Xamarin Forms across ios, android and win phone. Added xaml forms, viewmodels and models. Viewmodels have bindings to xaml forms with observablecollections, models are purely data members and lists. Using automapper to populate the view models using models, all good so far on ios, about to try android and win phone.... – Gary Davies Dec 04 '14 at 01:39

1 Answers1

1

Also add AutoMapper nuget to the ios app project. This adds native support.

Softlion
  • 12,281
  • 11
  • 58
  • 88