小编B B*_*and的帖子

AutoMapper Mapper.Initialize 导致 System.Linq.Expressions 中的 ArgumentNullException (Xamarin.iOS)

我正在尝试将 AutoMapper 集成到我的 Xamarin Forms 应用程序中。它在 Android 设备和模拟器中都能成功运行,但在 iOS 中我只能让它在模拟器中运行。在真实设备上运行它会导致 System.ArgumentNullException。

这是我的 App.xaml.cs OnStart 方法中的 Mapper.Initialize 代码:

// AutoMapper config
Mapper.Initialize(cfg =>
{
    cfg.AddProfile<MappingProfile>();
});
Run Code Online (Sandbox Code Playgroud)

这是堆栈跟踪:

System.ArgumentNullException: Value cannot be null.
Parameter name: method
  at System.Linq.Expressions.Expression.Call (System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0) [0x0003e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.0.0.0/src/mono/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs:879
  at AutoMapper.Mappers.ConvertMapper.ConvertExpression (System.Type sourceType, System.Type destinationType) [0x00040] in <0cc4ddabcc77416ea712cf2d35abef51>:0
  at AutoMapper.Mappers.ConvertMapper+<>c__DisplayClass1_1.<GetConverters>b__4 () [0x00000] in <0cc4ddabcc77416ea712cf2d35abef51>:0
  at System.Lazy`1[T].CreateValue () [0x00081] in <6314851f133e4e74a2e96356deaa0c6c>:0
  at System.Lazy`1[T].LazyInitValue () [0x0000c] in <6314851f133e4e74a2e96356deaa0c6c>:0
  at System.Lazy`1[T].get_Value () [0x0003a] in <6314851f133e4e74a2e96356deaa0c6c>:0
  at AutoMapper.Mappers.ConvertMapper.MapExpression (AutoMapper.IConfigurationProvider configurationProvider, …
Run Code Online (Sandbox Code Playgroud)

automapper xamarin.ios

4
推荐指数
1
解决办法
1079
查看次数

标签 统计

automapper ×1

xamarin.ios ×1