diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-04-05 14:30:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-05 14:30:28 -0400 |
commit | 8d51f4253996baf64fca1c57c421fb42ac5762cd (patch) | |
tree | bcb567a69b2bc05d9fe432fb4cd6111281605ab3 /tests/CoreFX | |
parent | aea3b1a80d6c114e3e67bc9521bf39a8a17371d1 (diff) | |
download | coreclr-8d51f4253996baf64fca1c57c421fb42ac5762cd.tar.gz coreclr-8d51f4253996baf64fca1c57c421fb42ac5762cd.tar.bz2 coreclr-8d51f4253996baf64fca1c57c421fb42ac5762cd.zip |
Don't null out references in Stream/BinaryReader/Writer (#23725)
These types null out some fields on Dispose, and some of those fields are accessible directly via exposed properties, which means that nulling them out would either force us to annotate those properties as being nullable or would require us to lie about them being nullable. Nulling them out also makes it easier to accidentally null ref in the implementation, and prevents us from making the fields readonly.
It should be exceedingly rare that you dispose of one of these objects and then keep it alive while also being concerned about keeping alive the other helper objects the type uses. So this change just uses a separate flag to track disposal, and avoids nulling out the fields, which is not a common practice elsewhere in the framework.
This will be a visible change in that after Dispose, properties like StreamWriter.BaseStream/Encoding will now return the stream/encoding rather than null. In theory that could break someone if they were using those properties to determine whether the writer had been disposed, but that seems unlikely / similar fallout from most any bug fix, and objects generally aren't supposed to be touched after Dispose, anyway.
Diffstat (limited to 'tests/CoreFX')
-rw-r--r-- | tests/CoreFX/CoreFX.issues.json | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/CoreFX/CoreFX.issues.json b/tests/CoreFX/CoreFX.issues.json index 8f4da8a9d1..5c25aa79c0 100644 --- a/tests/CoreFX/CoreFX.issues.json +++ b/tests/CoreFX/CoreFX.issues.json @@ -740,6 +740,32 @@ } }, { + "name": "System.IO.Tests", + "enabled": true, + "exclusions": { + "namespaces": null, + "classes": null, + "methods": [ + { + "name": "System.IO.Tests.CloseTests.AfterDisposeThrows", + "reason": "Readers/writers changed to not null out base stream on dispose" + }, + { + "name": "System.IO.Tests.CloseTests.AfterCloseThrows", + "reason": "Readers/writers changed to not null out base stream on dispose" + }, + { + "name": "System.IO.Tests.StreamWriterWithBufferedStream_CloseTests.AfterDisposeThrows", + "reason": "Readers/writers changed to not null out base stream on dispose" + }, + { + "name": "System.IO.Tests.StreamWriterWithBufferedStream_CloseTests.AfterCloseThrows", + "reason": "Readers/writers changed to not null out base stream on dispose" + } + ] + } + }, + { "name": "System.IO.FileSystem.Tests", "enabled": true, "exclusions": { |