-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Duplicate type name within an assembly
PostPosted: Wed Jan 17, 2007 6:21 am 
Regular
Regular

Joined: Fri May 05, 2006 11:54 am
Posts: 51
Hi,

A web site we recently deployed is being pulled down by reaching high levels of CPU, we are logging to the event log and the recurring exceptions I see are:

Duplicate type name within an assembly

and

Failed to lazily initialize a collection ---> NHibernate.HibernateException: Creating a proxy instance failed ---> System.ArgumentException: Duplicate type name within an assembly.

We really need some help with these bugs as the client is far from happy.

I would greatly appreciate any assistance.

We were running NHibernate 1.0.2.0 but we upgraded to 1.0.3.0 but we are still getting the same exceptions. I have copied across the NHibernate .dlls and the CastleProxy.dll from the 1.0.3.0 release. I have pasted the 2 stack traces in the order they are above:

1.Duplicate type name within an assembly

System.ArgumentException: Duplicate type name within an assembly.
at System.Reflection.Emit.AssemblyBuilderData.CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType)
at System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, Module module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType)
at System.Reflection.Emit.ModuleBuilder.DefineTypeNoLock(String name, TypeAttributes attr, Type parent, Type[] interfaces)
at System.Reflection.Emit.ModuleBuilder.DefineType(String name, TypeAttributes attr, Type parent, Type[] interfaces)
at Castle.DynamicProxy.Builder.CodeBuilder.EasyType..ctor(ModuleScope modulescope, String name, Type baseType, Type[] interfaces, Boolean serializable)
at Castle.DynamicProxy.Builder.CodeGenerators.BaseCodeGenerator.CreateTypeBuilder(String typeName, Type baseType, Type[] interfaces)
at Castle.DynamicProxy.Builder.CodeGenerators.ClassProxyGenerator.GenerateCode(Type baseClass, Type[] interfaces)
at Castle.DynamicProxy.Builder.DefaultProxyBuilder.CreateClassProxy(Type theClass, Type[] interfaces)
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type baseClass, Type[] interfaces, IInterceptor interceptor, Boolean checkAbstract, Object[] argumentsForConstructor)
at NHibernate.Proxy.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session)


2. Failed to lazily initialize a collection

Failed to lazily initialize a collection
NHibernate.LazyInitializationException: Failed to lazily initialize a collection ---> NHibernate.HibernateException: Creating a proxy instance failed ---> System.ArgumentException: Duplicate type name within an assembly.
at System.Reflection.Emit.AssemblyBuilderData.CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType)
at System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, Module module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType)
at System.Reflection.Emit.ModuleBuilder.DefineTypeNoLock(String name, TypeAttributes attr, Type parent, Type[] interfaces)
at System.Reflection.Emit.ModuleBuilder.DefineType(String name, TypeAttributes attr, Type parent, Type[] interfaces)
at Castle.DynamicProxy.Builder.CodeBuilder.EasyType..ctor(ModuleScope modulescope, String name, Type baseType, Type[] interfaces, Boolean serializable)
at Castle.DynamicProxy.Builder.CodeGenerators.BaseCodeGenerator.CreateTypeBuilder(String typeName, Type baseType, Type[] interfaces)
at Castle.DynamicProxy.Builder.CodeGenerators.ClassProxyGenerator.GenerateCode(Type baseClass, Type[] interfaces)
at Castle.DynamicProxy.Builder.DefaultProxyBuilder.CreateClassProxy(Type theClass, Type[] interfaces)
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type baseClass, Type[] interfaces, IInterceptor interceptor, Boolean checkAbstract, Object[] argumentsForConstructor)
at NHibernate.Proxy.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session)
--- End of inner exception stack trace ---
at NHibernate.Proxy.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session)
at NHibernate.Persister.AbstractEntityPersister.CreateProxy(Object id, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation)
at NHibernate.Impl.SessionImpl.InternalLoad(Type clazz, Object id)
at NHibernate.Type.ManyToOneType.ResolveIdentifier(Object id, ISessionImplementor session)
at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session, Object owner)
at NHibernate.Type.EntityType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
at NHibernate.Collection.AbstractCollectionPersister.ReadElement(IDataReader rs, Object owner, ISessionImplementor session)
at NHibernate.Collection.Map.ReadFrom(IDataReader rs, ICollectionPersister persister, Object owner)
at NHibernate.Loader.Loader.ReadCollectionElement(Object optionalOwner, Object optionalKey, IDataReader rs, ISessionImplementor session)
at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, IList hydratedObjects, Object optionalObject, Object optionalId, Key[] keys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.CollectionLoader.Initialize(Object id, ISessionImplementor session)
at NHibernate.Collection.AbstractCollectionPersister.Initialize(Object key, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.InitializeCollection(PersistentCollection collection, Boolean writing)
at NHibernate.Collection.PersistentCollection.Initialize(Boolean writing)
--- End of inner exception stack trace ---


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 6:39 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This error should definitely be gone in 1.0.3. Check that the server indeed uses the right version of Castle.DynamicProxy, try clearing the assembly download cache (gacutil /cdl) or whatever. Castle guys don't update version numbers on DynProxy for some reason, so .NET might assume the versions used in 1.0.2 and in 1.0.3 are the same while in fact they are not.


Top
 Profile  
 
 Post subject: Duplicate type name within an assembly
PostPosted: Wed Jan 17, 2007 6:49 am 
Regular
Regular

Joined: Fri May 05, 2006 11:54 am
Posts: 51
Hi,

Thank you for the prompt response.

I do not have these .dlls in the GAC. I will run the Gacutil /cd command.

Is there anything else I can do to ensure I am running with the latest copies of the NHibernate .dlls?

Thanks

Paul


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 7:05 am 
Regular
Regular

Joined: Fri May 05, 2006 11:54 am
Posts: 51
Hi,

Can I double check that I have the latest version of CastleProxy.dll.

Castle.DynamicProxy.dll

All I can check is that it has the following properties:

Created: 02 November 2006, 14:49:24

Size: 72.0 KB (73,728 bytes)

Is this the correct file?

Thanks

Paul


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 7:59 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
The one I have currently in SVN has 77824 bytes. Dates are probably not significant.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 8:11 am 
Regular
Regular

Joined: Fri May 05, 2006 11:54 am
Posts: 51
Hi,

I am nearly sure the version I downloaded was 7328kb.

I am now concerned that I have released the wrong version.

I can no longer download from the following link:

http://http//sourceforge.net/project/showfiles.php?group_id=73818

Is there anyway you can check that the right .dll is in the release.

I am really getting it in the neck from the client.

Cheers

Paul


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 8:19 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Download it from here: http://downloads.sourceforge.net/nhibernate/nhibernate-1.0.3.0.zip It contains Castle.DynamicProxy sized 77824 bytes.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 8:20 am 
Regular
Regular

Joined: Fri May 05, 2006 11:54 am
Posts: 51
Thanks for the speedy help on this!!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.