Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

AutoMapper & Linker issue

$
0
0

Hey,

when letting the linker remove all assemblies we get following exception which is related to the AutoMapper library.

System.Diagnostics.Debugger.Mono_UnhandledException (ex={AutoMapper.AutoMapperMappingException: 

Mapping types:
List`1 -> IList`1
System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] -> System.Collections.Generic.IList`1[[System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

Destination path:
CartItem.CategoryIds.CategoryIds

Source value:
System.Collections.Generic.List`1[System.Int32] ---> System.MissingMethodException: Default constructor not found for type AutoMapper.Mappers.CollectionMapper+EnumerableMapper`2[[System.Collections.Generic.IList`1[[System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at AutoMapper.Mappers.CollectionMapper.Map (AutoMapper.ResolutionContext context, IMappingEngineRunner mapper) [0x00039] in c:\dev\AutoMapper\src\AutoMapper\Mappers\CollectionMapper.cs:18 
  at AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map (AutoMapper.ResolutionContext context) [0x00123] in c:\dev\AutoMapper\src\AutoMapper\MappingEngine.cs:246 
  --- End of inner exception stack trace ---
}) in 

Its obvious that the error is related to the fact that the linker removes the specific code, but does anybody have an idea what kind of link description you have to add to fix the issue? I tried all stupid variations but none of them works:

<assembly fullname="AutoMapper.Android">
    <type fullname="AutoMapper.Mappers.CollectionMapper"  preserve="All" />
    <type fullname="AutoMapper.Mappers.EnumerableMapper" preserve="All"  />
    <type fullname="AutoMapper.Mappers.CollectionMapper+EnumerableMapper"  preserve="All" />
    <type fullname="AutoMapper*" preserve="All" />
    <type fullname="AutoMapper.*" preserve="All"  />
</assembly>

<assembly fullname="AutoMapper">
    <type fullname="AutoMapper.Mappers.CollectionMapper" preserve="All" />
    <type fullname="AutoMapper.Mappers.EnumerableMapper" preserve="All" />
    <type fullname="AutoMapper.Mappers.CollectionMapper+EnumerableMapper" preserve="All" />
    <type fullname="AutoMapper*" preserve="All" />
    <type fullname="AutoMapper.*" preserve="All" />
</assembly>

The only way to fix the problem is to add the AutoMapper assembly to the ignore list, but somehow it needs to be fixable using the linker description, right?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>