Problem with Nhibernate assembly

145 views
Skip to first unread message

Hainesy

unread,
Jun 23, 2009, 9:51:40 AM6/23/09
to S#arp Architecture
I might be wrong but I believe there may be a problem with the
versions of NHibernate and Nhibernate.ByteCode.Castle.dll in the
SharpArchitecture trunk

NHibernate.dll is at version 2.1.0.2001
and Nhibernate.ByteCode.Castle.dll is at version 2.1.0.1001

I tried updating to latest version (2002) which then throws it out of
sync with the sharparch dlls.


When I run the tests, I keep getting the following error...


MappingIntegrationTests.CanConfirmDatabaseMatchesMappings : Failedid
property
property
property
property
property

System.IO.FileLoadException: Could not load file or assembly
'NHibernate, Version=2.1.0.2002, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly, ref
StackCrawlMark stackMark, Boolean loadTypeFromPartialName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly, ref
StackCrawlMark stackMark)
at System.RuntimeType.PrivateGetType(String typeName, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly, ref
StackCrawlMark stackMark)
at System.Type.GetType(String typeName)
at NHibernate.Util.ReflectHelper.TypeFromAssembly
(AssemblyQualifiedTypeName name, Boolean throwOnError)
at NHibernate.Util.ReflectHelper.ClassForName(String name)
at NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory
(String typeName)
NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable
to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle' during configuration of proxy factory
class.
Possible causes are:
- The NHibernate.Bytecode provider assembly was not deployed.
- The typeName used to initialize the 'proxyfactory.factory_class'
property of the session-factory section is not well formed.

Solution:
Confirm that your deployment folder contains one of the following
assemblies:
NHibernate.ByteCode.LinFu.dll
NHibernate.ByteCode.Castle.dll
at NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory
(String typeName)
at NHibernate.Cfg.Configuration.ConfigureProxyFactoryFactory()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or
incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.

* Database was not configured through Database method.

at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
at SharpArch.Data.NHibernate.NHibernateSession.CreateSessionFactoryFor
(String[] mappingAssemblies, AutoPersistenceModel
autoPersistenceModel, Configuration cfg, IPersistenceConfigurer
persistenceConfigurer) in C:\MyStuff\Dev\Projects\SharpArchitecture\src
\SharpArch\SharpArch.Data\NHibernate\NHibernateSession.cs: line 110
at SharpArch.Data.NHibernate.NHibernateSession.Init(ISessionStorage
storage, String[] mappingAssemblies, AutoPersistenceModel
autoPersistenceModel, String cfgFile, IDictionary`2 cfgProperties,
String validatorCfgFile, IPersistenceConfigurer persistenceConfigurer)
in C:\MyStuff\Dev\Projects\SharpArchitecture\src\SharpArch
\SharpArch.Data\NHibernate\NHibernateSession.cs: line 75
at SharpArch.Data.NHibernate.NHibernateSession.Init(ISessionStorage
storage, String[] mappingAssemblies, AutoPersistenceModel
autoPersistenceModel, String cfgFile) in C:\MyStuff\Dev\Projects
\SharpArchitecture\src\SharpArch\SharpArch.Data\NHibernate
\NHibernateSession.cs: line 46
at
Serenity.David.Tests.Data.NHibernateMaps.MappingIntegrationTests.SetUp
() in MappingIntegrationTests.cs: line 29

Claudio Maccari

unread,
Jun 23, 2009, 9:55:46 AM6/23/09
to sharp-arc...@googlegroups.com

Hainesy

unread,
Jun 23, 2009, 10:11:25 AM6/23/09
to S#arp Architecture
Okay I can see that I have a common OSS/DLL hell scenario

But the issue is that the latest checked-in version on
SharpArchitecture seems to be at fault. I may be wrong though

Thanks

Chris



On Jun 23, 2:55 pm, Claudio Maccari <claudio.macc...@gmail.com> wrote:
> http://groups.google.com/group/sharp-architecture/browse_thread/threa...
>
> 2009/6/23 Hainesy <haines...@googlemail.com>

Hainesy

unread,
Jun 23, 2009, 10:52:16 AM6/23/09
to S#arp Architecture
Can anyone explain to me why the Northwind sample builds and all the
tests pass for me, yet if I copy the dlls from the \Northwind.Tests\bin
\Debug folder to my own project, I constantly get this Nhibernate
assembly reference error?

I am banging my head against a brick wall here, I've spent nearly an
entire day going nowhere!

All I want is a working version now, and I can't seem to get it to how
it was this morning

Any help would be much appreciated

Chris

Scott Johnson

unread,
Jun 23, 2009, 11:21:20 AM6/23/09
to S#arp Architecture
I encountered the same issue, I was attempting to add NHLamba
Extensions to my project. I ended up downloading the latest
NHibernate (2.1 beta), Re-rolling my FluentNHibernate dlls with it,
and then rolled all of the new dlls into my project (overwriting the
2.0.4.1GA that were in the project). This was all a S#arp generated
project started at the beginning of May. Once I did this, the
NHibernate.Validator dll started complaining about the incorrect
version of NHibernate. So I started searching for an update to the
Validator, which I could not find, and could not get source code.

I was about to throw my box out the window, when, on a whim, I decided
to update my original svn checkout of S#arp Architecture, and I got a
HUGE update. I looked at the release notes, and they had updated to
NHibernate 2.1, with a new release of Fluent and Validator.
Apparently, I was doing all of this at the exact same time as Billy
(and others) were working on the new RTM. So, I grabbed their new
NHibernateValidator, mixed with the NHLambaExtensions, and it worked
REALLY well.

SO, this all relates, in that the changing of so many interrelated
assemblies (at the core NHibernate.dll), unless you want to have to
code the version binding redirects, all of the dependencies have to be
fixed, or you will get these issues.

Hainesy

unread,
Jun 23, 2009, 11:30:31 AM6/23/09
to S#arp Architecture
Sounds very simlar to the mess I am in.

The problem is I have started again using clean references to the dlls
built from the visual studio template

Now I am getting Resharper complaining about it's nunit reference!

I can't seem to win on this!

Chris

Scott Johnson

unread,
Jun 23, 2009, 1:49:48 PM6/23/09
to S#arp Architecture
I think I remember that being a breaking change in the version notes
for S#arp RTM.

From VersionHistory.txt (S#arp Architecture 1.0 RTM):

#) NUnit: Install NUnit 2.5 using the installer found within /tools
(optionally uninstalling previous versions)
Reply all
Reply to author
Forward
0 new messages