Skip to content

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 21, 2026

Benchmark PR from qodo-benchmark#84


Note

Adds a reusable way to render model field labels based on annotations and adopts it in templates.

  • New DisplayName<TValue> component resolves display text via DisplayAttribute/DisplayNameAttribute, falling back to the property name
  • New internal ExpressionMemberAccessor parses field expressions, caches member info, and clears cache on hot reload
  • Public API updated to include DisplayName<TValue>
  • Unit and E2E tests validate attribute precedence, fallback behavior, type coverage, and resource-based localization
  • Demo DisplayNameComponent.razor and new resource strings (Resources.resx/Resources.fr.resx) for localization
  • Blazor Account pages (ForgotPassword, Login, Register, Manage/ChangePassword, Manage/Email, ResetPassword) now use DisplayName in labels; corresponding InputModel properties annotated with Display

Written by Cursor Bugbot for commit 028e82f. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.


internal static class ExpressionMemberAccessor
{
private static readonly ConcurrentDictionary<Expression, MemberInfo> _memberInfoCache = new();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory leak from caching expressions by reference equality

High Severity

The _memberInfoCache uses Expression objects as dictionary keys, but Expression doesn't override Equals/GetHashCode, so reference equality is used. Since Blazor creates new expression objects each render (e.g., () => model.Property), every render adds a new cache entry. This causes unbounded memory growth and prevents garbage collection of captured model objects referenced by the expressions.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants