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.  [ 3 posts ] 
Author Message
 Post subject: reflection error
PostPosted: Wed Apr 16, 2008 7:33 am 
Beginner
Beginner

Joined: Mon Jan 14, 2008 10:58 am
Posts: 24
Hi,
I'm getting this:
Code:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
even when the host says they added reflection permission in the medium trust config.

They sent me this code from their config:
Code:
...
<SecurityClass Name="ReflectionPermission" Description="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089"/>

...

<IPermission class="ReflectionPermission" version="1" Unrestricted="true" />
...

Is there some more lines that have to be in the config?



Stack trace:
Code:

[SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +59
   System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Type owner, StackCrawlMark& stackMark, Boolean skipVisibility) +160
   System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility) +47
   NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateDynamicMethod(Type returnType, Type[] argumentTypes) in ReflectionOptimizer.cs:100
   NHibernate.Bytecode.Lightweight.ReflectionOptimizer.GenerateGetPropertyValuesMethod(IGetter[] getters) in ReflectionOptimizer.cs:121
   NHibernate.Bytecode.Lightweight.ReflectionOptimizer..ctor(Type mappedType, IGetter[] getters, ISetter[] setters) in ReflectionOptimizer.cs:46
   NHibernate.Bytecode.Lightweight.BytecodeProviderImpl.GetReflectionOptimizer(Type mappedClass, IGetter[] getters, ISetter[] setters) in BytecodeProviderImpl.cs:51
   NHibernate.Tuple.Component.PocoComponentTuplizer..ctor(Component component) in PocoComponentTuplizer.cs:41
   NHibernate.Tuple.Component.ComponentEntityModeToTuplizerMapping..ctor(Component component) in ComponentEntityModeToTuplizerMapping.cs:53
   NHibernate.Tuple.Component.ComponentMetamodel..ctor(Component component) in ComponentMetamodel.cs:30
   NHibernate.Mapping.Component.BuildType() in Component.cs:306
   NHibernate.Mapping.Component.get_Type() in Component.cs:295
   NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping) in SimpleValue.cs:301
   NHibernate.Mapping.Property.IsValid(IMapping mapping) in Property.cs:208
   NHibernate.Mapping.PersistentClass.Validate(IMapping mapping) in PersistentClass.cs:948
   NHibernate.Mapping.RootClass.Validate(IMapping mapping) in RootClass.cs:376
   NHibernate.Cfg.Configuration.Validate() in Configuration.cs:782
   NHibernate.Cfg.Configuration.BuildSessionFactory() in Configuration.cs:981
   Swh.Dao.DaoBase.get_CurrentSession() in NHibernateDaoBase.cs:32
   Swh.Dao.GenericDao`1.GetObject(ICriterion[] criterions, Order[] orderbys) in NHibernateGenericDao.cs:528
   Swh.Dao.GenericDao`1.GetObject(ICriterion criterion) in NHibernateGenericDao.cs:435
   Swh.Ih7.Web.PageInfo.get_CurrentSiteID() in PageInfo.cs:90
   Swh.Ih7.Web.PageInfo.get_CurrentSite() in PageInfo.cs:112
   Swh.Ih7.Web.PageInfo.get_CurrentLanguage() in PageInfo.cs:425
   Swh.Ih7.Web.PageInfo.get_CurrentMenu() in PageInfo.cs:269
   Swh.Ih7.Web.BasePage.Page_Load(Object sender, EventArgs e) in BasePage.cs:133
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
   System.Web.UI.Page.ProcessRequest() +86
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.default_aspx.ProcessRequest(HttpContext context) in App_Web_lyk7xunc.0.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64



Thanks,
Mattias


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 16, 2008 8:21 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Sounds like you are running in medium trust. Search the forums and google for Medium Trust with NHibernate for information on how to run in a medium trust environment.

Cheers,

Symon.

_________________
Symon Rottem
http://blog.symbiotic-development.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 16, 2008 8:29 am 
Beginner
Beginner

Joined: Mon Jan 14, 2008 10:58 am
Posts: 24
Yes, the code is running under medium trust.
But they have added reflection permission (atleast what they say)!
Are they lying about their permission settings or does NHibernate need more permissions to make reflection work?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.