Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow asigning to init-only properties in bindings #1909

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

exyi
Copy link
Member

@exyi exyi commented Feb 16, 2025

See https://forum.dotvvm.com/t/intended-behaviour-coherence-of-init-only-properties-between-c-code-and-dotvvm-front-end/295 for some context. In short, it is OK to allow this in JS code (IMHO we want to simplify staticCommands with records, given that we don't support with / new yet it's necessary).

However, it can be quite dangerous on server, where this might allow you to accidentally mutate a shared singleton object (imagine defining public static readonly MyRecord Default = new() { ... } and then using it to initialize a view model property)

@exyi exyi added this to the Version 5.0 milestone Feb 16, 2025
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.

1 participant