Skip to content

Misleading error message [Blazor]  #23354

@mrpmorris

Description

@mrpmorris

When the Model passed to an EditForm is null, the error message says you cannot have both an EditContext and a Model.

Model can be null during rendering if set in OnInitializedAsync after an awaited call to a server, so this error won't be uncommon.

The error text used should be different if both EditContext and Model are null. Eg "An EditContext or Model is required"

The existing text implies you have both, rather than that you have neither.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions