title: Debugging model with custom validation in ASP.NET Core MVC
body: <p>I'm a newbie of ASP.NET Core MVC and I'm working on a project. I tried to debug values that are returned from form and mapping those values into my model but I cannot dive into my custom validation class, specific is property <code>Name</code> in the model. So, I hope anyone can give me some advice to fix it. Have a great day and a nice weekend guys!! :D</p>
  <p>My custom validation class:</p>
  <pre><code>public class NotNullOrWhiteSpaceValidatorAttribute : ValidationAttribute
  {
      public NotNullOrWhiteSpaceValidatorAttribute() : base(&quot;Invalid Field&quot;) { }
      public NotNullOrWhiteSpaceValidatorAttribute(string Message) : base(Message) { }
  
      public override bool IsValid(object value)
      {
          if (string.IsNullOrWhiteSpace(value.ToString())) 
              return false;
  
          return true;
      }
  
      protected override ValidationResult IsValid(Object value, ValidationContext validationContext)
      {
          if (IsValid(value)) 
              return ValidationResult.Success;
  
          return new ValidationResult(&quot;Value cannot be empty or white space.&quot;);
      }
  }
  </code></pre>
  <p>My model class:</p>
  <pre><code>public class AR_App
  {
      public int Id { get; set; }
  
      [NotNullOrWhiteSpaceValidator]
      public string Name { get; set; }
  
      [NotNullOrWhiteSpaceValidator]
      [MaxLength(5)]
      public string? LanguageCode { get; set; }
  
      [MaxLength(500)]
      public string? Description { get; set; }
  
      [MaxLength(300)]
      public string? IconPath { get; set; }
  
      public int? Status { get; set; }
      public bool? IsDeleted { get; set; }
      public DateTime? CreatedDate { get; set; }
      public int? CreatedBy { get; set; }
      public DateTime? UpdatedDate { get; set; }
      public int? UpdatedBy { get; set; }
  
      [MaxLength(10)]
      public string? UpdatedAction { get; set; }
  }
  </code></pre>