-
Notifications
You must be signed in to change notification settings - Fork 196
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
Fix project info reading #10623
Fix project info reading #10623
Conversation
private static ValueTask ReadExactlyAsync(Stream stream, byte[] buffer, int length, CancellationToken cancellationToken) | ||
=> stream.ReadExactlyAsync(buffer, 0, length, cancellationToken); | ||
#else | ||
private static async ValueTask ReadExactlyAsync(Stream stream, byte[] buffer, int length, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do a follow up cleanup to move these to net only instead of having a bunch of ifdefs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, none of these methods need to actually run on netstandard2.0 or NetFx. You could #ifdef the whole file for NET or change the file name to StreamExtensions.NetCore.cs
so that they only compile for NET. Then, you can get rid of the non-NET branches. That will open up lots of Span-based APIs on Stream and other types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea that's the plan, move the whole file over.
src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/StreamExtensionTests.cs
Outdated
Show resolved
Hide resolved
…st/StreamExtensionTests.cs
When reading RazorProjectInfo from a stream the array being used was a pooled array. The code was not correctly trimming that array for the deserializer which meant that unknown bytes were being attempted to be read and were likely wrong. This fixes the code to make sure and trim before deserializing and adds tests.
Fixes AB#2137098