gpt4 book ai didi

wpf - 未找到方法 : 'Void Caliburn.Micro.Bootstrapper` 1. .ctor(Boolean)'

转载 作者:行者123 更新时间:2023-12-02 01:52:10 24 4
gpt4 key购买 nike

我正在使用这些包开发一个 WPF 项目:

<package id="Autofac" version="3.0.2" targetFramework="net40" />
<package id="Caliburn.Micro" version="1.5.1" targetFramework="net40" />
<package id="Caliburn.Micro.Autofac" version="1.5.0" targetFramework="net40" />

直到昨天我将软件包更新为:

<package id="Autofac" version="3.1.1" targetFramework="net40" />
<package id="Caliburn.Micro" version="1.5.2" targetFramework="net40" />
<package id="Caliburn.Micro.Autofac" version="1.5.0" targetFramework="net40" />

我的意思是,我将 Autofac3.0.2 更新到 3.1.1 并将 Caliburn.Micro1.5.11.5.2(通过使用 Nuget 包管理器)。之后,我无法运行该项目。我收到此错误:

'The invocation of the constructor on type 'MyAppBootstrapper' that matches the specified binding constraints threw an exception.' Line number '9' and line position '22'.

App.xaml中的这一行:

内部异常消息是:

{"Method not found: 'Void Caliburn.Micro.Bootstrapper`1..ctor(Boolean)'."}

我错过的升级有什么意义吗?

完整的堆栈跟踪:

at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Shivar.Tameshk.Server.UI.App.InitializeComponent() in d:\Projects\Shivar.Tameshk\Tameshk\Server\Shivar.Tameshk.Server.UI\App.xaml:line 1
at Shivar.Tameshk.Server.UI.App.Main() in d:\Projects\Shivar.Tameshk\Tameshk\Server\Shivar.Tameshk.Server.UI\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

和内部异常的堆栈:

at Caliburn.Micro.Autofac.AutofacBootstrapper`1..ctor()
at Shivar.Tameshk.Server.UI.ServerUiBootstrapper..ctor() in d:\Projects\Shivar.Tameshk\Tameshk\Server\Shivar.Tameshk.Server.UI\ServerUiBootstrapper.cs:line 28

最佳答案

好吧,我找到了答案:)问题就在这里:

Caliburn.Micro.Autofac.AutofacBootstrapper<TRootViewModel>Caliburn.Micro.Autofac nuget 包 (version="1.5.0") 中扩展 Caliburn.Micro.Bootstrapper<TRootModel>Caliburn.Micro包中,并且有一个像这样的构造函数:

public AutofacBootstrapper() : base(true) { }

这意味着它调用 base.ctor通过传递 boolean参数( base.ctor(bool) )。事情就是这样。 Caliburn.Micro.Bootstrapper<TRootModel>版本1.5.1有一个带有 bool 的构造函数参数:

public Bootstrapper(bool useApplication = true) : base(useApplication) {
this.Start();
}

版本 1.5.2 ,它只有一个无参数构造函数:

public Bootstrapper() : base(true) {
this.Start();
}

这是签名:

// Assembly: Caliburn.Micro.Autofac, Version=1.5.0.0
namespace Caliburn.Micro.Autofac {
public class AutofacBootstrapper<TRootViewModel> : Bootstrapper<TRootViewModel> {
public AutofacBootstrapper() : base(true) { }
}
}

// Assembly: Caliburn.Micro, Version=1.5.1.0
namespace Caliburn.Micro {
public class Bootstrapper<TRootModel> : BootstrapperBase {
public Bootstrapper(bool useApplication = true) : base(useApplication) {
this.Start();
}
}
}

// Assembly: Caliburn.Micro, Version=1.5.2.0
namespace Caliburn.Micro {
public class Bootstrapper<TRootModel> : BootstrapperBase {
public Bootstrapper() : base(true) {
this.Start();
}
}
}

所以,Caliburn.Micro.Autofac, Version=1.5.0.0不能与 Caliburn.Micro, Version=1.5.2.0 一起使用你必须创建自己的 AutofacBootstrapper ,通过引用原始包( here )或阅读 nuget 包源代码很容易实现。另外,here如果您需要的话,这是我重新实现的。

关于wpf - 未找到方法 : 'Void Caliburn.Micro.Bootstrapper` 1. .ctor(Boolean)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18318337/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com