1

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

  • Microsoft.Practices.EnterpriseLibrary.Common
  • Microsoft.Practices.Unity
  • Microsoft.Practices.Unity.Configuration

Any suggestions?

Martin Brandl
  • 56,134
  • 13
  • 133
  • 172
  • did you try specifying the full qualified name of MethodSignatureMatchingRule type? – onof Nov 22 '13 at 12:07
  • 1
    Not yet. But the alias for the MethodSignatureMatchingRule should be already registred by the Interception extension. I will try it and update my question if it works – Martin Brandl Nov 22 '13 at 12:26

1 Answers1

1

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>
Luiz Guilherme
  • 1,601
  • 21
  • 37