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] Fix type name hashing when the type has multibyte characters #52232

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

MackinnonBuck
Copy link
Member

Fix type name hashing when the type has multibyte characters

Fixes an issue where an exception gets thrown if a render mode boundary component has a type whose full name contains multibyte characters.

Description

This PR fixes the issue by allocating a constant-sized stack buffer and falling back to a heap-allocated buffer when the type name is too long.

Fixes #50879
Fixes #52109

@MackinnonBuck MackinnonBuck added the area-blazor Includes: Blazor, Razor Components label Nov 20, 2023
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner November 20, 2023 22:49
@MackinnonBuck
Copy link
Member Author

I'll create a backport to release/8.0 for servicing after this gets approved/merged

Copy link
Member

@surayya-MS surayya-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@MackinnonBuck MackinnonBuck merged commit 4336a2f into main Nov 22, 2023
@MackinnonBuck MackinnonBuck deleted the mbuck/fix-component-type-name-hash branch November 22, 2023 23:10
@ghost ghost added this to the 9.0-preview1 milestone Nov 22, 2023
@MackinnonBuck
Copy link
Member Author

/backport to release/8.0

@ghost
Copy link

ghost commented Nov 22, 2023

Hi @MackinnonBuck. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

Copy link
Contributor

Started backporting to release/8.0: https://github.com/dotnet/aspnetcore/actions/runs/6963625517

mkArtakMSFT pushed a commit that referenced this pull request Nov 27, 2023
…yte characters (#52316)

Backport of #52232 to release/8.0

/cc @MackinnonBuck

# [Blazor] Fix type name hashing when the type has multibyte characters

Fixes an issue where an exception gets thrown if a render mode boundary component has a type whose full name contains multibyte characters.

## Description

The bug results in an exception getting thrown if the type of a component with a render mode has a full name containing multibyte characters. It especially affects cases where a component (or the namespace it's defined in) contains non-Latin characters.

This PR fixes the issue by allocating a constant-sized stack buffer and falling back to a heap-allocated buffer when the type name is too long.

Fixes #50879
Fixes #52109

## Customer Impact

Blazor Apps with non-Latin code might not be able to use interactivity. The workaround is to ensure that the full name of any component serving as a render mode boundary does not contain multibyte characters.

## Regression?

- [ ] Yes
- [X] No

Render modes are a new feature in .NET 8, so this bug is not a regression.

## Risk

- [ ] High
- [ ] Medium
- [X] Low

The fix is straightforward and we have new automated tests for this scenario.

## Verification

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

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [X] N/A

---------

Co-authored-by: Mackinnon Buck <[email protected]>
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
Projects
None yet
3 participants