Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedException on Xamarin.iOS with linking enabled #686

Closed
geirsagberg opened this issue Mar 5, 2015 · 2 comments
Closed

NotImplementedException on Xamarin.iOS with linking enabled #686

geirsagberg opened this issue Mar 5, 2015 · 2 comments

Comments

@geirsagberg
Copy link

I have the following code:

        Mapper.CreateMap<ShopItem, ShopItemViewModel>()
            .ForMember(s => s.ImageUrl, o => o.MapFrom(si => si.ImageGuid != null ? Urls.FileServiceUrl + "/" + si.ImageGuid : si.ImageUrl));

When I compile with "Don't link assemblies", everything works as expected, but when I select "Link SDK Assemblies only", it fails at runtime with the stack trace below. I am using mtouch arguments "--linkskip=System.Core", also tried with System.Linq and System.Linq.Expressions.

I noticed the culprit is the != check in the mapping expression; if I remove it, the error disappears.

I will workaround the error by mapping in the constructor, but this still seems like a bug that could be fixed.

Stack trace:

Mar  5 08:52:22 iPhone ECCMobileiOS[238] <Warning>: mvx:Error: 14,54 Unhandled exception: System.TypeInitializationException: An exception was thrown by the type initializer for ECC.Mobile.Core.Models.ShopItemViewModel ---> System.NotImplementedException: The requested feature is not implemented.
      at Microsoft.Scripting.Interpreter.NotEqualInstruction.Create (System.Type type) [0x001a5] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotEqualInstruction.cs:159 
      at Microsoft.Scripting.Interpreter.InstructionList.EmitNotEqual (System.Type type, Boolean liftedResult) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs:705 
      at Microsoft.Scripting.Interpreter.LightCompiler.CompileNotEqual (System.Linq.Expressions.Expression left, System.Linq.Expressions.Expression right, Boolean liftedResult) [0x0000e] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:611 
      at Microsoft.Scripting.Interpreter.LightCompiler.CompileBinaryExpression (System.Linq.Expressions.Expression expr) [0x0014e] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:573 
      at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x0032b] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1671 
      at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
      at Microsoft.Scripting.Interpreter.LightCompiler.CompileConditionalExpression (System.Linq.Expressions.Expression expr, Boolean asVoid) [0x00007] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:818 
      at Microsoft.Scripting.Interpreter.LightCompiler.CompileNoLabelPush (System.Linq.Expressions.Expression expr) [0x001d2] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1644 
      at Microsoft.Scripting.Interpreter.LightCompiler.Compile (System.Linq.Expressions.Expression expr) [0x00008] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:1729 
      at Microsoft.Scripting.Interpreter.LightCompiler.CompileTop (System.Linq.Expressions.LambdaExpression node) [0x00055] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs:221 
      at Microsoft.Scripting.Generation.CompilerHelpers.LightCompile (System.Linq.Expressions.LambdaExpression lambda) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs:619 
      at System.Linq.Expressions.Compiler.LambdaCompiler.Compile (System.Linq.Expressions.LambdaExpression lambda, System.Runtime.CompilerServices.DebugInfoGenerator debugInfoGenerator) [0x00000] in <filename unknown>:0 
      at System.Linq.Expressions.Expression`1[System.Func`2[ECC.Common.Models.ShopItem,System.String]].Compile () [0x00000] in <filename unknown>:0 
      at AutoMapper.PropertyMap.SetCustomValueResolverExpression[ShopItem,String] (System.Linq.Expressions.Expression`1 sourceMember) [0x00000] in <filename unknown>:0 
      at AutoMapper.MappingExpression`2[ECC.Common.Models.ShopItem,ECC.Mobile.Core.Models.ShopItemViewModel].MapFrom[String] (System.Linq.Expressions.Expression`1 sourceMember) [0x00000] in <filename unknown>:0 
      at ECC.Common.Extensions.MappingExtensions+<MapMember>c__AnonStorey0`3[ECC.Common.Models.ShopItem,ECC.Mobile.Core.Models.ShopItemViewModel,System.String].<>m__0 (IMemberConfigurationExpression`1 x) [0x00000] in <filename unknown>:0 
      at AutoMapper.MappingExpression`2[ECC.Common.Models.ShopItem,ECC.Mobile.Core.Models.ShopItemViewModel].ForDestinationMember (IMemberAccessor destinationProperty, System.Action`1 memberOptions) [0x00000] in <filename unknown>:0 
      at AutoMapper.MappingExpression`2[ECC.Common.Models.ShopItem,ECC.Mobile.Core.Models.ShopItemViewModel].ForMember (System.Linq.Expressions.Expression`1 destinationMember, System.Action`1 memberOptions) [0x00000] in <filename unknown>:0 
      at ECC.Common.Extensions.MappingExtensions.MapMember[ShopItem,ShopItemViewModel,String] (IMappingExpression`2 expression, System.Linq.Expressions.Expression`1 destinationMember, System.Linq.Expressions.Expression`1 sourceMember) [0x00000] in <filename unknown>:0 
      at ECC.Mobile.Core.Models.ShopItemViewModel..cctor () [0x00102] in /Users/geirsagberg/Projects/ConsumerCompanion/ECC.Mobile.Core/Models/ShopItemViewModel.cs:37 
      --- End of inner exception stack trace ---
      at ECC.Mobile.Core.ViewModels.LocationViewModel+<CreateShopModules>c__Iterator3.<>m__0 (ECC.Common.Models.ShopItem i) [0x00001] in /Users/geirsagberg/Projects/ConsumerCompanion/ECC.Mobile.Core/ViewModels/LocationViewModel.cs:79 
      at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[ECC.Common.Models.ShopItem,ECC.Mobile.Core.Models.ShopItemViewModel].MoveNext () [0x00000] in <filename unknown>:0 
      at System.Collections.Generic.List`1[ECC.Mobile.Core.Models.ShopItemViewModel].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0 
      at System.Collections.Generic.List`1[ECC.Mobile.Core.Models.ShopItemViewModel]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
      at System.Linq.Enumerable.ToList[ShopItemViewModel] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
      at ECC.Mobile.Core.ViewModels.LocationViewModel+<CreateShopModules>c__Iterator3.MoveNext () [0x00063] in /Users/geirsagberg/Projects/ConsumerCompanion/ECC.Mobile.Core/ViewModels/LocationViewModel.cs:79 
      at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[ECC.Mobile.Core.Models.ContentModule,ECC.Mobile.Core.Contracts.IContentViewModel].MoveNext () [0x00000] in <filename unknown>:0 
      at System.Collections.Generic.List`1[ECC.Mobile.Core.Contracts.IContentViewModel].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0 
      at System.Collections.Generic.List`1[ECC.Mobile.Core.Contracts.IContentViewModel]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
      at System.Linq.Enumerable.ToList[IContentViewModel] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
      at ECC.Mobile.Core.ViewModels.LocationViewModel+<Init>c__async0.MoveNext () [0x00072] in /Users/geirsagberg/Projects/ConsumerCompanion/ECC.Mobile.Core/ViewModels/LocationViewModel.cs:40 
@jbogard
Copy link
Member

jbogard commented Apr 24, 2015

Linking errors are pretty hard to fix. You have to explicitly reference that method waaaaay down underneath the covers. Do that and you're set.

@jbogard jbogard closed this as completed Apr 24, 2015
@lock
Copy link

lock bot commented May 8, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants