Blazor 未捕获(承诺中)错误:System.ArgumentException:没有与此事件关联的事件处理程序。事件ID:';4'&引用;

Blazor 未捕获(承诺中)错误:System.ArgumentException:没有与此事件关联的事件处理程序。事件ID:';4'&引用;,blazor,Blazor,问题描述 在输入元素上使用bind属性和onblur事件时,导致Uncaught(承诺中)错误:System.ArgumentException:没有与此事件关联的事件处理程序。EventId:'4 示例: 复制过程 运行样本 单击“转到计数器”页面的导航按钮 然后在文本框中输入计数器页面中呈现的任何内容 现在,按下chrome浏览器上的后退按钮 现在,请参阅控制台以了解错误 屏幕截图 错误 Uncaught (in promise) Error: System.ArgumentExcepti

问题描述

在输入元素上使用bind属性和onblur事件时,导致
Uncaught(承诺中)错误:System.ArgumentException:没有与此事件关联的事件处理程序。EventId:'4

示例:

复制过程

  • 运行样本
  • 单击“转到计数器”页面的导航按钮
  • 然后在文本框中输入计数器页面中呈现的任何内容
  • 现在,按下chrome浏览器上的后退按钮
  • 现在,请参阅控制台以了解错误
  • 屏幕截图

    错误

    Uncaught (in promise) Error: System.ArgumentException: There is no event handler associated with this event. EventId: '4'. (Parameter 'eventHandlerId')
       at Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)
       at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs)
       at Microsoft.AspNetCore.Components.WebAssembly.Infrastructure.JSInteropMethods.DispatchEvent(WebEventDescriptor eventDescriptor, String eventArgsJson)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    --- End of stack trace from previous location ---
       at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
       at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
        at Object.endInvokeDotNetFromJS (https://localhost:44389/_framework/blazor.webassembly.js:1:4191)
        at Object.invokeJSFromDotNet (https://localhost:44389/_framework/blazor.webassembly.js:1:3797)
        at Object.w [as invokeJSFromDotNet] (https://localhost:44389/_framework/blazor.webassembly.js:1:64075)
        at _mono_wasm_invoke_js_blazor (https://localhost:44389/_framework/dotnet.5.0.0.js:1:190800)
        at do_icall (<anonymous>:wasm-function[10595]:0x194e46)
        at do_icall_wrapper (<anonymous>:wasm-function[3305]:0x79df6)
        at interp_exec_method (<anonymous>:wasm-function[2155]:0x44ad0)
        at interp_runtime_invoke (<anonymous>:wasm-function[7861]:0x12efed)
        at mono_jit_runtime_invoke (<anonymous>:wasm-function[7346]:0x118e4d)
        at do_runtime_invoke (<anonymous>:wasm-function[3304]:0x79d3f)
    
    Uncaught(承诺中)错误:System.ArgumentException:没有与此事件关联的事件处理程序。EventId:'4'。(参数“eventHandlerId”)
    位于Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId、EventFieldInfo fieldInfo、EventArgs EventArgs)
    位于Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.DispatchEventAsync(UInt64 eventHandlerId、EventFieldInfo EventFieldInfo、EventArgs EventArgs)
    位于Microsoft.AspNetCore.Components.WebAssembly.Infrastructure.JSInteropMethods.DispatchEvent(WebEventDescriptor eventDescriptor,String eventArgsJson)
    在System.Reflection.RuntimeMethodInfo.Invoke(对象obj、BindingFlags invokeAttr、绑定器绑定器、对象[]参数、CultureInfo区域性)
    ---上一个位置的堆栈结束跟踪---
    在Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime-JSRuntime,DotNetInvocationInfo&callInfo,IDotNetObjectReference-objectReference,字符串argsJson)
    位于Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime JSRuntime,DotNetInvocationInfo invocationInfo,字符串argsJson)
    在Object.endInvokeDotNetFromJS处(https://localhost:44389/_framework/blazor.webassembly.js:1:4191)
    在Object.invokeJSFromDotNet上(https://localhost:44389/_framework/blazor.webassembly.js:1:3797)
    在Object.w[作为invokeJSFromDotNet](https://localhost:44389/_framework/blazor.webassembly.js:1:64075)
    在mono_wasm_js_blazor(https://localhost:44389/_framework/dotnet.5.0.0.js:1:190800)
    at do_icall(:wasm函数[10595]:0x194e46)
    at do_icall_包装器(:wasm函数[3305]:0x79df6)
    at interp_exec_方法(:wasm函数[2155]:0x44ad0)
    在interp_运行时调用(:wasm函数[7861]:0x12efed)
    在mono_jit_运行时调用(:wasm函数[7346]:0x118e4d)
    在do_运行时调用(:wasm函数[3304]:0x79d3f)
    
    代码片段

    
    @代码{​​​​​​​
    公共事件(FocuseEventArgs)
    {​​​​​​​
    }​​​​​​​
    公共字符串val{​​​​​​​ get;set;}​​​​​​​
    }​​​​​​​