PostSharp4EntLib - getting "Exception has been thrown by the target of an invocation"

Topics: User Discussion
Feb 17, 2008 at 5:03 AM
I am trying to use thePostSharp4EntLib and am getting an error at compilation. I have a Class Library which has a config file containing the poilcy injections. I included the reference to this config file in AssemblyInfo.cs by adding assembly: InjectPoliciesFromConfiguration(@"D:\Samples\TestApp\Business\App.config"). However, On compilation i get an error as follows. Any clues

Compilation Error:

Error 3 Exception has been thrown by the target of an invocation.
Server stack trace:
at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at PostSharp.CodeModel.Helpers.CustomAttributeHelper.ConstructRuntimeObject(ICustomAttributeValue attribute, ModuleDeclaration module)
at PostSharp.Extensibility.Tasks.AutoDetectTask.Execute()
at PostSharp.Extensibility.Project.ExecutePhase(String phase)
at PostSharp.Extensibility.Project.Execute()
at PostSharp.Extensibility.PostSharpObject.ExecuteProjects()
at PostSharp.Extensibility.PostSharpObject.InvokeProjects(ProjectInvocation[] projectInvocations)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at 0:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at PostSharp.Extensibility.IPostSharpObject.InvokeProjects(ProjectInvocation[] projectInvocations)
at PostSharp.Extensibility.PostSharpObjectAccessor.InvokeProjects(ProjectInvocation[] projectInvocations)
at PostSharp.MSBuild.PostSharp.Execute() in p:\open\trunk\Core\PostSharp.MSBuild\PostSharp.cs:line 169 Market.BusinessObjects

PolicyInjection Snippet:
<policyInjection>

<policies>

<add name="Policy">

<matchingRules>

<add type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.MatchingRules.MemberNameMatchingRule, Microsoft.Practices.EnterpriseLibrary.PolicyInjection, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null"

name="Member Name Matching Rule">

<matches>

<add match="ValidateVendor" ignoreCase="false" />

</matches>

</add>

<add type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.MatchingRules.TypeMatchingRule, Microsoft.Practices.EnterpriseLibrary.PolicyInjection, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null"

name="Type Matching Rule">

<matches>

<add match="Vendor" ignoreCase="true" />

</matches>

</add>

</matchingRules>

<handlers>

<add expirationTime="00:05:00" type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers.CachingCallHandler, Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null"

name="Caching Handler" />



</handlers>

</add>

</policies>

</policyInjection>




thanx!!!


regards,

SR