Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.32k stars 535 forks source link

[Bug]: Unable to evaluate index expressions of type 'PropertyExpression'. #5714

Closed sturlath closed 2 months ago

sturlath commented 3 months ago

Blazorise Version

1.6.1

What Blazorise provider are you running on?

Bootstrap5

Link to minimal reproduction or a simple code snippet

I found this error here when testing my abp.io UI (happens when clicking the "features" on a tenant https://localhost:44307/saas/host/tenants)

Is this an issue on your side or abp.io's?

[14:42:45 WRN] Unhandled exception rendering component: Unable to evaluate index expressions of type 'PropertyExpression'.
System.InvalidOperationException: Unable to evaluate index expressions of type 'PropertyExpression'.
   at Blazorise.Utilities.ExpressionFormatter.FormatIndexArgument(Expression indexExpression, ReverseStringBuilder& builder)
   at Blazorise.Utilities.ExpressionFormatter.FormatLambda(LambdaExpression expression, String prefix)
   at Blazorise.Utilities.ExpressionFormatter.FormatLambda(LambdaExpression expression)
   at Blazorise.Select`1.GetFormatedValueExpression()
   at Blazorise.BaseInputComponent`1.get_NameAttributeValue()
   at Blazorise.Select`1.<BuildRenderTree>b__56_0(RenderTreeBuilder __builder2)
   at Microsoft.AspNetCore.Components.CascadingValue`1.Render(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
[14:42:45 ERR] Unhandled exception in circuit 'vNe_BunHVPTypiw1VOtLm_evJguCsE46o2MN3z-MSP0'.
System.InvalidOperationException: Unable to evaluate index expressions of type 'PropertyExpression'.
   at Blazorise.Utilities.ExpressionFormatter.FormatIndexArgument(Expression indexExpression, ReverseStringBuilder& builder)
   at Blazorise.Utilities.ExpressionFormatter.FormatLambda(LambdaExpression expression, String prefix)
   at Blazorise.Utilities.ExpressionFormatter.FormatLambda(LambdaExpression expression)
   at Blazorise.Select`1.GetFormatedValueExpression()
   at Blazorise.BaseInputComponent`1.get_NameAttributeValue()
   at Blazorise.Select`1.<BuildRenderTree>b__56_0(RenderTreeBuilder __builder2)
   at Microsoft.AspNetCore.Components.CascadingValue`1.Render(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)

Steps to reproduce

n/a

What is expected?

No error

What is actually happening?

This error

What browsers do you see the problem on?

Microsoft Edge

Any additional comments?

I will also create an issue at abp.io and tag this one

David-Moreira commented 3 months ago

@sturlath I honestly can't tell. Not an error I've seen before : Unable to evaluate index expressions of type 'PropertyExpression' and no similar complaints for our Blazorise.Select yet.

Are they perhaps doing dynamic stuff? Can we get the code snippet for how the Blazorise.Select is being used / whatever it's being executed?

David-Moreira commented 3 months ago

https://github.com/dotnet/aspnetcore/issues/56145 I found this very recent issue about using Dictionaries...?

sturlath commented 3 months ago

Are they perhaps doing dynamic stuff? Can we get the code snippet for how the Blazorise.Select is being used / whatever it's being executed?

That functionality is in their pro version and I domt have the source for that. I pinged them on the ticket. Lets hope they answer.. else I will need to back down versions of Blazorise 😖

sturlath commented 3 months ago

@David-Moreira abp.io points to this dropdown item opening this modal here https://github.com/abpframework/abp/tree/dev/modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor/Components

Is there something in there that is causing this error (or is it the dropdown it self? Other dropdown items seem to be working fine.

David-Moreira commented 3 months ago

Well I can see the usage of Dictionaries just like we mentioned image image

This is a Blazor limitation:

https://github.com/dotnet/aspnetcore/issues/56145 I found this very recent issue about using Dictionaries...?

image

PS: I suspect the limitation is specifically when internally Blazor tries to bind the SelectedValueExpression part automatically. So it might work by just using the SelectedValue and SelectedValueChanged parameters separatedly, if the SelectedValueExpression part is not needed. (The expression parameter is usually used for validation purposes as far as I personally know.)

David-Moreira commented 2 months ago

Hey @sturlath were you guys able to figure it out. Is this safe to close on our side?

sturlath commented 2 months ago

@David-Moreira they are planning on updating to 1.6 for their 9.0 version (as seen in linked issue)but I guess its ok to close. Im currently just stuck on this but its no concern to my customers.