-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Mark or set encoding param in StreamReader ctor to be nullable #108542
Mark or set encoding param in StreamReader ctor to be nullable #108542
Conversation
Note regarding the
|
1 similar comment
Note regarding the
|
Should the
Also; are there any tests that could be modified to verify null encoding works (and acts as UTF8)? |
Yes, as @lilinus mentioned, the constructors that accept |
thanks for the feedback! sure, I'm gong to update now. |
Ok, I also have done refactoring the test of StreamReader's constructor as well. |
1d796f1
to
c74bd44
Compare
@dotnet/area-system-io friends, could you take a look/review here? Also maybe you could suggest or explain why the pipeline of "runtime-dev-innerloop (Build linux-x64 debug Libraries_AllConfigurations)" is running for more than 12 hours and never ends? Or should I just close this PR? |
From my personal experience, it can take some time before a PR gets reviewed/merged. I imagine the team also has a lot of critical work to complete for .NET 9 they need to prioritize. I would have patience, it is gonna get reviewed eventually 😄 |
got it, thanks! |
hi @dotnet/area-system-io team Just to remind, could you please review this PR? It's been about 2 weeks now... |
c74bd44
to
b7a69c9
Compare
Rebase this to main branch to ensure my PR is up to date as of 23rd October. |
b7a69c9
to
28c4b52
Compare
rebase again with the latest main branch. @dotnet/area-system-io team, could you please review this PR? It's been a month without any updates... |
28c4b52
to
305cd6b
Compare
rebase again with main branch as of 4th Nov. |
src/libraries/System.Runtime/tests/System.IO.Tests/StreamReader/StreamReader.StringCtorTests.cs
Show resolved
Hide resolved
305cd6b
to
d928bea
Compare
Adding more unit tests to test when calling ctor that has null Encoding should not throw exception. |
var ctorParamStreamEncodingBoolIntEx = Record.Exception(ctorParamStreamEncodingBoolInt); | ||
Assert.Null(ctorParamStreamEncodingBoolIntEx); | ||
|
||
Action ctorParamStreamEncodingBoolIntBool = () => new StreamReader(new MemoryStream(), null, false, 100, false); |
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.
Can't you just call the ctor? Any exception will fail the test.
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.
Thanks! Done updating the test and call the constructor instead as suggested.
Please review, @danmoseley
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.
Tests look fine, I'll let someone in the area sign off though.
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.
@danmoseley
thanks! 👍
ccfa9b7
to
ba7b7a5
Compare
Rebase again as of 22nd Dec of Could someone from .NET team review this PR? @dotnet/area-system-io , @adamsitnik , @jozkee |
…sAndOpenPath to not require Encoding param anymore like StreamWriter
…sAndOpenPath to not require Encoding param anymore like StreamWriter
…as been set to nullable
… not throw Exception.
…. Also just call the ctor directly as suggested in PR feedback.
ba7b7a5
to
c4ad463
Compare
Rebase again, against @danmoseley Is there anything else I should do to get this PR reviewed and merged? cc @dotnet/area-system-io , @jozkee @adamsitnik |
Hmm... those failed builds of |
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.
LGTM, thank you for your contribution @eriawan and apologies for the delay in reviews!
@@ -187,18 +187,18 @@ public StreamReader(string path, bool detectEncodingFromByteOrderMarks) | |||
{ | |||
} | |||
|
|||
public StreamReader(string path, Encoding encoding) | |||
public StreamReader(string path, Encoding? encoding) |
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 was suprised to see this change, as it was not approved as part of #106236 (comment).
But then I've found @jozkee comment #106658 (review) referring to #2376 (comment) that explains that we need to unify all ctors that accept Encoding
. Which we already did for StreamWriter
in #106658.
So everything is good 👍
Yayyyyy!!! Many thanks for the review, approval and the merge, @adamsitnik ! 👍 |
Fixes #106236