0
votes

I am being prompted for a file called EnumerableExtensions.cs when using the NHibernateFacility for Castle Windsor. I have replicated this with the following steps (all packages were installed from NuGet):

  1. Create a new WPF project
  2. Install Castle.Core 3.1.0
  3. Install Castle.Windsor 3.1.0
  4. Install Castle.FactorySupportFacility 3.1.0
  5. Install Castle.Transactions 3.2.207.2207
  6. Install Castle.Facilities.AutoTx 3.2.207.2207
  7. Install NHibernate 3.3.1.4000
  8. Install Fluent NHibernate 1.3.0.733
  9. Install Castle.Facilities.NHibernate 0.7.1.23602
  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:

Open file dialog for EnumerableExtensions.cs

To me this looks like something is wrong with the DLL but when I posted about this on the Castle Project Google Group it was suggested that I had incompatible versions of Windsor in my app. Is this true or does it seem like something else is going on?

1
Did you ever find a solution to this? I found it happens under the same settings (castle + nhibernate facility) when my DB is offline. I'm troubleshooting that and came across this same problem.John S.

1 Answers

0
votes

That dialog is Visual Studio asking for the source code of the file where an exception originated. Click cancel, and Visual Studio will instead stop somewhere in your own code and display the exception.

You can prevent the dialog by removing the pdb-file for the component in which the exception occurs (but that will also lead to less useful stack traces in case you want to report a bug in the affected component).