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

Enabled option "Do not use top-level statements" ignored in "Blazor Web App" template for WebAssembly client #52079

Closed
1 task done
LostBeard opened this issue Nov 15, 2023 · 0 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. day-1 Issues that customers are likely to hit on the first day of using the product feature-templates
Milestone

Comments

@LostBeard
Copy link
Contributor

LostBeard commented Nov 15, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Checked option "Do not use top-level statements" ignored in "Blazor Web App" template for WebAssembly client. The server side will be created without top-level statements but the WeAssembly client is created with top-level statements regardless of option selected.

Expected Behavior

I would expect both the client and server projects to not use top-level statements. When that option is checked.

Steps To Reproduce

Create a new "Blazor Web App" project and select "Do not use top-level statements" then click create. The server project will not use top-level statements but the client project will unexpectedly use top-level statements.

Exceptions (if any)

No response

.NET Version

8.0.100

Anything else?

I am not positive that this is the repo to report this particular issue. I could not find this issue reported anywhere, but I may be missing it.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 15, 2023
@MackinnonBuck MackinnonBuck added bug This issue describes a behavior which is not expected - a bug. feature-templates labels Nov 15, 2023
@MackinnonBuck MackinnonBuck added this to the 8.0.x milestone Nov 15, 2023
@MackinnonBuck MackinnonBuck added the day-1 Issues that customers are likely to hit on the first day of using the product label Nov 15, 2023
mkArtakMSFT pushed a commit that referenced this issue Nov 28, 2023
# Use consistent code style in Blazor project templates

- Removed usage of top-level statements in client project if "Do not use top-level statements" is selected
- Removed extra "@" in `@render-mode` values
- Always use `typeof(Namespace._Imports).Assembly` instead of `typeof(Counter).Assembly` so the compilation does not break when the sample Counter component is removed, and so the code is more consistent with how it is when no sample content is generated
- Added Account/AccessDenied endpoint to individual auth option to match Identity UI razor pages. This is shown when the user is authenticated but unauthorized by default.

Fixes #52079
Fixes #52084
Fixes #52167

## Customer Impact

In addition to not using top-level statements when the customer requests that we don't, this improves code style consistency within the Blazor project template and with the Blazor docs.

## Regression?

- [ ] Yes
- [x] No

## Risk

- [ ] High
- [ ] Medium
- [x] Low

These are small stylistic changes to the Blazor project templates.

## Verification

- [x] Manual (required)
- [ ] Automated

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [x] N/A
@mkArtakMSFT mkArtakMSFT modified the milestones: 8.0.x, 8.0.1 Nov 28, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 7, 2024
halter73 added a commit that referenced this issue Feb 14, 2024
# Use consistent code style in Blazor project templates

- Removed usage of top-level statements in client project if "Do not use top-level statements" is selected
- Removed extra "@" in `@render-mode` values
- Always use `typeof(Namespace._Imports).Assembly` instead of `typeof(Counter).Assembly` so the compilation does not break when the sample Counter component is removed, and so the code is more consistent with how it is when no sample content is generated
- Added Account/AccessDenied endpoint to individual auth option to match Identity UI razor pages. This is shown when the user is authenticated but unauthorized by default.

Fixes #52079
Fixes #52084
Fixes #52167

## Customer Impact

In addition to not using top-level statements when the customer requests that we don't, this improves code style consistency within the Blazor project template and with the Blazor docs.

## Regression?

- [ ] Yes
- [x] No

## Risk

- [ ] High
- [ ] Medium
- [x] Low

These are small stylistic changes to the Blazor project templates.

## Verification

- [x] Manual (required)
- [ ] Automated

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [x] N/A
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. day-1 Issues that customers are likely to hit on the first day of using the product feature-templates
Projects
Status: Done
Development

No branches or pull requests

4 participants