'Microsoft.Practices.EnterpriseLibrary.Validation.PolicyInjection.ValidationCallHandler exception.

Jun 2, 2011 at 5:12 AM

Hi  ,
I Do the Following steps, but it always throw exception.

first, because i want to debug the enterprises library 5.0 source code , so i added a console project  to the  enterprises library 5.0 source code solution.

  
second,i set the EnterpriseLibraryConfigurationSet  to EntLibV5Src.
 
third , i run the Following  code, but i always throw exception, Can you  teach me how to solve the problem,
thank you !
 ......
using Microsoft.Practices.EnterpriseLibrary.PolicyInjection;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            OrderProcessor processor = PolicyInjection.Create<OrderProcessor>();
            Order order = new Order();
            processor.Process(order);
            processor.Process(order);
        }
    }
 

 
"The type 'Microsoft.Practices.EnterpriseLibrary.Validation.PolicyInjection.ValidationCallHandler, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null' cannot be resolved. Please verify the spelling is correct or that the full type name is provided."
 
 
app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="validation" type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" requirePermission="true" />
        <section name="policyInjection" type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.Configuration.PolicyInjectionSettings, Microsoft.Practices.EnterpriseLibrary.PolicyInjection, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" requirePermission="true" />
    </configSections>
    <validation />
    <policyInjection>
        <policies>
            <add name="Policy1">
                <matchingRules>
                    <add type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.MatchingRules.TypeMatchingRule, Microsoft.Practices.EnterpriseLibrary.PolicyInjection, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null"
                        name="Type Matching Rule">
                        <matches>
                            <add match="OrderProcessor" />
                        </matches>
                    </add>
                </matchingRules>
                <handlers>
                    <add type="Microsoft.Practices.EnterpriseLibrary.Validation.PolicyInjection.ValidationCallHandler, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null"
                        specificationSource="Both" name="Validation Call Handler" />
                </handlers>
            </add>
        </policies>
    </policyInjection>
</configuration>
 
thank you!
Jun 2, 2011 at 7:04 AM

Hi,

Just make sure that you've referenced the required dll from the Enterprise Library Installation Folder (C:\Program Files\Microsoft Enterprise Library 5.0\Bin). I just noticed that all the PublicKeyTokens are null.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com