unity-containerenterprise-libraryunity-interceptioncross-cutting-concerns

Unity Interception MethodSignatureMatchingRule could not be resolved


Im using Unity (3.0) interception to add some crosscutting concerns to my application. Somehow I can't use the MethodSignatureMatchingRule in my configuration getting this error message:

{"The type name or alias MethodSignatureMatchingRule could not be resolved. Please check your configuration file and verify this type name."}

My configuration:

<?xml version="1.0"?>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
  <sectionExtension type="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, Microsoft.Practices.Unity.Interception.Configuration" />
  <alias alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />
  <containers>
    <container name="MyContainer">
      <extension type="Interception"/>
      <interception>
        <policy name="EhabAspect">
          <matchingRule name="MethodSignatureMatchingRule" type="MethodSignatureMatchingRule">
            <constructor>
              <param name="methodName" value="Receive" type="string"/>
            </constructor>
          </matchingRule>
          <callHandler ... (omitted)
        </policy>
      </interception>
      <register type="IMyClass" mapTo="MyClass">
        <lifetime type="singleton" />
        <interceptor type="InterfaceInterceptor"/>
        <policyInjection/>
      </register>
    </container>
  </containers>
</unity>

The same configuration with the NamespaceMatchingRule works fine.

My assembly contains a reference to

Any suggestions?


Solution

  • I was facing the same problem here. I solved using the full qualified name of the of the class.

    <matchingRule name="AuthorizationMethod" type="Microsoft.Practices.Unity.InterceptionExtension.MethodSignatureMatchingRule, Microsoft.Practices.Unity.Interception">
      <constructor>
        <param name="methodName" value="Authenticate" type="string"/>
        <param name="parameterTypeNames" dependencyName="EmptyArray"/>
      </constructor>
    </matchingRule>