Use Dispose() instead of Close() for CORECLR

This commit is contained in:
Andrew Schwartzmeyer
2016-06-03 13:35:56 -07:00
parent 52621adba8
commit f1741c04f5
3 changed files with 9 additions and 3 deletions
@@ -68,6 +68,9 @@ namespace Microsoft.PowerShell.Commands
[SecurityPermission(SecurityAction.LinkDemand)]
protected override void Dispose(bool disposing)
{
#if CORECLR
base.Dispose(disposing);
#else
try
{
if (disposing)
@@ -79,8 +82,10 @@ namespace Microsoft.PowerShell.Commands
{
base.Dispose(disposing);
}
#endif
}
#if !CORECLR
/// <summary>
/// Closes the dialog and then calls the base class Close
/// </summary>
@@ -91,6 +96,7 @@ namespace Microsoft.PowerShell.Commands
base.Close();
}
#endif
#endregion TraceListener constructors and disposer
@@ -333,7 +333,7 @@ namespace Microsoft.PowerShell.Commands
foreach (FileStream fileStream in this.FileStreams)
{
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}
GC.SuppressFinalize(this);
@@ -460,7 +460,7 @@ namespace Microsoft.PowerShell.Commands
true))
{
listenerToRemove.Flush();
listenerToRemove.Close();
listenerToRemove.Dispose();
source.Listeners.RemoveAt(index);
}
}
@@ -619,7 +619,7 @@ namespace Microsoft.PowerShell.Commands
foreach (TraceListener listener in pair.Value)
{
listener.Flush();
listener.Close();
listener.Dispose();
}
}
storedTraceSourceState.Clear ();