Usage Guides recommend disposing stream exactly once
arman-microsoft opened this issue · 1 comments
arman-microsoft commented
Usage guide currently states that each stream should be disposed exactly once.
In one of the other issues, it seems the RecyclableMemoryStream supports multiple disposal.
What is the current state/recommendation? Isn't multiple disposal now an no-op?
benmwatson commented
The guidance is still that you should dispose only once because doing it multiple times, especially with a reusable resource that has the potential for corruption is almost certainly a bug. RMS can safely handle a double dispose without crashing, but it contains a number of features to help you debug because it can't guarantee the integrity of data if you are not following correct patterns.