Xamarin Android 应用程序中的 Autofac 出错
Error with Autofac in Xamarin Android App
我在 Xamarin 项目中使用 Autofac 来构建移动应用程序。在 Xamarin Live Player 1.5.176 (676)(在华为 P20 上,最后一个安全补丁)中构建 Autofac 容器时出现以下错误:
[LogEntry: Time=01/07/2018 11:00:08 +02:00, Level=Error,
Title=Visualization Error, Message=No body on method
System.Collections.Generic.IEnumerable1<Autofac.Core.IComponentRegistration>
Autofac.Core.IRegistrationSource::RegistrationsFor(Autofac.Core.Service,System.Func
2>)
(NInterpretException)]
我制定了重现问题的解决方案:https://github.com/EhRom/XamarinAutofac/
// Initialiaze container builder.
var containerBuilder = new ContainerBuilder();
containerBuilder.RegisterType<SampleViewModel>().As<ISampleViewModel>();
// Build container.
container = containerBuilder.Build();
错误发生在Build() 方法上。我尝试添加选项,但没有成功。
你遇到过这个问题吗?我该如何解决这个问题?
错误未在本地模拟器上重现(没有 Xamarin Live Player)。
问题来自 Xamarin Live Player。
我直接在 phone 上部署了 apk 并且工作正常。
我在 Xamarin 项目中使用 Autofac 来构建移动应用程序。在 Xamarin Live Player 1.5.176 (676)(在华为 P20 上,最后一个安全补丁)中构建 Autofac 容器时出现以下错误:
[LogEntry: Time=01/07/2018 11:00:08 +02:00, Level=Error, Title=Visualization Error, Message=No body on method System.Collections.Generic.IEnumerable
1<Autofac.Core.IComponentRegistration> Autofac.Core.IRegistrationSource::RegistrationsFor(Autofac.Core.Service,System.Func
2>) (NInterpretException)]
我制定了重现问题的解决方案:https://github.com/EhRom/XamarinAutofac/
// Initialiaze container builder.
var containerBuilder = new ContainerBuilder();
containerBuilder.RegisterType<SampleViewModel>().As<ISampleViewModel>();
// Build container.
container = containerBuilder.Build();
错误发生在Build() 方法上。我尝试添加选项,但没有成功。
你遇到过这个问题吗?我该如何解决这个问题?
错误未在本地模拟器上重现(没有 Xamarin Live Player)。
问题来自 Xamarin Live Player。
我直接在 phone 上部署了 apk 并且工作正常。