Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"There is no event handler associated with this event" error when hiding input on change #32165

Closed
mifopen opened this issue Apr 26, 2021 · 1 comment
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-component-model Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc) feature-rendering Features dealing with how blazor renders components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@mifopen
Copy link

mifopen commented Apr 26, 2021

Describe the bug

I need to toggle an input after a user changed it and hit "Enter".
After hiding I get an error in the console.

To Reproduce

https://github.com/mifopen/blazor-bug-mvp

  1. Change the value in the input
  2. Press "Enter"

It's interesting, that the first step is necessary for reproduction.

Exceptions (if any)

Uncaught (in promise) Error: System.ArgumentException: There is no event handler associated with this event. EventId: '2'. (Parameter 'eventHandlerId')
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(:5001/UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)
   at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.DispatchEventAsync(:5001/UInt64 eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs)
   at :5001/Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.ProcessNextDeferredEventAsync()
    at Object.endInvokeDotNetFromJS (blazor.webassembly.js:1)
    at Object.invokeJSFromDotNet (blazor.webassembly.js:1)
    at Object.w [as invokeJSFromDotNet] (blazor.webassembly.js:1)
    at _mono_wasm_invoke_js_blazor (dotnet.6.0.0-preview.3.21201.4.js:1)
    at do_icall (:5001/_framework/dotnet.wasm:wasm-function[10596]:0x194e4e)
    at do_icall_wrapper (:5001/_framework/dotnet.wasm:wasm-function[3305]:0x79df9)
    at interp_exec_method (:5001/_framework/dotnet.wasm:wasm-function[2155]:0x44ad3)
    at interp_runtime_invoke (:5001/_framework/dotnet.wasm:wasm-function[7862]:0x12efff)
    at mono_jit_runtime_invoke (:5001/_framework/dotnet.wasm:wasm-function[7347]:0x118e5f)
    at do_runtime_invoke (:5001/_framework/dotnet.wasm:wasm-function[3304]:0x79d42)

Further technical details

  • ASP.NET Core version 5.0.100
.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.3.21202.5
 Commit:    aee38a6dd4

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  11.2
 OS Platform: Darwin
 RID:         osx.11.0-x64
 Base Path:   /usr/local/share/dotnet/sdk/6.0.100-preview.3.21202.5/

Host (useful for support):
  Version: 6.0.0-preview.3.21201.4
  Commit:  236cb21e3c

.NET SDKs installed:
  3.1.302 [/usr/local/share/dotnet/sdk]
  5.0.100 [/usr/local/share/dotnet/sdk]
  6.0.100-preview.2.21155.3 [/usr/local/share/dotnet/sdk]
  6.0.100-preview.3.21202.5 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-preview.8.20414.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.2.21154.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-preview.8.20407.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.3.21201.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  • JetBrains Rider 2021.1.2
@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-component-model Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc) feature-rendering Features dealing with how blazor renders components labels Apr 26, 2021
@SteveSandersonMS
Copy link
Member

This was recently fixed in #31612 and #32017. The fix will ship in .NET 6 Preview 5.

For a workaround until then, you can use await Task.Yield() before hiding the text box. For example, updating your code:

    private async Task Callback(KeyboardEventArgs args)
    {
        if (args.Key == "Enter")
        {
            await Task.Yield();
            showInput = false;
        }
    }

Closing as duplicate.

@SteveSandersonMS SteveSandersonMS added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Apr 26, 2021
@ghost ghost added the Status: Resolved label Apr 26, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-component-model Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc) feature-rendering Features dealing with how blazor renders components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants