Receiving below error when using enterprise Library 5.0 validation block

Topics: General discussion, Validation Application Block
Nov 27, 2014 at 3:13 PM
Hi,

I am receiving below error and while code looks fine to me.

[Possible error could be due to some other DLL reference is required or Source Code also need to be there when referring to DLL] (Also here ValidationResult Count show 0, which doesn't appear to be correct)

But I am not sure, Can anyone identify and tell me the issue, thanks a lot

No Source Available Microsoft.Practices.EnterpriseLibrary.Validation.DLL!Microsoft.Practices.EnterpriseLibrary.Validation.ValidationResults.System.Collections.Generic.IEnumerable<Microsoft.Practices.EnterpriseLibrary.Validation.ValidationResult>

Locating source for 'e:\Builds\EntLib\Latest\Source\Blocks\Validation\Src\Validation\ValidationResults.cs'. Checksum: MD5 {6d 37 9a 66 f0 9 f 39 a0 16 be 8f 9c 22 5f 12}
The file 'e:\Builds\EntLib\Latest\Source\Blocks\Validation\Src\Validation\ValidationResults.cs' does not exist.
Looking in script documents for 'e:\Builds\EntLib\Latest\Source\Blocks\Validation\Src\Validation\ValidationResults.cs'...
Looking in the projects for 'e:\Builds\EntLib\Latest\Source\Blocks\Validation\Src\Validation\ValidationResults.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: e:\Builds\EntLib\Latest\Source\Blocks\Validation\Src\Validation\ValidationResults.cs.
The debugger could not locate the source file 'e:\Builds\EntLib\Latest\Source\Blocks\Validation\Src\Validation\ValidationResults.cs'.

While code looks fine to me. Below is my code. [Possible error due to some other DLL reference is required or Source Code also need to be there when referring to DLL]

using MyLibrary;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet;

private Validator<SV> MyLibrary;
protected void Page_Load(object sender, EventArgs e)
{
 }

protected void btnShow_Click(object sender, EventArgs e)
{
    SV objRule = new SV();

    objRule.FirstName = txtFirstName.Text;
    objRule.LastName = txtLastName.Text;
    objRule.Email = txtEmail.Text;
    objRule.AccountNumber = txtAccountNumber.Text;

    ValidatorFactory valFactory = EnterpriseLibraryContainer.Current.GetInstance<ValidatorFactory>();

    Validator<SV> myValidator = valFactory.CreateValidator<SV>("Validation Ruleset");

    ValidationResults valResults = myValidator.Validate(objRule);    // on quickwatch of valResults, Count show null

    //ValidationResults results = Validation.Validate(objRule);

    //if (!valResults.IsValid)
    //{
        foreach (ValidationResult objResult in valResults)
        {
            Response.Write(objResult.Message);
        }
    //}
// part of web.config

<configuration>
<configSections>
<section name="validation" type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
      <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
      <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
      <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
    </sectionGroup>
  </sectionGroup>
</sectionGroup>
</configSections>
<validation>
<type name="SV" defaultRuleset="Validation Ruleset" assemblyName="QuantumLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
  <ruleset name="Validation Ruleset">
    <add type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.DateTimeRangeValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      lowerBound="1900-01-01" upperBound="2039-12-31" lowerBoundType="Inclusive"
      messageTemplate="Date should be valid." messageTemplateResourceType=""
      name="Date Range Validator" />
    <add type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.NotNullValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      messageTemplate="Null is not allowed." name="Not Null Validator" />
    <add type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RegexValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      pattern="^\ *([A-Z]{1,2}[0-9][0-9A-Z]?[ ]?[0-9][A-Z]{2})\ *$"
      options="IgnoreCase, IgnorePatternWhitespace" messageTemplate="Valid Post Code is required."
      name="Regular Expression Post Code Validator" />
    <add type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.AndCompositeValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      name="And Composite Validator" />
    <add type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RegexValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      pattern="^[0-9a-zA-Z''-'\s]$" options="IgnoreCase, IgnorePatternWhitespace, CultureInvariant"
      messageTemplate="Only Alpha Numeric Characters are allowed"
      name="Regular Expression AlphaNumeric Allowed" />
    <add type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RegexValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      pattern="^[a-zA-Z''-'\s]$" options="IgnoreCase, IgnorePatternWhitespace, CultureInvariant"
      name="Regular Expression AlphabetsOnly Validator" />
    <add type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.StringLengthValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      upperBound="20" name="String Length TwentyCharsAllowed" />
    <properties>
      <property name="LastName" />
      <property name="Email" />
      <property name="PhoneNumber" />
      <property name="Property To Validate" />
      <property name="FirstName" />
      <property name="AccountNumber" />
    </properties>
  </ruleset>
</type>
</validation>