-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix test containing reflection erroring from #117168 (Add methods from #27912 (Flow System.Text.Rune through more APIs)) #120145
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
Conversation
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.
Pull Request Overview
This PR fixes test failures in the CreateBroadcasting_AllMethodsOverridden
test by adding missing Rune
parameter overrides to the NullTextWriter
class. The test uses reflection to verify that all methods from the base TextWriter
class are properly overridden, and was failing because new Rune
-based methods introduced in PR #117168 were not implemented in NullTextWriter
.
- Adds four missing
Rune
parameter method overrides toNullTextWriter
- Ensures all new
Rune
-based methods from the base class have corresponding implementations
006dfc5
to
0e35fd6
Compare
I added overrides to |
It is still failing with these fixes. |
My apologies, I added the overrides to Edit: The tests will not display as successful because you reverted the original changes. |
Could you please force push revert of the revert into this PR? This PR should have two commits: revert of the revert, fixes. |
… more APIs) (dotnet#1…" (dotnet#120138) This reverts commit be80737.
Tagging subscribers to this area: @dotnet/area-system-runtime |
I am seeing more tests are subclassing TextWriting, https://github.com/dotnet/runtime/blob/main/src/libraries/Common/tests/System/Xml/ModuleCore/cltmconsole.cs is example but there are more there. I am not sure if these tests will fail though. I'll try to look at these tests and update them if needed. |
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
The only one that is actually tested to my knowledge is |
I am seeing runtime/src/libraries/System.IO/src/System/CodeDom/Compiler/IndentedTextWriter.cs Line 12 in 082bc29
@dotnet/area-system-codedom We are adding support to write |
Adding an override to IndentedTextWriter would "just" be about performance, correct? Whether or not we add an override, the functional results will be the same, but adding the override would make it more efficient when used, yes? |
IndentedTextWriter is indenting before writing, here is example of writing public override void Write(char value)
{
OutputTabs();
_writer.Write(value);
} So, it is functionality correctness too. |
If that's true, that means the new virtual method we added is buggy. We have to expect that the new method will be used with derived writers that won't yet have overridden it, and it should behave identically to if someone used whatever equivalent APIs would have been used before Rune was available. That said, without diving deeper, I don't see why it'd be a functional issue. OutputTabs doesn't add tabs on each call, only if it's the beginning of a new line. |
What do you mean? I don't think the TextWriter new write Rune virtual methods are buggy. |
What happens if writing Rune in the beginning of the new line? |
The same thing that happens when writing a char in the beginning of the new line, no? |
You are right, writing Rune will invoke the |
It'd still be good to add the overload/override, but the CodeDom projects builds downlevel as well, so the overload will be ifdef'd, and that's fine because it doesn't change functionality, only performance. |
@stephentoub one more question, running runtime/src/libraries/System.Runtime/tests/System.IO.Tests/MemoryStream/MemoryStreamTests.cs Line 163 in f610923
ArgumentOutOfRangeException while it throws OOM exception. I think Capacity property in MemryStream is missing the check:
if (value > MemStreamMaxLength)
{
throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_StreamLength);
} should I add this to this PR? or submit it in a different PR |
|
We don't need to ifdef anything here because on the type is defined in the assemblies: netstandard.dll, System.Runtime.dll. So, changing this type will be only observed in 10. Thanks to @ericstj helping to clarify that. I'll go ahead and push the changes to the |
Fixes alleged test errors from #117168 for the
CreateBroadcasting_AllMethodsOverridden
test, which uses reflection to check that the new overloads are overridden inNullTextWriter
.