Unhandled exception rendering component: Cannot read properties of null (reading 'removeChild')

248 Views Asked by At

I have created an Edit Question form page Using EditForm in Mudblazor, but when I click the save(submit) button, I get an error like this.

EditSecurityQuestion.razor code

<EditForm Model="SeEditSeQues" OnValidSubmit="OnFormValid">
        @*<div>*@
        <div class="pa-4">
            <BlazoredTextEditor @ref="@QuillHtml">
                <ToolbarContent>
                    <select class="ql-header">
                        <option selected=""></option>
                        <option value="1"></option>
                        <option value="2"></option>
                        <option value="3"></option>
                        <option value="4"></option>
                        <option value="5"></option>
                    </select>
                    <span class="ql-formats">
                        <button class="ql-bold"></button>
                        <button class="ql-italic"></button>
                        <button class="ql-underline"></button>
                        <button class="ql-strike"></button>
                    </span>
                    <span class="ql-formats">
                        <select class="ql-color"></select>
                        <select class="ql-background"></select>
                    </span>
                    <span class="ql-formats">
                        <button class="ql-list" value="ordered"></button>
                        <button class="ql-list" value="bullet"></button>
                    </span>
                    <span class="ql-formats">
                        <button class="ql-link"></button>
                    </span>
                </ToolbarContent>
                <EditorContent>
                    @((MarkupString)SeEditSeQues.SecurityQuestion)
                </EditorContent>
            </BlazoredTextEditor>
            <br />
        </div>
        <div class="pa-4">
            <MudSelect T="string" Label="DataControl" @bind-Value="SeEditSeQues.DataControl" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
                <MudSelectItem Value="@("TextBox")" />
                <MudSelectItem Value="@("TextArea")" />
                <MudSelectItem Value="@("MediumTextArea")" />
            </MudSelect>
        </div>
        <MudCardActions>
                <div class="pa-4">
                    <MudButton OnClick="Cancel" Variant="Variant.Filled" Color="Color.Primary">Cancel</MudButton>
                </div>
                <div class="pa-4">
                <MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Primary">Save</MudButton>
                </div>
        </MudCardActions>
        @*</div>*@
    </EditForm>

private async Task OnFormValid()
{ 
    try
    {
        SeEditSeQues.SecurityQuestion = await QuillHtml.GetHTML();
        await seservice.Update(SeEditSeQues);
        items.Add(SeEditSeQues);
        snackBar.Add("Question Modified.", Severity.Success);
        StateHasChanged();
    }
    catch (Exception ex)
    {
        snackBar.Add($"An error occurred: {ex.Message}", Severity.Error);
    }
}

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Cannot read properties of null (reading 'removeChild') TypeError: Cannot read properties of null (reading 'removeChild') at H (https://localhost:5001/_framework/blazor.webassembly.js:1:17059) at H (https://localhost:5001/_framework/blazor.webassembly.js:1:17029) at se.applyEdits (https://localhost:5001/_framework/blazor.webassembly.js:1:22068) at se.updateComponent (https://localhost:5001/_framework/blazor.webassembly.js:1:20461) at https://localhost:5001/_framework/blazor.webassembly.js:1:57076 at At.Fe._internal.renderBatch (https://localhost:5001/_framework/blazor.webassembly.js:1:57448) at Object.St [as invokeJSFromDotNet] (https://localhost:5001/_framework/blazor.webassembly.js:1:60134) at _mono_wasm_invoke_js_blazor (https://localhost:5001/_framework/dotnet.6.0.16.fy2kjeycku.js:1:195300) at wasm://wasm/00971dfe:wasm-function[3308]:0xc6137 at wasm://wasm/00971dfe:wasm-function[167]:0xd602 Microsoft.JSInterop.JSException: Cannot read properties of null (reading 'removeChild') TypeError: Cannot read properties of null (reading 'removeChild') at H (https://localhost:5001/_framework/blazor.webassembly.js:1:17059) at H (https://localhost:5001/_framework/blazor.webassembly.js:1:17029) at se.applyEdits (https://localhost:5001/_framework/blazor.webassembly.js:1:22068) at se.updateComponent (https://localhost:5001/_framework/blazor.webassembly.js:1:20461) at https://localhost:5001/_framework/blazor.webassembly.js:1:57076 at At.Fe._internal.renderBatch (https://localhost:5001/_framework/blazor.webassembly.js:1:57448) at Object.St [as invokeJSFromDotNet] (https://localhost:5001/_framework/blazor.webassembly.js:1:60134) at _mono_wasm_invoke_js_blazor (https://localhost:5001/_framework/dotnet.6.0.16.fy2kjeycku.js:1:195300) at wasm://wasm/00971dfe:wasm-function[3308]:0xc6137 at wasm://wasm/00971dfe:wasm-function[167]:0xd602 at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object,Object](String identifier, Int32 arg0, RenderBatch arg1, Object arg2, Int64 targetInstanceId) at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object](String identifier, Int32 arg0, RenderBatch arg1) at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.UpdateDisplayAsync(RenderBatch& batch) at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

Thank you!!!

0

There are 0 best solutions below