Skip to content

Improve Error message when using Editform or Add Analyzers for VS to help you out #54674

@htmlsplash

Description

@htmlsplash

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

When using edit form or (more than 1 edit form) on the same page, the following user mistakes (see below) trigger the generic error message that is not very good for troubleshooting the actual problem

"System.InvalidOperationException: EditForm requires either a Model parameter, or an EditContext parameter, please provide one of these."

Case 1:
User has 2 edit forms and forgot to use FormName attribute on the binding parameters

Case 2:
User has not added any input fields inside the form that bind to binding parameter

Case 3:
User is using a input field of type hidden only. That is currently not allowed, but I would like to have the ability to bind to hidden fields.

Describe the solution you'd like

Add analyzers or improve error messages. I spent quite a bit of time to figure out these isses.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pillar: Dev ExperienceanalyzerIndicates an issue which is related to analyzer experiencearea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the future

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions