Skip to content

Blazor doesn't render ErrorBoundary's ErrorContent when there are two different exceptions inside it's ChildContent #39814

Open
@xiety

Description

@xiety

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

ErrorBoundary renders nothing when there are two different errors inside it's ChildContent.

Expected Behavior

ErrorBoundary renders exception information.

Steps To Reproduce

App.razor

<ErrorBoundary>
    <ChildContent>
        <ComponentWithError />
    </ChildContent>
    <ErrorContent>
        <div style="background: red">@context</div>
    </ErrorContent>
</ErrorBoundary>

ComponentWithError.razor

@{
    throw new Exception("error2");
}

@code
{
    protected override async Task OnInitializedAsync()
    {
        throw new Exception("error");
    }
}

Exceptions (if any)

No response

.NET Version

6.0.101

Anything else?

I originally ran into this problem when I misspelled the parameter name in the inner component of ComponentWithError:
<ComponentWithoutProp BadProp=1 />
Which throws an exception by itself.

Also with exception inside void OnInitialized() everything works fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions