Hi, first of all thank you for the great controls!
I am developing an app with Radzen Balzor Form components and I have encountered an issues while using the dropdown.
I have integrated fluent validation in my project and I am able to make it work with all other radzen form components
Here's a piece of my code:
<RadzenDropDown @bind-value="@Query.CurrentState"
TValue="TimeseriesWorkflowStateEnum"
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
AllowFiltering="true"
Data="@(Enum.GetValues(typeof(TimeseriesWorkflowStateEnum)).Cast().Select(t => new { Text = $"{t}", Value = t }))"
TextProperty="Text"
ValueProperty="Value" />
I have a simple validation to perform:
public class ReadWorkflowsListByCriteriaValidator : AbstractValidator<ReadWorkflowsListByCriteriaQuery> { public ReadWorkflowsListByCriteriaValidator() { RuleFor(query => query.CurrentState) .IsInEnum(); } }
It doesn't matter if I use enum or string for the property in the Model I always get the same issue:
at System.Object.GetType()
at Blazored.FluentValidation.EditContextFluentValidationExtensions.GetValidatorForModel(IServiceProvider serviceProvider, Object model)
at Blazored.FluentValidation.EditContextFluentValidationExtensions.ValidateField(EditContext editContext, ValidationMessageStore messages, FieldIdentifier fieldIdentifier, IServiceProvider serviceProvider, IValidator validator)
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)
or
Error: System.ArgumentNullException: Value cannot be null. (Parameter 'instance')
at PeterLeslieMorris.Blazor.FluentValidation.FluentValidationRepository.GetValidatorTypesForObject(Object instance)
at PeterLeslieMorris.Blazor.FluentValidation.FluentValidationValidatorProvider.GetValidatorsForObject(Object model, IServiceProvider serviceProvider)
at PeterLeslieMorris.Blazor.FluentValidation.FluentValidationValidatorProvider.ValidateField(EditContext editContext, ValidationMessageStore messages, FieldIdentifier fieldIdentifier, IServiceProvider serviceProvider)
at System.Threading.Tasks.Task.<>c.b__139_0(Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)
Now I've tried a few different 3rd party nugets for visualizing validation errors in blazor and all of them are failing in a similar way. On the first time that I select a value from the dropdown an object is null when trying to get validator for that field.
This approach works when used with the default input select component from Microsoft.
I've narrowed down the issue to not originating from the fluent validation rules builders or the 3rd party nugets used to display those validation errors in blazor. I am somehow misusing the radzen component but I can't comprehend how since I can't see the source code. Any advice?