| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Rather than instantiate a new Ping() every time, we can store it in a readonly field and just call Send() as needed.
This uses the SendAsync() method with a manual reset shim, allowing us to cancel the ping if needed. For example, in the case of StopProcessing() being called, the cmdlet can properly process the request and halt processing, throwing the correct errors as needed.
All output is provided as soon as the PingReply is received, using a new class to format the output (PingStatus). Also added a FormatView for PingStatus.
🎨 Update formatview definitions to include traceroutes ♻️ move formatviewdefintions to proper location in file
♻️ Small amount of cleanup
Errors out when trying to SendPingAsync() too quickly in succession
|
Steve Lee (@SteveL-MSFT) Samples of output: Default -Ping Output-Traceroute Output-Traceroute -ResolveDestination Output-MtuSize Output-IPv6 (with IPv4 address)-IPv4 (with IPv6 address) |
Sorry, something went wrong.
|
Steve Lee (@SteveL-MSFT) Ilya (@iSazonov) Travis Plunk (@TravisEz13) I checked https://github.com/dotnet/corefx/issues/28934 recently and saw they pushed it back to 5.0 for now. Can we make a judgement call on the way forward here? This implementation, while doing more work than it should need to, is at least (in my opinion) more usable and functional on every platform than the existing implementation, and makes use of the most effective parts of the API surface currently available. In my opinion, having this in PS7 to have a more user-friendly cmdlet would be better than waiting until .NET 5 for the API to be fixed. 🙂 I'm more than happy to do the later rewrite when the .NET Core team (finally) fix their Ping APIs. 😁 |
Sorry, something went wrong.
|
Rain Sallow (/u/ta11ow) (@vexx32) I don't think we should hold this waiting on .NET (should open a new issue linked to corefx, I can tag it for vNext). I'll spend some time reviewing this today. |
Sorry, something went wrong.
|
Went back through ping / test-connection issues and found this one: I think this PR addresses that as well 🤔 |
Sorry, something went wrong.
|
Steve Lee (@SteveL-MSFT) looks like we've been tracking this in #4240; I think we can continue to track this there. 🙂 |
Sorry, something went wrong.
| .AddHeader(Alignment.Right, label: "Latency(ms)", width: 7) | ||
| .AddHeader(Alignment.Right, label: "BufferSize(B)", width: 10) |
There was a problem hiding this comment.
Since this is formatting, we can make changes in the future based on user feedback
Sorry, something went wrong.
|
PoshChan-Bot (@PoshChan) please retry windows |
Sorry, something went wrong.
|
Rain Sallow (/u/ta11ow) (@vexx32), successfully started retry of PowerShell-CI-Windows |
Sorry, something went wrong.
| /// <summary> | ||
| /// Gets the target address of the ping. | ||
| /// </summary> | ||
| public IPAddress? Address { get => Reply.Status == IPStatus.Success ? Reply.Address : null; } |
There was a problem hiding this comment.
Interesting. Querying the Reply.Address in the latest build I got from CI appears to be... broken.
PS> $a.Reply.Address
OverloadDefinitions
-------------------
System.Object&, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e Address(int )
I'll have to make sure I rebase this PR and see if this is resolved in a later .NET core preview. Querying the address in different ways does work, but something is a bit screwy with the auto-property. Gonna look into this probably this evening, should hopefully not be a complex fix. 🤞
(This is a bit of an oddity because this actually causes it to be hidden in the formatter, which is just super odd.)
Sorry, something went wrong.
There was a problem hiding this comment.
FIgured it out. Pushing a fix.
Sorry, something went wrong.
| @@ -1,8 +1,12 @@ | |||
| // Copyright (c) Microsoft Corporation. All rights reserved. | |||
There was a problem hiding this comment.
Rain Sallow (/u/ta11ow) (@vexx32), your last commit had 1 failures in PowerShell-CI-windows
Test-Connection.Ping.Force IPv4 with explicit PingOptions
Expected $true, but got $false.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\Microsoft.PowerShell.Management\Test-Connection.Tests.ps1: line 103
103: $result1.Reply.Options.DontFragment | Should -BeTrue
Sorry, something went wrong.
There was a problem hiding this comment.
Steve Lee (@SteveL-MSFT) I have confirmed with a manual test that this regression comes from .NET Core itself -- a manual use of the Ping.Send() or SendAsync() exhibits this behaviour where a DontFragment setting is ignored (or at least not returned as set from the ping reply).
This appears to be a new regression since the 3.0 release.
This API is... getting more fragile. 😕
Marking this test as pending until this gets fixed.
Sorry, something went wrong.
There was a problem hiding this comment.
Did someone file an issue?
Sorry, something went wrong.
There was a problem hiding this comment.
I added a note on the existing tracking issue in coreFX for the Ping APIs.
One of the coreFX folx asked if I could set breakpoints and check what's going on. I may give it a stab, but I'm not really sure what I'm doing there tbh. CoreFX is a very large project, and I'm not familiar with how to work with it in a debugging context, or even build it at all.
Sorry, something went wrong.
There was a problem hiding this comment.
Should I create an additional tracking issue here as well? We already have a tracking issue for the APIs used by this cmdlet in general I think I can add a note to.
Sorry, something went wrong.
There was a problem hiding this comment.
I'm good as long as it's tracked somehow.
Sorry, something went wrong.
PingOptions are not returned from .NET Core api as expected. Test marked as pending for now.
|
Should we document anything (the check box is set)? |
Sorry, something went wrong.
|
Yeah, we changed quite a bit in terms of the shape of the output in pretty much all the cases here. Doc issue is MicrosoftDocs/PowerShell-Docs#4987 - I'll link it in the PR description as well. Thanks for the reminder! 💖 |
Sorry, something went wrong.
|
🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada: Handy links: |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
Refactor Test-Connection to provide unit-based output with clearer formatting and more useful traceroute timing information.
PR Context
RFC: PowerShell/PowerShell-RFC#172
Resolves #9235
Resolves #7685
PR Checklist