mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Use Dispose() instead of Close() for CORECLR
This commit is contained in:
+6
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
foreach (FileStream fileStream in this.FileStreams)
|
||||
{
|
||||
fileStream.Flush();
|
||||
fileStream.Close();
|
||||
fileStream.Dispose();
|
||||
}
|
||||
}
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
+2
-2
@@ -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 ();
|
||||
|
||||
Reference in New Issue
Block a user