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

Public parameters in Components don't result in warnings #10244

Closed
stsrki opened this issue May 14, 2019 · 3 comments
Closed

Public parameters in Components don't result in warnings #10244

stsrki opened this issue May 14, 2019 · 3 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.

Comments

@stsrki
Copy link
Contributor

stsrki commented May 14, 2019

Just tried to add public access modifier for property that have [Parameter] attribute. This was not allowed in previous versions of Blazor. Is this something that is now allowed to do?

eg.

[Parameter]
public bool IsDisabled { get; set; }
@Eilon Eilon added the area-blazor Includes: Blazor, Razor Components label May 14, 2019
@montyclt
Copy link

I used [Parameter] in public properties without any problem. There is any reason to keep parameter properties protected?. I only tried it inhering from a class, so my public parameter was on "code-behind" class. I understand that I cannot use private properties in my "code-behind" class because the component class (that extends the "code-behind" class) need to access to the properties.

@mkArtakMSFT
Copy link
Member

We do not enforce parameters to not be public. However we recommend these to not be public, so that the state of components can't be set in unsupported ways.

You should, however received a warning message, and it seems that the Analyzer didn't work as expected here. We're going to look into that as part of this issue.

@mkArtakMSFT mkArtakMSFT changed the title [Blazor] Parameter can be public Public parameters in Components don't result in warnings May 15, 2019
@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. 1 - Ready and removed question labels May 15, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-preview7 milestone May 15, 2019
@mkArtakMSFT
Copy link
Member

This is going to be obsolete when we do #8825

@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Projects
None yet
Development

No branches or pull requests

5 participants