Example Code
Parent.razor
<ErrorBoundary Context="ErrorContext" @ref="errorBoundary">
<ChildContent>
<EditForm EditContext="EditContext" OnValidSubmit="ValidSubmit" FormName="PersonForm">
<FluentValidationValidator />
<InputText @bind-Value="Person.FirstName" />
<ValidationMessage For="@(() => Person.FirstName)" />
<br />
<button style="background:green; padding:1em; color: white;" type="submit">Submit</button>
</EditForm>
</ChildContent>
<ErrorContent>
<div class="error"><span>An error occurred</span></div>
</ErrorContent>
</ErrorBoundary>
@code{
private EditContext EditContext { get; set; }
public Person Person { get; set; }
private FluentValidationValidator validator;
protected override async Task OnInitializedAsync()
{
if (Person == null)
Person = new Person();
EditContext = new EditContext(Person);
await base.OnInitializedAsync();
}
}
Person.cs
namespace MyProject.BlazorServer.Pages
{
public class Person
{
public string FirstName { get; set; } = string.Empty;
public PersonAddress PersonAddress { get; set; } = new();
}
public class PersonValidator : AbstractValidator<Person>
{
public PersonValidator()
{
RuleFor(p => p.FirstName).Cascade(CascadeMode.Stop).NotEmpty().WithName("FirstName");
}
}
}



Problem
ToFieldIdentifier is treating the class name as a property of its self. There is no Person.Person. I even tried to use .WithName() thinking that maybe it just needed to be manually set. This is sample code I'm using to debug a project I inherited which has totally jacked up validation. I assume that maybe there is some dependency that wasnt setup correct, but I can't find any reference to point to what would cause this exception and how to get past it.