Skip to content

Deleting end $ from a LaTex equation crashes the application #343

@shirkrm

Description

@shirkrm

MudMarkdown Version: 8.11.0

Description

When using MudMarkdown, deleting a parsed, formatted LaTeX equation throws an uncatchable exception.

Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: TypeError: can't access property "removeChild", o.parentNode is null

System.InvalidOperationException: TypeError: can't access property "removeChild", o.parentNode is null
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'fpI9GpFEy2sK9PSU5PaiPyWCoKrRJTZuLWzzEptgi8M'.

System.AggregateException: One or more errors occurred. (TypeError: can't access property "removeChild", o.parentNode is null)
 ---> System.InvalidOperationException: TypeError: can't access property "removeChild", o.parentNode is null
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents)
   --- End of inner exception stack trace ---

Steps

  1. Create a simple Blazor web app using MudBlazor and MudMarkdown using InteractiveRenderMode.Server applied globally.

  2. Put the following into Home.razor.

<MudTextField @bind-Value="TextValue" Immediate/>
<MudMarkdown Value="@TextValue"/>

@code{
    private string TextValue { get; set; } = string.Empty;
}
  1. Run the app. Type $$x+y$$ and wait until it parses and displays the LaTeX equation.
  2. Delete the last $
  3. Application crashes.

Expected Result

Application to not crash when LaTeX equation is modified.

Workarounds

Deleting the entire LaTeX equation appears to work, but this is not acceptable for our use case.

Additional Comments

I don't know if this is caused by MudBlazor.Markdown or the underlying Markdig library. While reproducing this, I also noticed that a parsed LaTeX equation can't be modified. I'm hoping that whatever fixes the root cause of this issue will also address that.

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