From 716b9e403689bcd983ab39f521a773a0fa281d4b Mon Sep 17 00:00:00 2001 From: David Hall Date: Sat, 28 Jan 2023 20:19:00 -0700 Subject: [PATCH] Hopeful fix for #373 --- Core/InteropServices/ComStream.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Core/InteropServices/ComStream.cs b/Core/InteropServices/ComStream.cs index b6f28361..8be24b76 100644 --- a/Core/InteropServices/ComStream.cs +++ b/Core/InteropServices/ComStream.cs @@ -131,15 +131,8 @@ namespace Vanara.InteropServices /// This method is not a member in IStream. public override void Close() { - if (netStream is not null) - { - netStream.Close(); - } - else - { - comStream.Commit(0 /*STGC_DEFAULT*/); - // Marshal.ReleaseComObject(TheIStream); // Investigate this because we cannot release an IStream to the stash file - } + netStream?.Close(); + try { comStream?.Commit(0 /*STGC_DEFAULT*/); } catch { } GC.SuppressFinalize(this); }