Skip to content

Consider using UTF8 literals for string literals generated from .razor and .cshtml #50788

@tmat

Description

@tmat

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

The source generator currently uses regular string literals for HTML content.

For example,

__builder.AddMarkupContent(4, "<h1>Hello, world!</h1>\n\nWelcome to your new app!\n\n");

String literals are stored in the assembly in #US metadata heap using UTF16 encoding. The heap size is limited and larger apps run out of the space.
See #20224.

Describe the solution you'd like

Using UTF8 literals would address this issue. UTF8 literals are stored directly in the PE image at specified RVA. The metadata heap size limitations thus do not apply.

Besides, it would likely be faster and more memory efficient to render the pages since UTF16 to UTF8 encoding might be avoided.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ui-renderingIncludes: MVC Views/Pages, Razor Views/PagesenhancementThis issue represents an ask for new feature or an enhancement to an existing one

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions