From eaa8d6cc92c1d54961188e09076c33e96f4449a7 Mon Sep 17 00:00:00 2001
From: vexx32 <32407840+vexx32@users.noreply.github.com>
Date: Sat, 24 Aug 2019 01:38:16 -0400
Subject: [PATCH 1/8] :recycle: Use single Ping() object for all Send() Rather
than instantiate a new Ping() every time, we can store it in a readonly field
and just call Send() as needed.
---
.../commands/management/TestConnectionCommand.cs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
index c8c5ccfa153..c39c9583498 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
@@ -330,7 +330,6 @@ private void ProcessTraceroute(string targetNameOrAddress)
TraceRouteResult traceRouteResult = new TraceRouteResult(Source, targetAddress, resolvedTargetName);
int currentHop = 1;
- Ping sender = new Ping();
PingOptions pingOptions = new PingOptions(currentHop, DontFragment.IsPresent);
PingReply reply = null;
int timeout = TimeoutSeconds * 1000;
@@ -348,7 +347,7 @@ private void ProcessTraceroute(string targetNameOrAddress)
{
try
{
- reply = sender.Send(targetAddress, timeout, buffer, pingOptions);
+ reply = _sender.Send(targetAddress, timeout, buffer, pingOptions);
traceRouteReply.PingReplies.Add(reply);
}
@@ -552,7 +551,6 @@ private void ProcessMTUSize(string targetNameOrAddress)
try
{
- Ping sender = new Ping();
PingOptions pingOptions = new PingOptions(MaxHops, true);
int retry = 1;
@@ -568,7 +566,7 @@ private void ProcessMTUSize(string targetNameOrAddress)
CurrentMTUSize,
HighMTUSize));
- reply = sender.Send(targetAddress, timeout, buffer, pingOptions);
+ reply = _sender.Send(targetAddress, timeout, buffer, pingOptions);
// Cautious! Algorithm is sensitive to changing boundary values.
if (reply.Status == IPStatus.PacketTooBig)
@@ -698,7 +696,6 @@ private void ProcessPing(string targetNameOrAddress)
bool quietResult = true;
byte[] buffer = GetSendBuffer(BufferSize);
- Ping sender = new Ping();
PingReply reply;
PingOptions pingOptions = new PingOptions(MaxHops, DontFragment.IsPresent);
PingReport pingReport = new PingReport(Source, resolvedTargetName);
@@ -709,7 +706,7 @@ private void ProcessPing(string targetNameOrAddress)
{
try
{
- reply = sender.Send(targetAddress, timeout, buffer, pingOptions);
+ reply = _sender.Send(targetAddress, timeout, buffer, pingOptions);
}
catch (PingException ex)
{
@@ -960,6 +957,8 @@ private byte[] GetSendBuffer(int bufferSize)
private const int DefaultSendBufferSize = 32;
private static byte[] s_DefaultSendBuffer = null;
+ private readonly Ping _sender = new Ping();
+
// Random value for WriteProgress Activity Id.
private static readonly int s_ProgressId = 174593053;
From b237fe5fab197a9eea9c167abd7b8c174f495e9a Mon Sep 17 00:00:00 2001
From: vexx32 <32407840+vexx32@users.noreply.github.com>
Date: Sat, 24 Aug 2019 01:38:47 -0400
Subject: [PATCH 2/8] :sparkles: Add IDisposable implementation
---
.../management/TestConnectionCommand.cs | 40 ++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
index c39c9583498..25126e4af72 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
@@ -23,7 +23,7 @@ namespace Microsoft.PowerShell.Commands
[OutputType(typeof(bool), ParameterSetName = new string[] { DefaultPingParameterSet, RepeatPingParameterSet, TcpPortParameterSet })]
[OutputType(typeof(int), ParameterSetName = new string[] { MtuSizeDetectParameterSet })]
[OutputType(typeof(TraceRouteReply), ParameterSetName = new string[] { TraceRouteParameterSet })]
- public class TestConnectionCommand : PSCmdlet
+ public class TestConnectionCommand : PSCmdlet, IDisposable
{
private const string DefaultPingParameterSet = "DefaultPing";
private const string RepeatPingParameterSet = "RepeatPing";
@@ -948,6 +948,34 @@ private byte[] GetSendBuffer(int bufferSize)
return sendBuffer;
}
+ ///
+ /// IDisposable implementation, dispose of any disposable resources created by the cmdlet.
+ ///
+ public void Dispose()
+ {
+ Dispose(disposing: true);
+ GC.SuppressFinalize(this);
+ }
+
+ ///
+ /// Implementation of IDisposable for both manual Dispose() and finalizer-called disposal of resources.
+ ///
+ ///
+ /// Specified as true when Dispose() was called, false if this is called from the finalizer.
+ ///
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!this.disposed)
+ {
+ if (disposing)
+ {
+ _sender.Dispose();
+ }
+
+ disposed = true;
+ }
+ }
+
// Count of pings sent per each trace route hop.
// Default = 3 (from Windows).
// If we change 'DefaultTraceRoutePingCount' we should change 'ConsoleTraceRouteReply' resource string.
@@ -957,6 +985,8 @@ private byte[] GetSendBuffer(int bufferSize)
private const int DefaultSendBufferSize = 32;
private static byte[] s_DefaultSendBuffer = null;
+ private bool disposed = false;
+
private readonly Ping _sender = new Ping();
// Random value for WriteProgress Activity Id.
@@ -966,5 +996,13 @@ private byte[] GetSendBuffer(int bufferSize)
private const string ProgressRecordSpace = " ";
private const string TestConnectionExceptionId = "TestConnectionException";
+
+ ///
+ /// Finalizer for IDisposable class.
+ ///
+ ~TestConnectionCommand()
+ {
+ Dispose(disposing: false);
+ }
}
}
From 47267b22ccab2602ba510150e4b727dcf7ffa981 Mon Sep 17 00:00:00 2001
From: vexx32 <32407840+vexx32@users.noreply.github.com>
Date: Sat, 24 Aug 2019 12:29:31 -0400
Subject: [PATCH 3/8] :wrench: Move information stream output to verbose
---
.../commands/management/TestConnectionCommand.cs | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
index 25126e4af72..f166cf6b992 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
@@ -410,14 +410,13 @@ private void WriteConsoleTraceRouteHeader(string resolvedTargetName, string targ
targetAddress,
MaxHops);
- WriteInformation(_testConnectionProgressBarActivity, s_PSHostTag);
+ WriteVerbose(_testConnectionProgressBarActivity);
ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace);
WriteProgress(record);
}
private string _testConnectionProgressBarActivity;
- private static string[] s_PSHostTag = new string[] { "PSHOST" };
private void WriteTraceRouteProgress(TraceRouteReply traceRouteReply)
{
@@ -447,7 +446,7 @@ private void WriteTraceRouteProgress(TraceRouteReply traceRouteReply)
msg = StringUtil.Format(TestConnectionResources.TraceRouteTimeOut, traceRouteReply.Hop);
}
- WriteInformation(msg, s_PSHostTag);
+ WriteVerbose(msg);
ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg);
WriteProgress(record);
@@ -455,7 +454,7 @@ private void WriteTraceRouteProgress(TraceRouteReply traceRouteReply)
private void WriteTraceRouteFooter()
{
- WriteInformation(TestConnectionResources.TraceRouteComplete, s_PSHostTag);
+ WriteVerbose(TestConnectionResources.TraceRouteComplete);
var record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace)
{
@@ -772,7 +771,7 @@ private void WritePingHeader(string resolvedTargetName, string targetAddress)
targetAddress,
BufferSize);
- WriteInformation(_testConnectionProgressBarActivity, s_PSHostTag);
+ WriteVerbose(_testConnectionProgressBarActivity);
ProgressRecord record = new ProgressRecord(
s_ProgressId,
@@ -798,7 +797,7 @@ private void WritePingProgress(PingReply reply)
reply.Options?.Ttl);
}
- WriteInformation(msg, s_PSHostTag);
+ WriteVerbose(msg);
ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg);
WriteProgress(record);
@@ -806,7 +805,7 @@ private void WritePingProgress(PingReply reply)
private void WritePingFooter()
{
- WriteInformation(TestConnectionResources.PingComplete, s_PSHostTag);
+ WriteVerbose(TestConnectionResources.PingComplete);
var record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace)
{
From 19c65b83b8a4a17afb83e6024114bf0869c709a3 Mon Sep 17 00:00:00 2001
From: vexx32 <32407840+vexx32@users.noreply.github.com>
Date: Sat, 24 Aug 2019 13:36:10 -0400
Subject: [PATCH 4/8] :recycle: Rename method a little more simply
---
.../commands/management/TestConnectionCommand.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
index f166cf6b992..3df12975c8d 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
@@ -325,7 +325,7 @@ private void ProcessTraceroute(string targetNameOrAddress)
return;
}
- WriteConsoleTraceRouteHeader(resolvedTargetName, targetAddress.ToString());
+ WriteTraceRouteHeader(resolvedTargetName, targetAddress.ToString());
TraceRouteResult traceRouteResult = new TraceRouteResult(Source, targetAddress, resolvedTargetName);
@@ -402,7 +402,7 @@ private void ProcessTraceroute(string targetNameOrAddress)
}
}
- private void WriteConsoleTraceRouteHeader(string resolvedTargetName, string targetAddress)
+ private void WriteTraceRouteHeader(string resolvedTargetName, string targetAddress)
{
_testConnectionProgressBarActivity = StringUtil.Format(
TestConnectionResources.TraceRouteStart,
From 8badc837d2684f18813307b237814b5a5bc5ddca Mon Sep 17 00:00:00 2001
From: vexx32 <32407840+vexx32@users.noreply.github.com>
Date: Tue, 3 Sep 2019 16:26:31 -0400
Subject: [PATCH 5/8] :memo: Update doc tag per CodeFactor
---
.../commands/management/TestConnectionCommand.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
index 3df12975c8d..80de881e47a 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
@@ -997,7 +997,7 @@ protected virtual void Dispose(bool disposing)
private const string TestConnectionExceptionId = "TestConnectionException";
///
- /// Finalizer for IDisposable class.
+ /// Finalizes an instance of the class.
///
~TestConnectionCommand()
{
From ad91875fcad975364a2d138284d08d61fee0d117 Mon Sep 17 00:00:00 2001
From: Joel <32407840+vexx32@users.noreply.github.com>
Date: Thu, 5 Sep 2019 12:44:58 -0400
Subject: [PATCH 6/8] :burn: Remove verbose/information/progress code :burn:
Remove unused resource strings
---
.../management/TestConnectionCommand.cs | 220 +-----------------
.../resources/TestConnectionResources.resx | 36 ---
2 files changed, 6 insertions(+), 250 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
index 80de881e47a..b748f82def9 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
@@ -241,8 +241,6 @@ private void ProcessConnectionByTCPPort(string targetNameOrAddress)
return;
}
- WriteConnectionTestHeader(resolvedTargetName, targetAddress.ToString());
-
TcpClient client = new TcpClient();
try
@@ -252,8 +250,6 @@ private void ProcessConnectionByTCPPort(string targetNameOrAddress)
for (var i = 1; i <= TimeoutSeconds; i++)
{
- WriteConnectionTestProgress(targetNameOrAddress, targetString, i);
-
Task timeoutTask = Task.Delay(millisecondsDelay: 1000);
Task.WhenAny(connectionTask, timeoutTask).Result.Wait();
@@ -278,39 +274,10 @@ private void ProcessConnectionByTCPPort(string targetNameOrAddress)
finally
{
client.Close();
- WriteConnectionTestFooter();
}
WriteObject(false);
}
-
- private void WriteConnectionTestHeader(string resolvedTargetName, string targetAddress)
- {
- _testConnectionProgressBarActivity = StringUtil.Format(TestConnectionResources.ConnectionTestStart, resolvedTargetName, targetAddress);
- ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace);
- WriteProgress(record);
- }
-
- private void WriteConnectionTestProgress(string targetNameOrAddress, string targetAddress, int timeout)
- {
- var msg = StringUtil.Format(
- TestConnectionResources.ConnectionTestDescription,
- targetNameOrAddress,
- targetAddress,
- timeout);
- ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg);
- WriteProgress(record);
- }
-
- private void WriteConnectionTestFooter()
- {
- var record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace)
- {
- RecordType = ProgressRecordType.Completed
- };
- WriteProgress(record);
- }
-
#endregion ConnectionTest
#region TracerouteTest
@@ -325,8 +292,6 @@ private void ProcessTraceroute(string targetNameOrAddress)
return;
}
- WriteTraceRouteHeader(resolvedTargetName, targetAddress.ToString());
-
TraceRouteResult traceRouteResult = new TraceRouteResult(Source, targetAddress, resolvedTargetName);
int currentHop = 1;
@@ -382,16 +347,11 @@ private void ProcessTraceroute(string targetNameOrAddress)
}
traceRouteReply.ReplyRouterAddress = reply.Address;
-
- WriteTraceRouteProgress(traceRouteReply);
-
traceRouteResult.Replies.Add(traceRouteReply);
} while (reply != null
&& currentHop <= sMaxHops
&& (reply.Status == IPStatus.TtlExpired || reply.Status == IPStatus.TimedOut));
- WriteTraceRouteFooter();
-
if (Quiet.IsPresent)
{
WriteObject(currentHop <= sMaxHops);
@@ -402,67 +362,6 @@ private void ProcessTraceroute(string targetNameOrAddress)
}
}
- private void WriteTraceRouteHeader(string resolvedTargetName, string targetAddress)
- {
- _testConnectionProgressBarActivity = StringUtil.Format(
- TestConnectionResources.TraceRouteStart,
- resolvedTargetName,
- targetAddress,
- MaxHops);
-
- WriteVerbose(_testConnectionProgressBarActivity);
-
- ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace);
- WriteProgress(record);
- }
-
- private string _testConnectionProgressBarActivity;
-
- private void WriteTraceRouteProgress(TraceRouteReply traceRouteReply)
- {
- string msg;
- if (traceRouteReply.PingReplies[2].Status == IPStatus.TtlExpired
- || traceRouteReply.PingReplies[2].Status == IPStatus.Success)
- {
- var routerAddress = traceRouteReply.ReplyRouterAddress.ToString();
- var routerName = traceRouteReply.ReplyRouterName ?? routerAddress;
- var roundtripTime0 = traceRouteReply.PingReplies[0].Status == IPStatus.TimedOut
- ? "*"
- : traceRouteReply.PingReplies[0].RoundtripTime.ToString();
- var roundtripTime1 = traceRouteReply.PingReplies[1].Status == IPStatus.TimedOut
- ? "*"
- : traceRouteReply.PingReplies[1].RoundtripTime.ToString();
- msg = StringUtil.Format(
- TestConnectionResources.TraceRouteReply,
- traceRouteReply.Hop,
- roundtripTime0,
- roundtripTime1,
- traceRouteReply.PingReplies[2].RoundtripTime.ToString(),
- routerName,
- routerAddress);
- }
- else
- {
- msg = StringUtil.Format(TestConnectionResources.TraceRouteTimeOut, traceRouteReply.Hop);
- }
-
- WriteVerbose(msg);
-
- ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg);
- WriteProgress(record);
- }
-
- private void WriteTraceRouteFooter()
- {
- WriteVerbose(TestConnectionResources.TraceRouteComplete);
-
- var record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace)
- {
- RecordType = ProgressRecordType.Completed
- };
- WriteProgress(record);
- }
-
///
/// The class contains an information about a trace route attempt.
///
@@ -540,8 +439,6 @@ private void ProcessMTUSize(string targetNameOrAddress)
return;
}
- WriteMTUSizeHeader(resolvedTargetName, targetAddress.ToString());
-
// Cautious! Algorithm is sensitive to changing boundary values.
int HighMTUSize = 10000;
int CurrentMTUSize = 1473;
@@ -557,8 +454,6 @@ private void ProcessMTUSize(string targetNameOrAddress)
{
byte[] buffer = GetSendBuffer(CurrentMTUSize);
- WriteMTUSizeProgress(CurrentMTUSize, retry);
-
WriteDebug(StringUtil.Format(
"LowMTUSize: {0}, CurrentMTUSize: {1}, HighMTUSize: {2}",
LowMTUSize,
@@ -623,8 +518,6 @@ private void ProcessMTUSize(string targetNameOrAddress)
return;
}
- WriteMTUSizeFooter();
-
if (Quiet.IsPresent)
{
WriteObject(CurrentMTUSize);
@@ -645,35 +538,6 @@ private void ProcessMTUSize(string targetNameOrAddress)
}
}
- private void WriteMTUSizeHeader(string resolvedTargetName, string targetAddress)
- {
- _testConnectionProgressBarActivity = StringUtil.Format(
- TestConnectionResources.MTUSizeDetectStart,
- resolvedTargetName,
- targetAddress,
- BufferSize);
-
- ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace);
- WriteProgress(record);
- }
-
- private void WriteMTUSizeProgress(int currentMTUSize, int retry)
- {
- var msg = StringUtil.Format(TestConnectionResources.MTUSizeDetectDescription, currentMTUSize, retry);
-
- ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg);
- WriteProgress(record);
- }
-
- private void WriteMTUSizeFooter()
- {
- var record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace)
- {
- RecordType = ProgressRecordType.Completed
- };
- WriteProgress(record);
- }
-
#endregion MTUSizeTest
#region PingTest
@@ -687,11 +551,6 @@ private void ProcessPing(string targetNameOrAddress)
return;
}
- if (!Continues.IsPresent)
- {
- WritePingHeader(resolvedTargetName, targetAddress.ToString());
- }
-
bool quietResult = true;
byte[] buffer = GetSendBuffer(BufferSize);
@@ -726,19 +585,14 @@ private void ProcessPing(string targetNameOrAddress)
{
WriteObject(reply);
}
+ else if (Quiet.IsPresent)
+ {
+ // Return 'true' only if all pings have completed successfully.
+ quietResult &= reply.Status == IPStatus.Success;
+ }
else
{
- if (Quiet.IsPresent)
- {
- // Return 'true' only if all pings have completed successfully.
- quietResult &= reply.Status == IPStatus.Success;
- }
- else
- {
- pingReport.Replies.Add(reply);
- }
-
- WritePingProgress(reply);
+ pingReport.Replies.Add(reply);
}
// Delay between ping but not after last ping.
@@ -748,11 +602,6 @@ private void ProcessPing(string targetNameOrAddress)
}
}
- if (!Continues.IsPresent)
- {
- WritePingFooter();
- }
-
if (Quiet.IsPresent)
{
WriteObject(quietResult);
@@ -763,57 +612,6 @@ private void ProcessPing(string targetNameOrAddress)
}
}
- private void WritePingHeader(string resolvedTargetName, string targetAddress)
- {
- _testConnectionProgressBarActivity = StringUtil.Format(
- TestConnectionResources.MTUSizeDetectStart,
- resolvedTargetName,
- targetAddress,
- BufferSize);
-
- WriteVerbose(_testConnectionProgressBarActivity);
-
- ProgressRecord record = new ProgressRecord(
- s_ProgressId,
- _testConnectionProgressBarActivity,
- ProgressRecordSpace);
- WriteProgress(record);
- }
-
- private void WritePingProgress(PingReply reply)
- {
- string msg;
- if (reply.Status != IPStatus.Success)
- {
- msg = TestConnectionResources.PingTimeOut;
- }
- else
- {
- msg = StringUtil.Format(
- TestConnectionResources.PingReply,
- reply.Address.ToString(),
- reply.Buffer.Length,
- reply.RoundtripTime,
- reply.Options?.Ttl);
- }
-
- WriteVerbose(msg);
-
- ProgressRecord record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, msg);
- WriteProgress(record);
- }
-
- private void WritePingFooter()
- {
- WriteVerbose(TestConnectionResources.PingComplete);
-
- var record = new ProgressRecord(s_ProgressId, _testConnectionProgressBarActivity, ProgressRecordSpace)
- {
- RecordType = ProgressRecordType.Completed
- };
- WriteProgress(record);
- }
-
///
/// The class contains an information about the source, the destination and ping results.
///
@@ -988,12 +786,6 @@ protected virtual void Dispose(bool disposing)
private readonly Ping _sender = new Ping();
- // Random value for WriteProgress Activity Id.
- private static readonly int s_ProgressId = 174593053;
-
- // Empty message string for Progress Bar.
- private const string ProgressRecordSpace = " ";
-
private const string TestConnectionExceptionId = "TestConnectionException";
///
diff --git a/src/Microsoft.PowerShell.Commands.Management/resources/TestConnectionResources.resx b/src/Microsoft.PowerShell.Commands.Management/resources/TestConnectionResources.resx
index 794680166cc..08dcf439e28 100644
--- a/src/Microsoft.PowerShell.Commands.Management/resources/TestConnectionResources.resx
+++ b/src/Microsoft.PowerShell.Commands.Management/resources/TestConnectionResources.resx
@@ -117,30 +117,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- Tracing route to {0} [{1}] over a maximum of {2} hops:
-
-
- {0,3} {1} ms {2} ms {3} ms {4} [{5}]
-
-
- {0,3} * ms * ms * ms Request timed out.
-
-
- Trace complete.
-
-
- Trying to connect to {0} [{1}]:
-
-
- Target: {0} [{1}]. Seconds: {2}
-
-
- Pinging {0} [{1}] with {2} bytes of data:
-
-
- MTU size: {0}. Attempt: {1}
-
Testing connection to computer '{0}' failed: {1}
@@ -150,16 +126,4 @@
Target IPv4/IPv6 address absent.
-
- Pinging {0} [{1}] with {2} bytes of data:
-
-
- Request timed out.
-
-
- Reply from {0}: bytes={1} time={2}ms TTL={3}
-
-
- Ping complete.
-
From a188bda8f741248890998f6d7234279de9c6c735 Mon Sep 17 00:00:00 2001
From: Joel <32407840+vexx32@users.noreply.github.com>
Date: Thu, 5 Sep 2019 16:01:11 -0400
Subject: [PATCH 7/8] :art: Address Codacy nit
---
.../commands/management/TestConnectionCommand.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
index b748f82def9..72ed1385e10 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
@@ -782,7 +782,7 @@ protected virtual void Dispose(bool disposing)
private const int DefaultSendBufferSize = 32;
private static byte[] s_DefaultSendBuffer = null;
- private bool disposed = false;
+ private bool disposed;
private readonly Ping _sender = new Ping();
From c7f82f925528f736f595430e7a0d63f7812820c3 Mon Sep 17 00:00:00 2001
From: vexx32 <32407840+vexx32@users.noreply.github.com>
Date: Fri, 6 Sep 2019 00:50:28 -0400
Subject: [PATCH 8/8] :recycle: Rename private variable
---
.../commands/management/TestConnectionCommand.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
index 72ed1385e10..739fbbbfc94 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
@@ -762,14 +762,14 @@ public void Dispose()
///
protected virtual void Dispose(bool disposing)
{
- if (!this.disposed)
+ if (!this._disposed)
{
if (disposing)
{
_sender.Dispose();
}
- disposed = true;
+ _disposed = true;
}
}
@@ -782,7 +782,7 @@ protected virtual void Dispose(bool disposing)
private const int DefaultSendBufferSize = 32;
private static byte[] s_DefaultSendBuffer = null;
- private bool disposed;
+ private bool _disposed;
private readonly Ping _sender = new Ping();