0
我有,我使用AutoMapper 5.1.1與代碼PCL:AutoMapper 5.1.1 MethodAccessException在Windows Phone 8.1(WinRT的)
var mapperConfig = new MapperConfiguration(cfg =>
{
cfg.AddProfile<TileProfile>();
cfg.AddProfile<PictureProfile>();
...
});
var mapper = mapperConfig.CreateMapper();
與WinForms的工作很好,但是當我使用庫的Windows Phone 8.1( WinRT的)然後我得到例外MapperConfiguration構造:
System.MethodAccessException was unhandled by user code
HResult=-2146233072
Message=Attempt by security transparent method 'AutoMapper.Profile..ctor()' to access security critical method 'System.Collections.Concurrent.ConcurrentDictionary`2<System.__Canon,System.__Canon>..ctor()' failed.
Source=AutoMapper
StackTrace:
at AutoMapper.Profile..ctor()
at AutoMapper.Configuration.MapperConfigurationExpression..ctor()
at AutoMapper.MapperConfiguration.Build(Action`1 configure)
at AutoMapper.MapperConfiguration..ctor(Action`1 configure)
InnerException:
我還創建空白的Windows Phone 8.1項目的測試,只有Automapper NuGet包和驗證碼:
...
public MainPage()
{
this.InitializeComponent();
var mapperConfig = new MapperConfiguration(cfg => {});
}
...
具有相同的結果。 對這個問題有什麼經驗嗎?它看起來像Automapper中的一些錯誤/內部問題。謝謝