Assembly does not allow partially trusted callers
am 05.11.2007 12:17:02 von JobLotI have created Exception Handling Policy that shows a custom error message
using Custom Handler and logs it to event log using Logging Handler. I am
using this policy in various layers of my solution. Issue is when I call
HandleException method in a project of type class library, it gives the
following error. If I call the same method in a Windows Form project it works
alright. What is going wrong here, why does the same code works in Win Form
app and not Class Library? Please help
===================================
That assembly does not allow partially trusted callers.
(Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Log ging)
------------------------------
Program Location:
at System.Security.CodeAccessSecurityEngine.ThrowSecurityExcept ion(Assembly
asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh,
SecurityAction action, Object demand, IPermission permThatFailed)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logg ing.Configuration.LoggingExceptionHandlerAssembler.Assemble( IBuilderContext
context, ExceptionHandlerData objectConfiguration, IConfigurationSource
configurationSource, ConfigurationReflectionCache reflectionCache)
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O bjectBuilder.AssemblerBasedObjectFactory`2.Create(IBuilderCo ntext
context, TConfiguration objectConfiguration, IConfigurationSource
configurationSource, ConfigurationReflectionCache reflectionCache)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Exce ptionPolicyEntryCustomFactory.Create(IBuilderContext
context, ExceptionTypeData objectConfiguration, IConfigurationSource
configurationSource, ConfigurationReflectionCache reflectionCache)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Exce ptionPolicyCustomFactory.CreateObject(IBuilderContext
context, String name, IConfigurationSource configurationSource,
ConfigurationReflectionCache reflectionCache)
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O bjectBuilder.ConfiguredObjectStrategy.BuildUp(IBuilderContex t
context, Type t, Object existing, String id)
at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IB uilderContext
context, Type typeToBuild, Object existing, String idToBuild)
at
Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp( IBuilderContext
context, Type typeToBuild, Object existing, String idToBuild)
at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IB uilderContext
context, Type typeToBuild, Object existing, String idToBuild)
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O bjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuild erContext
context, Type t, Object existing, String id)
at
Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IR eadWriteLocator
locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[]
transientPolicies)
at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IRea dWriteLocator
locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[]
transientPolicies)
at
Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUpTType ToBuild(IReadWriteLocator
locator, String idToBuild, Object existing, PolicyList[] transientPolicies)
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O bjectBuilder.EnterpriseLibraryFactory.BuildUpT(IReadWriteLoc ator
locator, String id, IConfigurationSource configurationSource)
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O bjectBuilder.LocatorNameTypeFactoryBase`1.Create(String name)
at Trinity.ExceptionHandling.ExceptionPolicy.HandleException(Ex ception
exception, String policyName)