2013-08-19 4 views
5

Je travaille sur un projet WPF utilisant ces paquets:Méthode non trouvée: 'Void Caliburn.Micro.Bootstrapper`1..ctor (Boolean)'

<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" /> 

Jusqu'à hier que je mets à jour les paquets à:

<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" /> 

Je veux dire, mettre à jour à partir de Autofac3.1.1 à 3.0.2 et Caliburn.Micro1.5.1-1.5.2 (en utilisant Nuget Package Manager). Après cela, je ne peux pas exécuter le projet. Je reçois cette erreur:

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

à cette ligne dans App.xaml:

Le message d'exception interne est:

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

Y at-il point de la mise à niveau, je l'ai fait que je manqué?

La trace complète de la pile:

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() 

et la pile d'exception interne:

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 

Répondre

9

Eh bien, je trouve la réponse :) Le problème est ici:

Le Caliburn.Micro.Autofac.AutofacBootstrapper<TRootViewModel> dans Caliburn.Micro.Autofac paquet nuget (version = "1.5.0") s'étend Caliburn.Micro.Bootstrapper<TRootModel> dans Caliburn.Micro package, et a un constructeur comme ceci:

public AutofacBootstrapper() : base(true) { } 

Cela signifie qu'il appelle le base.ctor en passant un argument boolean (base.ctor(bool)). Et voici la chose. La Caliburn.Micro.Bootstrapper<TRootModel> dans la version 1.5.1 a un constructeur avec un paramètre bool:

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

alors que dans la version 1.5.2, il n'a qu'un seul paramètre moins constructeur:

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

Voici les 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(); 
     } 
    } 
} 

Ainsi, le Caliburn.Micro.Autofac, Version=1.5.0.0 ne peut pas être utilisé avec Caliburn.Micro, Version=1.5.2.0 et vous Ve pour créer votre propre AutofacBootstrapper, qui est facile à implémenter en se référant à l'original (here) ou en lisant la source des paquets de nuget. En outre, here est mon re-implémenté, si vous avez besoin.

+0

Merci, vous m'avez sauvé beaucoup de temps :) Avez-vous essayé d'entrer en contact avec Dave et réparer son paquet sur GitHub? –

+0

Je vous souhaite la bienvenue. Oui, j'ai laissé un commentaire sur son blog (un article sur Caliburn.Micro.Autofac [ici] (http://buksbaum.us/2010/08/20/bootstrapping-caliburn-micro-with-autofac/)) mais il didn didn ne réponds pas. –

+0

Je pense que vous pouvez simplement faire une modification et faire une demande de validation. –

Questions connexes