dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.37k stars 9.99k forks source link

Error: System.InvalidOperationException: Method calls cannot be formatted in InputNumber & InputTextArea #53834

Closed EmpiteLakshitha closed 8 months ago

EmpiteLakshitha commented 8 months ago

Is there an existing issue for this?

Describe the bug

<InputTextArea class="form-control" @bind-Value="@Request.Model.First().Description" /> When I upgraded .net 6.0 to .net 8.0 this controller gives me the following exception.

image

So I had to add name="Description".

Expected Behavior

These controllers need to work same as using blazor.server.js

Steps To Reproduce

just create a property as Request.Model.First().Description and create a EditForm . Then try to load it

Exceptions (if any)

image

.NET Version

.net 8

Anything else?

No response

javiercn commented 8 months ago

@EmpiteLakshitha thanks for contacting us.

As part of SSR support all input elements need to generate a form field name attribute, which they do by formatting the expression passed to the component (the thing inside the @bind expression).

There is limited support for the expressions that we support (we don't support method calls other than indexers) so there are two things you can do:

ghost commented 8 months ago

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.