Announcing Castle.{Transactions, Facilities.AutoTx} v3.1

1,444 views
Skip to first unread message

Henrik Feldt

unread,
Jun 27, 2012, 2:47:46 PM6/27/12
to castle-pro...@googlegroups.com, castle-pro...@googlegroups.com

Castle.Transactions v3.1 and Castle.Facilities.AutoTx v3.1 are now ready for downloading from nuget and source from github, like usual!

 

This is the first GA release of version 3.0. It’s compliant with Windsor 3.0.

 

Cheers,

Henrik

 

Henrik

unread,
Aug 22, 2012, 6:46:03 PM8/22/12
to castle-pro...@googlegroups.com, castle-pro...@googlegroups.com
Hello,

Just wanted to check in pretty late and say that I'm working on this now. There's been a gap in my ability to work on this, as you may have noticed.

Regards,
Henrik

On Saturday, August 11, 2012 4:00:33 PM UTC+2, Stu wrote:
I posted about this on Stack Overflow (see here:  http://stackoverflow.com/questions/11913331/installing-castle-transactions-from-nuget-doesnt-produce-a-dll ) as this is still a problem.  Unfortunately I haven't been able to resolve the problem and I think the main reason for that is that Castle has also had an update in the past few days.  Trying to manually resolve this by installing older versions of various packages is a dependency nightmare that I haven't beaten.

Does anyone have any idea how to fix this?  Is it only Henrik that can accept the pull request and deploy to NuGet?  I dropped him an email the other day to tell him that this was an issue but I haven't had a response yet.

Thanks
Stu

Henrik

unread,
Aug 22, 2012, 8:18:38 PM8/22/12
to castle-pro...@googlegroups.com, castle-pro...@googlegroups.com
v3.2 targeting the new Windsor released. They should indeed contain dlls this time. ^^

Stu

unread,
Sep 1, 2012, 11:12:13 AM9/1/12
to castle-pro...@googlegroups.com, castle-pro...@googlegroups.com
Hi Henrik,

I've downloaded the latest version but I'm still having a problem that I think might be related. When I first built and ran my code after updating, an open file dialog appeared asking for the location of an EnumerableExtension.cs file. I didn't think much of this at the time as I didn't think it was related to the update so I cancelled the dialog. This was a few days ago so I'm not sure what exactly happened next as I was in a rush but I think that my app loaded successfully. However I've come back to it today and I'm getting the following exception when loading my app:

Method not found: 'Castle.MicroKernel.Registration.ComponentRegistration`1<!0> Castle.MicroKernel.Registration.Lifestyle.LifestyleGroup`1.get_PerWebRequest()'.

The stacktrace for the exception is:

   at Castle.Facilities.NHibernate.NHibernateFacility.GetLifeStyle[T](ComponentRegistration`1 registration, UInt32 index, String baseName)
   at Castle.Facilities.NHibernate.NHibernateFacility.RegisterSession(Data x, UInt32 index)
   at Castle.Facilities.NHibernate.NHibernateFacility.<Init>b__7(Data x)
   at Castle.Transactions.Helpers.EnumerableExtensions.<Do>d__0`1.MoveNext() in d:\BuildAgent-03\work\9844bdf039249947\src\Castle.Transactions\Helpers\EnumerableExtensions.cs:line 48
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Castle.Facilities.NHibernate.NHibernateFacility.Init()
   at Castle.MicroKernel.Facilities.AbstractFacility.Castle.MicroKernel.IFacility.Init(IKernel kernel, IConfiguration facilityConfig)
   at Castle.MicroKernel.DefaultKernel.AddFacility(IFacility facility)
   at Castle.MicroKernel.DefaultKernel.AddFacility[T]()
   at Castle.Windsor.WindsorContainer.AddFacility[T]()
   at ProjectName.Core.ViewModelResolver.configureContainer() in E:\Github\ProjectName\ProjectName\ProjectName\Core\WindsorResolver.cs:line 41
   at ProjectName.Core.ViewModelResolver.Resolve(String viewModelName) in E:\Github\ProjectName\ProjectName\ProjectName\Core\WindsorResolver.cs:line 18
   at ProjectName.Core.ViewModelLocator.get_Item(String viewModelName) in E:\Github\ProjectName\ProjectName\ProjectName\Core\ViewModelLocator.cs:line 18

The code that is causing this exception is:

            _container = new WindsorContainer();

            _container.AddFacility<AutoTxFacility>();
            _container.Register(
                Component.For<INHibernateInstaller>()
                .ImplementedBy<FluentNHibernateInstaller>());
            _container.AddFacility<NHibernateFacility>();

It could well be that I am doing something wrong as I am new to Castle Windsor but it seemed worthy of posting here given that I've just updated my packages.

Can you shed any light on the problem?

Thanks
Stu

hen...@haf.se

unread,
Sep 3, 2012, 12:31:41 PM9/3/12
to castle-pro...@googlegroups.com
Hello Stu,

The reason you got that popup was that the enumerable extension file is what iterates over the configuration, and the call-site was in a captured lambda of that loop.

So, greek aside, I think your problem is related to having incompatible versions of Windsor in your application. You can see that the tests run fine, so there's no rebind-problem in the facility. I think you'll have to go through your assemblies and check that you aren't referencing the wrong version of Windsor anywhere in there...

Krzysztof - I'm on the right track here, right?

Henrik


----- Ursprungligt meddelande -----

Till:
<castle-pro...@googlegroups.com>
Kopia:
<castle-pro...@googlegroups.com>
Skickat:
Sat, 1 Sep 2012 08:12:13 -0700 (PDT)
Ämne:
Re: Announcing Castle.{Transactions, Facilities.AutoTx} v3.1
--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/castle-project-users/-/11BzIFOEaaoJ.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.

Stu

unread,
Sep 9, 2012, 5:23:31 AM9/9/12
to castle-pro...@googlegroups.com
Hi Henrik,

I have just uninstalled all of the Castle packages from my project, deleted the app.config file and deleted the folders from the packages folder. I then installed the Castle.Facilities.NHibernateFacility package which installed all of the dependent packages such as Castle.Core, Castle.Facilities.AutoTx, etc. After cleaning the solution and building it, I was left with the following error:

Assembly 'Castle.Facilities.NHibernate, Version=0.7.1.23602, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' uses 'Castle.Transactions, Version=3.2.207.2207, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' which has a higher version than referenced assembly 'Castle.Transactions, Version=3.1.206.2206, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'

which I fixed by updating all of the Castle packages to the latest versions (when NuGet installed them as dependent packages it must not have chosen the latest version). So now I don't get any compilation errors but I am still getting the exception from my previous post. This is my app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Castle.Windsor" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Castle.Transactions" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.2.207.2207" newVersion="3.2.207.2207" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Castle.Facilities.AutoTx" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.1.206.2206" newVersion="3.1.206.2206" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Castle.Facilities.FactorySupport" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

This is a list of all of the references to DLLs in my solution (AsmSpy from here is a wonderful tool):

Reference: mscorlib
        4.0.0.0 by Castle.Core
        4.0.0.0 by Castle.Facilities.AutoTx
        4.0.0.0 by Castle.Facilities.FactorySupport
        4.0.0.0 by Castle.Facilities.NHibernate
        4.0.0.0 by Castle.Transactions
        4.0.0.0 by Castle.Windsor
        2.0.0.0 by FluentNHibernate
        4.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
        4.0.0.0 by GalaSoft.MvvmLight.WPF4
        2.0.0.0 by Iesi.Collections
        2.0.0.0 by Microsoft.Practices.ServiceLocation
        2.0.0.0 by NHibernate
        4.0.0.0 by NLog
        4.0.0.0 by System.Windows.Interactivity
        4.0.0.0 by DontForgetThePresents
        2.0.0.0 by DontForgetThePresents
        4.0.0.0 by vshost32
        2.0.0.0 by vshost32
Reference: System.Xml
        4.0.0.0 by Castle.Core
        4.0.0.0 by Castle.Transactions
        4.0.0.0 by Castle.Windsor
        2.0.0.0 by FluentNHibernate
        2.0.0.0 by NHibernate
        4.0.0.0 by NLog
Reference: System
        4.0.0.0 by Castle.Core
        4.0.0.0 by Castle.Facilities.AutoTx
        4.0.0.0 by Castle.Facilities.FactorySupport
        4.0.0.0 by Castle.Transactions
        4.0.0.0 by Castle.Windsor
        2.0.0.0 by FluentNHibernate
        4.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
        4.0.0.0 by GalaSoft.MvvmLight.WPF4
        2.0.0.0 by Iesi.Collections
        2.0.0.0 by Microsoft.Practices.ServiceLocation
        2.0.0.0 by NHibernate
        4.0.0.0 by NLog
        4.0.0.0 by System.Windows.Interactivity
        4.0.0.0 by DontForgetThePresents
Reference: System.Core
        4.0.0.0 by Castle.Core
        4.0.0.0 by Castle.Facilities.AutoTx
        4.0.0.0 by Castle.Facilities.NHibernate
        4.0.0.0 by Castle.Transactions
        4.0.0.0 by Castle.Windsor
        3.5.0.0 by FluentNHibernate
        4.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
        4.0.0.0 by GalaSoft.MvvmLight.WPF4
        3.5.0.0 by NHibernate
        4.0.0.0 by NLog
        4.0.0.0 by System.Windows.Interactivity
        4.0.0.0 by DontForgetThePresents
        3.5.0.0 by DontForgetThePresents
Reference: System.Configuration
        4.0.0.0 by Castle.Core
        4.0.0.0 by Castle.Windsor
        2.0.0.0 by FluentNHibernate
        2.0.0.0 by NHibernate
        4.0.0.0 by NLog
Reference: Castle.Windsor
        3.1.0.0 by Castle.Facilities.AutoTx
        3.1.0.0 by Castle.Facilities.FactorySupport
        3.1.0.0 by Castle.Facilities.NHibernate
        3.1.0.0 by DontForgetThePresents
Reference: Castle.Core
        3.1.0.0 by Castle.Facilities.AutoTx
        3.1.0.0 by Castle.Facilities.FactorySupport
        3.1.0.0 by Castle.Facilities.NHibernate
        3.1.0.0 by Castle.Transactions
        3.1.0.0 by Castle.Windsor
Reference: Castle.Transactions
        3.2.207.2207 by Castle.Facilities.AutoTx
        3.2.207.2207 by Castle.Facilities.NHibernate
        3.2.207.2207 by DontForgetThePresents
Reference: System.Transactions
        4.0.0.0 by Castle.Facilities.AutoTx
        4.0.0.0 by Castle.Transactions
        2.0.0.0 by FluentNHibernate
        2.0.0.0 by NHibernate
Reference: NHibernate
        3.3.1.4000 by Castle.Facilities.NHibernate
        3.3.1.4000 by FluentNHibernate
        3.3.1.4000 by DontForgetThePresents
Reference: FluentNHibernate
        1.3.0.733 by Castle.Facilities.NHibernate
        1.3.0.733 by DontForgetThePresents
Reference: Castle.Facilities.AutoTx
        3.2.207.2207 by Castle.Facilities.NHibernate
        3.2.207.2207 by DontForgetThePresents
Reference: Castle.Facilities.FactorySupport
        3.1.0.0 by Castle.Facilities.NHibernate
Reference: System.Data
        2.0.0.0 by FluentNHibernate
        2.0.0.0 by NHibernate
        4.0.0.0 by NLog
Reference: Iesi.Collections
        1.0.1.0 by FluentNHibernate
        1.0.1.0 by NHibernate
Reference: Microsoft.Practices.ServiceLocation
        1.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
Reference: System.Windows.Interactivity
        4.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
Reference: WindowsBase
        4.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
        4.0.0.0 by GalaSoft.MvvmLight.WPF4
        4.0.0.0 by System.Windows.Interactivity
Reference: PresentationFramework
        4.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
        4.0.0.0 by GalaSoft.MvvmLight.WPF4
        4.0.0.0 by System.Windows.Interactivity
        4.0.0.0 by DontForgetThePresents
Reference: PresentationCore
        4.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
        4.0.0.0 by GalaSoft.MvvmLight.WPF4
        4.0.0.0 by System.Windows.Interactivity
Reference: System.Xaml
        4.0.0.0 by GalaSoft.MvvmLight.Extras.WPF4
        4.0.0.0 by System.Windows.Interactivity
        4.0.0.0 by DontForgetThePresents
Reference: System.ServiceModel
        3.0.0.0 by NHibernate
        4.0.0.0 by NLog
Reference: System.Xml.Linq
        3.5.0.0 by NHibernate
Reference: System.Windows.Forms
        4.0.0.0 by NLog
Reference: System.Drawing
        4.0.0.0 by NLog
Reference: System.Runtime.Serialization
        4.0.0.0 by NLog
Reference: GalaSoft.MvvmLight.WPF4
        4.0.23.37706 by DontForgetThePresents
Reference: Castle.Facilities.NHibernate
        0.7.1.23602 by DontForgetThePresents
Reference: Microsoft.VisualStudio.HostingProcess.Utilities.Sync
        10.0.0.0 by vshost32

To the untrained eye (mine!), this all looks normal. This is my first project that I've used NuGet for so I haven't had to dabble with app.config and dependencies before so I'm a little out of my depth here.

Thanks
Stu
To unsubscribe from this group, send email to castle-project-users+unsub...@googlegroups.com.

Stu

unread,
Sep 16, 2012, 12:30:41 PM9/16/12
to castle-pro...@googlegroups.com
Hi Henrik,

I've been doing some more digging and I can re-create the prompt for the EnumerableExtensions.cs file quite easily:
  1. Create a new WPF project
  2. Install Castle.Core
  3. Install Castle.Windsor
  4. Install Castle.FactorySupportFacility
  5. Install Castle.Transactions
  6. Install Castle.Facilities.AutoTx
  7. Install NHibernate
  8. Install Fluent NHibernate
  9. Install Castle.Facilities.NHibernate
  10. Override OnStartup() in App.xaml.cs to create the Windsor container and add the facilities to it. See code below.
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            IWindsorContainer container = new WindsorContainer();
            container.AddFacility<AutoTxFacility>();
            container.Register(
                Component.For<INHibernateInstaller>()
                .ImplementedBy<FluentNHibernateInstaller>());
            container.AddFacility<NHibernateFacility>();
        }

This is the code in FluentNHibernateInstaller.cs

    public class FluentNHibernateInstaller : INHibernateInstaller
    {
        public FluentConfiguration BuildFluent()
        {
            return Fluently.Configure();
        }

        private IPersistenceConfigurer SetupDatabase()
        {
            return MsSqlConfiguration.MsSql2008
                .ConnectionString(c => c
                    .Server("Server")
                    .Database("Database")
                    .Username("User")
                    .Password("Password"));
        }

        public Maybe<NHibernate.IInterceptor> Interceptor
        {
            get { return Maybe.None<NHibernate.IInterceptor>(); }
        }

        public bool IsDefault
        {
            get { return true; }
        }

        public void Registered(ISessionFactory factory)
        {

        }

        public string SessionFactoryKey
        {
            get { return "sf.default"; }
        }
    }

When I run the application, this is the dialog I am presented with:

All of the packages that I installed were the latest ones from NuGet:

Castle.Core = 3.1.0
Castle.Windsor = 3.1.0
Castle.FactorySupportFacility = 3.1.0
Castle.Transactions = 3.2.207.2207
Castle.Facilities.AutoTx = 3.2.207.2207
NHibernate = 3.3.1.4000
Fluent NHibernate = 1.3.0.733
Castle.Facilities.NHibernate = 0.7.1.23602

Is this something that I'm doing wrong?

Thanks very much for your help.
Stu

On Monday, September 3, 2012 5:32:38 PM UTC+1, Henrik wrote:
To unsubscribe from this group, send email to castle-project-users+unsub...@googlegroups.com.

Henrik Feldt

unread,
Nov 24, 2012, 5:36:25 AM11/24/12
to castle-pro...@googlegroups.com

Hello,

 

Good catch.

 

Client profile is on its way out, though, and I’m not sure that it contains the transactions namespace either? I guess one would have to compile for .Net4 client and explicitly throw exceptions if using it – but I’ve had problems like you’re describing with other projects too.

 

Henrik

 

From: castle-pro...@googlegroups.com [mailto:castle-pro...@googlegroups.com] On Behalf Of Alik Kurdyukov
Sent: den 21 november 2012 19:51
To: castle-pro...@googlegroups.com
Subject: Re: Announcing Castle.{Transactions, Facilities.AutoTx} v3.1

 

Hi,

 

I've found a problem and the problem was in my way of adding dependencies with NuGet. The console project I created was destined for Net4 Client Profile. I added some dependencies (using client profile), than found that it does not work and changed to Net4 Full. Bus some dependencies were not changed - that lead to missing method.

 

This problem is pretty hard to find. I think that if Castle had PerWebRequest in client profile build that throws exception with description like 'PerWebRequest is not available in client profile build' the problems like mine can be solved pretty fast. What do you think?

 

Best regards,

Alik.


On Wednesday, November 21, 2012 4:16:29 PM UTC+4, Alik Kurdyukov wrote:

Hi Hernik and Stu,

 

I've got same "Method not found: 'Castle.MicroKernel.Registration.ComponentRegistration`1<!0> Castle.MicroKernel.Registration.Lifestyle.LifestyleGroup`1.get_PerWebRequest()'" problem in by test project. You can check the project itself at https://github.com/akurdyukov/SimpleToDo

 

Full stacktrace is

System.MissingMethodException was unhandled

  Message=Method not found: 'Castle.MicroKernel.Registration.ComponentRegistration`1<!0> Castle.MicroKernel.Registration.Lifestyle.LifestyleGroup`1.get_PerWebRequest()'.

  Source=Castle.Facilities.NHibernate

  StackTrace:

       at Castle.Facilities.NHibernate.NHibernateFacility.GetLifeStyle[T](ComponentRegistration`1 registration, UInt32 index, String baseName)

       at Castle.Facilities.NHibernate.NHibernateFacility.RegisterSession(Data x, UInt32 index) in C:\Users\alik\Development\projects\EmerginMarket\Castle.Facilities.NHibernate\NHibernateFacility.cs:line 257

       at Castle.Facilities.NHibernate.NHibernateFacility.<Init>b__7(Data x) in C:\Users\alik\Development\projects\EmerginMarket\Castle.Facilities.NHibernate\NHibernateFacility.cs:line 202

       at Castle.Transactions.Helpers.EnumerableExtensions.<Do>d__0`1.MoveNext() in d:\BuildAgent-03\work\9844bdf039249947\src\Castle.Transactions\Helpers\EnumerableExtensions.cs:line 48

       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)

       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

       at Castle.Facilities.NHibernate.NHibernateFacility.Init() in C:\Users\alik\Development\projects\EmerginMarket\Castle.Facilities.NHibernate\NHibernateFacility.cs:line 186

       at Castle.MicroKernel.Facilities.AbstractFacility.Castle.MicroKernel.IFacility.Init(IKernel kernel, IConfiguration facilityConfig)

       at Castle.MicroKernel.DefaultKernel.AddFacility(IFacility facility)

       at Castle.MicroKernel.DefaultKernel.AddFacility[T]()

       at Castle.Windsor.WindsorContainer.AddFacility[T]()

       at SimpleToDo.LocalBootstrapper.ConfigureApplicationContainer(IWindsorContainer container) in C:\Users\alik\Development\projects\SimpleToDo\SimpleToDo\LocalBootstrapper.cs:line 30

       at Nancy.Bootstrapper.NancyBootstrapperBase`1.Initialise()

       at Nancy.Hosting.Self.NancyHost..ctor(INancyBootstrapper bootstrapper, Uri[] baseUris)

       at Nancy.Hosting.Self.NancyHost..ctor(Uri[] baseUris)

       at SimpleToDo.Program.Main(String[] args) in C:\Users\alik\Development\projects\SimpleToDo\SimpleToDo\Program.cs:line 39

       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadHelper.ThreadStart()

  InnerException: 

 

I included binary version for Castle.Facilities.NHibernate because it supports using HNibernate.Mapping.Attributes (see my pull request https://github.com/haf/Castle.Facilities.NHibernate/pull/9).

 

I have no idea why system cannot find that method. Can you please take a look and tell me what can I do about it?

 

Best regards,

Alik.

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.


To post to this group, send email to castle-pro...@googlegroups.com.

To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.

Sönke Matz

unread,
Aug 26, 2013, 12:15:32 PM8/26/13
to castle-pro...@googlegroups.com, hen...@haf.se
Hello,

is this problem solved already? I have a project in which I have to use the client profile 4.0 of the .net framework and I get a "method not found"-exception: "Castle.MicroKernel.Registration.ComponentRegistration`1<!0> Castle.MicroKernel.Registration.Lifestyle.LifestyleGroup`1.get_PerWebRequest()".

Can you help?
Best regards
Matz

To unsubscribe from this group, send email to castle-project-users+unsub...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages