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

Blazor: FieldIdentifier only supports simple member accessors (fields, properties) of an object. #33546

Closed fire-cloud-apps closed 3 years ago

fire-cloud-apps commented 3 years ago

Framework .NET 5.0 Web Applicaiton: Blazor Client Project using WebAsm.

When I run the application using Debug mode it woks without any error. But after hosting the same in IIS (either in release/debug mode) Issue occurred. I have used IIS 10.0 version.

Code snapshot:

<EditForm Model="@_model" OnValidSubmit="OnValidSubmit">
            <DataAnnotationsValidator />
            <MudGrid>
                <MudItem xs="12" sm="12" md="12">
                    <MudDivider />
                </MudItem>
                <MudItem xs="4" sm="4" md="4">
                    <MudTextField T="string" Label="Short Name" 
                                  @attributes="_modelInputValidation.ShotNameValidation"
                                  @bind-Value="@_model.ShortName" 
                                  For="@(() => _model.ShortName)" 
                                  Immediate="true" 
                                   />
                </MudItem>

                <MudItem xs="6" sm="6" md="6">
                    <MudTextField T="string" Label="Full Name" @bind-Value="@_model.FullName"
                                  @attributes="_modelInputValidation.FullNameValidation"
                                  For="@(() => _model.FullName)"  Immediate="true" />
                </MudItem>

                <MudItem xs="12" sm="12" md="12" Class="d-flex flex-row-reverse py-2 px-1">
                    <MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Primary">Save</MudButton>
                </MudItem>

            </MudGrid>

        </EditForm>

Error Details:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: The provided expression contains a PropertyExpression which is not supported. FieldIdentifier only supports simple member accessors (fields, properties) of an object. System.ArgumentException: The provided expression contains a PropertyExpression which is not supported. FieldIdentifier only supports simple member accessors (fields, properties) of an object. at Microsoft.AspNetCore.Components.Forms.FieldIdentifier.ParseAccessor[String](Expression1 accessor, Object& model, String& fieldName) at Microsoft.AspNetCore.Components.Forms.FieldIdentifier.Create[String](Expression1 accessor) at MudBlazor.MudFormComponent2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnParametersSet() at MudBlazor.MudBaseInput1[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnParametersSet() at MudBlazor.MudDebouncedInput1[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnParametersSet() at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at MudBlazor.MudBaseInput1.d__146[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()

mkArtakMSFT commented 3 years ago

Thanks for contacting us. We will need to have a minimalistic repro app, which doesn't involve any third party components and is based off of a new project template + minimal set of changes to reproduce the behavior. Please provide it so that we can investigate this.

ghost commented 3 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.