-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
.NET 8 Blazor - Memory Corruption #102046
Comments
@lewing FYI |
Tagging subscribers to this area: @steveisok, @lambdageek |
@kg can you please investigate? |
Reduced repro: <span>Scroll down to item 1000 to view memory corruption</span>
@for (int j = 0; j < 2000; j++)
{
<div>@(j < 1500 ? "test" : "N/A")</div>
<div>@(j < 1501 ? j : "N/A")</div>
} Produces:
What appears to be happening is that the buffer blazor uses to send strings and other data to the DOM is either getting corrupted or it's being read from using the wrong type. Have to dig in deeper to figure out why. |
cc @BrzVlad this appears to be related to interpreter tiering; it breaks as soon as the loop ( EDIT: I should note it seems like this may be fixed in 9. |
@kg so you were able to reproduce in net8.0 but not net9.0? |
I haven't reproduced it locally, but Mackinnon tested it on both and couldn't repro in 9. |
Is there an existing issue for this?
Describe the bug
Ran into what looks like memory corruption in my blazor project. This only seems to happen in web assembly and in the release configuration in visual studio. It also doesn't seem to occur in .NET 7. Code used to cause this error is pictured below:
The top line in each iteration is showing the expected behaviour of the code. The bug occurs only when: rendering large quantities of data, using the ternary operator and when we are not explicitly converting 'j' to a string
Example of the error occuring:
![image](https://private-user-images.githubusercontent.com/120647555/329309365-0ff7cd9d-567f-44b8-ab64-49087a5cea3a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzM4NTAsIm5iZiI6MTczOTQzMzU1MCwicGF0aCI6Ii8xMjA2NDc1NTUvMzI5MzA5MzY1LTBmZjdjZDlkLTU2N2YtNDRiOC1hYjY0LTQ5MDg3YTVjZWEzYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QwNzU5MTBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04MjhlM2JjODVhY2I4MjI1NTdlMjBhMWNlNjg3YzYxZTJmMjlkNzljOGVkODgzOWY5YzBjMmNhZWNkNTA3OWFiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.fD5hRzG80eJcoObPdECFTlwazvdLvmf0CVI53YVG8u4)
Expected Behavior
All values would be rendered for each iteration of the for loop without showing corrupted text.
Steps To Reproduce
Create standard Blazor WebAssembly App. and change configuration to release. Next put erroneous block of code onto page.
Then build and run, scrolling down the page to encounter the memory corruption.
Exceptions (if any)
No response
.NET Version
8.0.0
Anything else?
Sample Project Repository: https://github.com/TomElcome/BlazorWasmMemoryCorruption
REPL: https://blazorrepl.telerik.com/myOTEtbf19p2whkm36
The text was updated successfully, but these errors were encountered: