Skip to content

EnumInput Value cannot be null. (Parameter 'obj') #1300

Description

@tippers424

NOTE: We do not look at .zip attachments for issue investigation.

Describe the bug
When using EnumInput inside a div with class col-md-3 the control doesn't render. I want the EnumInput width to be limited and not fill the whole width.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
No error when rendering.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • .NET Version: .NET 8
  • BlazorBootstrap: 3.5
  • Blazor WebAssembly / Server: Server
  • Blazor Interactive Render Mode: Server
  • Blazor Interactivity Location: Global

Sample code

<div class="form-group row mb-2">
    <label class="col-md-4 col-form-label">Type: <span class="text-danger">*</span></label>
    <div class="col-md-3">
        <EnumInput TEnum="SalesPriceType" Value="@type" ValueChanged="OnTypeChanged" />
        <ValidationMessage For="@(() => obj1.Type)" />
    </div>
</div>

Desktop (please complete the following information):

  • OS: Windows
  • Browser Edge
  • Version 151

Exception thrown:
System.ArgumentNullException: Value cannot be null. (Parameter 'obj')
at System.OrdinalCaseSensitiveComparer.GetHashCode(String obj)
at Microsoft.AspNetCore.Components.Forms.FieldIdentifier.GetHashCode()
at System.Collections.Generic.Dictionary2.FindValue(TKey key) at System.Collections.Generic.Dictionary2.TryGetValue(TKey key, TValue& value)
at Microsoft.AspNetCore.Components.Forms.EditContext.GetValidationMessages(FieldIdentifier fieldIdentifier)+MoveNext()
at System.Linq.Enumerable.g__WithEnumerator|36_0[TSource](IEnumerable1 source) at System.Linq.Enumerable.Any[TSource](IEnumerable1 source)
at Microsoft.AspNetCore.Components.Forms.FieldCssClassProvider.GetFieldCssClass(EditContext editContext, FieldIdentifier& fieldIdentifier)
at Microsoft.AspNetCore.Components.Forms.EditContextFieldClassExtensions.FieldCssClass(EditContext editContext, FieldIdentifier& fieldIdentifier)
at BlazorBootstrap.EnumInput1.get_FieldCssClasses() at BlazorBootstrap.EnumInput1.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions