I get an exception stating that the fullname of the dynamic proxy is too long when I use dynamic proxies in an inheritance hierarchy. I have followed the guidelines in the documentation to use interfaces as dynamic proxies so that I can handle the polymorphy in the inheritance hierarchy.
It have worked fine for a very long time, but suddenly I get an error as specified below. It happended after I increased the size of the inheritance hieraarchy (added another joined-subclass with a dynamic proxy)
I remember that I previously noted that the name of the dynamic proxy seems to be constructed from all the interfaces the inheritance hierarchy covers. If that is the convention, then I guess I have run in to a limitation in the size of the inheritance hierarchy as the fully quilified name of a Type in C# seems to be 1024.
Are there any suggestions to how to avoid this problem? Or is this a feature/bug in NHibernate that should be fixed?
I look forward to hear responses.
- Klaus
NHibernate 1.2.0:
Full stack trace of any exception that occurs:
2007-11-15 12:12:00,161 [4] ERROR NHibernate.Proxy.CastleProxyFactory [(null)] - Creating a proxy instance failed
System.ArgumentException: Type name was too long. The fully qualified type name must be less than 1,024 characters.
Parameter name: fullname
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.InterfaceProxyGenerator.GenerateCode(Type[] interfaces, Type targetType)
at Castle.DynamicProxy.Builder.DefaultProxyBuilder.CreateInterfaceProxy(Type[] interfaces, Type type)
at Castle.DynamicProxy.ProxyGenerator.CreateProxy(Type[] interfaces, IInterceptor interceptor, Object target)
at NHibernate.Proxy.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session)
2007-11-15 12:12:47,443 [4] WARN ASP.global_asax [(null)] -
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> NHibernate.HibernateException: Creating a proxy instance failed ---> System.ArgumentException: Type name was too long. The fully qualified type name must be less than 1,024 characters.
Parameter name: fullname
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.InterfaceProxyGenerator.GenerateCode(Type[] interfaces, Type targetType)
at Castle.DynamicProxy.Builder.DefaultProxyBuilder.CreateInterfaceProxy(Type[] interfaces, Type type)
at Castle.DynamicProxy.ProxyGenerator.CreateProxy(Type[] interfaces, IInterceptor interceptor, Object target)
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.Entity.AbstractEntityPersister.CreateProxy(Object id, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation)
at NHibernate.Impl.SessionImpl.Load(Type clazz, Object id)
at Mimer.Data.DAO.BaseDAO.GetEntityByOID[T,I](String oid) in E:\DotnetWorkarea\Mimer\Mimer\Mimer.Data\DAO\BaseDAO.cs:line 29
at Mimer.Business.Managers.InterfaceBaseManager`2.GetEntityByOID(String oid) in E:\DotnetWorkarea\Mimer\Mimer\Mimer.Business\Managers\InterfaceBaseManager.cs:line 76
at Mimer.Web.Common.AbstractEquipmentDetail.LoadDomainObject(String eqpOid) in e:\DotnetWorkarea\Mimer\Mimer\Mimer.Web\App_Code\Common\AbstractEquipmentDetail.cs:line 261
at Mimer.Web.Common.AbstractEquipmentDetail.Page_Load(Object sender, EventArgs e) in e:\DotnetWorkarea\Mimer\Mimer\Mimer.Web\App_Code\Common\AbstractEquipmentDetail.cs:line 200
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at Mimer.Web.Common.AbstractDetailPageControl.OnLoad(EventArgs e) in e:\DotnetWorkarea\Mimer\Mimer\Mimer.Web\App_Code\Common\AbstractDetailPageControl.cs:line 25
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace ---
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.pages_equipments_equipmentdetail_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mimer.web\e028db3e\b5af1485\App_Web_b4v00e-k.20.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Oracle 9i:
|