Make dispose in TranscriptionOption idempotent (#13839)

Co-authored-by: Krishna Yalavarthi <kryalava@microsoft.com>
This commit is contained in:
krishnayalavarthi 2020-10-23 11:36:53 -07:00 committed by GitHub
parent d20e1217ad
commit c8feddb214
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1173,8 +1173,20 @@ namespace System.Management.Automation.Host
if (_contentWriter != null)
{
_contentWriter.Flush();
_contentWriter.Dispose();
try
{
_contentWriter.Flush();
_contentWriter.Dispose();
}
catch (ObjectDisposedException)
{
// Do nothing
}
catch (IOException)
{
// Do nothing
}
_contentWriter = null;
}