I was working on a WPF
project using these packages:
<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" />
Until yesterday that I update packages to:
<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" />
I mean, I update Autofac
from 3.0.2
to 3.1.1
and Caliburn.Micro
from 1.5.1
to 1.5.2
(by using Nuget Package Manager
). After that, I cannot run the project. I get this error:
'The invocation of the constructor on type 'MyAppBootstrapper' that matches the specified binding constraints threw an exception.' Line number '9' and line position '22'.
at this line in App.xaml
:
The inner exception message is:
{"Method not found: 'Void Caliburn.Micro.Bootstrapper`1..ctor(Boolean)'."}
Is there any point to upgrading I did that I missed?
The complete stack trace:
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()
and the inner exception's stack:
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
Well, I found the answer :) The problem is here:
The Caliburn.Micro.Autofac.AutofacBootstrapper<TRootViewModel>
in Caliburn.Micro.Autofac nuget package (version="1.5.0") extends Caliburn.Micro.Bootstrapper<TRootModel>
in Caliburn.Micro package, and has a constructor like this:
public AutofacBootstrapper() : base(true) { }
It means it calls the base.ctor
by passing a boolean
argument (base.ctor(bool)
). And here is the thing. The Caliburn.Micro.Bootstrapper<TRootModel>
in version 1.5.1
has a constructor with a bool
parameter:
public Bootstrapper(bool useApplication = true) : base(useApplication) {
this.Start();
}
while in version 1.5.2
, it has only one parameter-less constructor:
public Bootstrapper() : base(true) {
this.Start();
}
Here is the signatures:
// 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();
}
}
}
So, the Caliburn.Micro.Autofac, Version=1.5.0.0
cannot be used with Caliburn.Micro, Version=1.5.2.0
and you have to create your own AutofacBootstrapper
, which is easy to implement by referring the original one (here) or reading the nuget packages source. Also, here is my re-implemented one, if you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With