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

[Blazor] .NET 9 generated JS uses high version syntax leading to compatibility issues #59090

Open
1 task done
capdiem opened this issue Nov 21, 2024 · 2 comments
Open
1 task done
Assignees
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Milestone

Comments

@capdiem
Copy link

capdiem commented Nov 21, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The blazor.*.js files generated by .NET 9 utilize the static initialization block feature introduced in ES13. This usage causes compatibility issues on lower-end devices and older browsers.
You can find instances of this issue by searching for static{ in the generated files.

static{this.nextEventDelegatorId=0}

related issue: dotnet/maui#24278 dotnet/maui#25862

Expected Behavior

Regenerate using ES6 as the target, just like before.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

net9.0

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 21, 2024
@javiercn javiercn modified the milestones: 9.0.x, .NET 10 Planning Nov 21, 2024
@javiercn javiercn added this to the Backlog milestone Nov 21, 2024
@danroth27
Copy link
Member

Our official support policy is that we only support the latest browser versions. Since most users automatically update their browser, we find this isn't generally an issue. When setting up test devices, we recommend similarly updating the browser/webview to emulate this common user behavior.

@danroth27 danroth27 added the ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. label Nov 21, 2024
@capdiem
Copy link
Author

capdiem commented Nov 22, 2024

@danroth27 While it's true that most users automatically update their browsers, not all users are accustomed to doing so. Setting the tsconfig target to a version as high as ES2022 can lead to compatibility issues, especially considering that .NET 8 targets ES2019.

For a framework with such a large user base, backward compatibility is crucial. Many popular JavaScript libraries set their minimum support to ES2015, and I believe that for Blazor, targeting ES2019 would be a more reasonable approach. This change would help prevent any breaking updates when upgrading to .NET 9.

Thank you for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants