Skip to content

fix: Error when typing value in FluentCombobox #3600

@JamesNK

Description

@JamesNK

🐛 Bug Report

A bug was reported in Aspire when typing in the value in a combobox.

fail: Aspire.Hosting.Dashboard.Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit 'cZsXhk0i7RcEU_to02CxNizphfSvg7cyP6wWXOtvIAg'.
      System.AggregateException: One or more errors occurred. (The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state.)
       ---> System.InvalidOperationException: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state.
         at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
         at Microsoft.AspNetCore.Components.Forms.EditContextDataAnnotationsExtensions.DataAnnotationsEventSubscriptions.OnFieldChanged(Object sender, FieldChangedEventArgs eventArgs)
         at Microsoft.FluentUI.AspNetCore.Components.ListComponentBase`1.RaiseChangedEventsAsync() in /_/src/Core/Components/List/ListComponentBase.razor.cs:line 582
         at Microsoft.FluentUI.AspNetCore.Components.ListComponentBase`1.OnSelectedItemChangedHandlerAsync(TOption item) in /_/src/Core/Components/List/ListComponentBase.razor.cs:line 557
         at Microsoft.FluentUI.AspNetCore.Components.FluentCombobox`1.ChangeHandlerAsync(ChangeEventArgs e) in /_/src/Core/Components/List/FluentCombobox.razor.cs:line 156
         at Microsoft.FluentUI.AspNetCore.Components.FluentInputBase`1.<>c__DisplayClass116_0.<<InputHandlerAsync>b__0>d.MoveNext() in /_/src/Core/Components/Base/FluentInputBaseHandlers.cs:line 73
         --- End of inner exception stack trace ---
         at Microsoft.FluentUI.AspNetCore.Components.FluentInputBase`1.InputHandlerAsync(ChangeEventArgs e) in /_/src/Core/Components/Base/FluentInputBaseHandlers.cs:line 73
         at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

💻 Repro or Code Sample

See dotnet/aspire#8343

🤔 Expected Behavior

No error.

😯 Current Behavior

Typing the last letter in a combobox value causes the error:

Image

💁 Possible Solution

🔦 Context

🌍 Your Environment

  • OS & Device: [e.g. MacOS, iOS, Windows, Linux] on [iPhone 7, PC]
  • Browser [e.g. Microsoft Edge, Google Chrome, Apple Safari, Mozilla FireFox]
  • .NET and Fluent UI Blazor library Version [e.g. 8.0.2 and 4.4.1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions