Conversation
Simplify some variable declarations, fix up some uber long lines, etc.
& some misc cleanup. Implementing IDisposable allows us to put the Ping() instances used everywhere into a single field and dispose it whenever the command is.
Kinda in the name aight?
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
| { Test-Connection $targetName -BufferSize 0 } | Should Not Throw | ||
| { Test-Connection $targetName -BufferSize -1 } | Should -Throw -ErrorId "ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand" | ||
| { Test-Connection $targetName -BufferSize 65501 } | Should -Throw -ErrorId "ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand" | ||
| { Test-Connection $targetName -BufferSize 0 } | Should -Not Throw |
There was a problem hiding this comment.
| { Test-Connection $targetName -BufferSize 0 } | Should -Not Throw | |
| { Test-Connection $targetName -BufferSize 0 } | Should -Not -Throw |
|
Not sure it even makes sense to split style changes to be honest as this changes / rewrites a heck of a lot that I would cover in a style PR anyway. We're still blocked on preview6 so I'm leaving the temp fix in for now so we can trust test results. When we get preview8 it isn't difficult to switch the pattern back. |
|
Have pity!😭 We have open about 50 PRs... |
|
I know. But is one of these better, or four for the same thing? 😕 If you'd really rather extra style PRs I can probably look to trim some of that out, but in a lot of ways the style changes are kind of tied into the rest of the changes. Let me know what you'd prefer! 😊 |
|
@vexx32 You will spend some time for temporary PRs but save a lot of time of reviewers. |
|
Yeah, I guess that makes sense. I'll look to do a style pass and see how I can split it out from there. Thanks! 💖 |
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
Bug with native exceptions was fixed in .NET Core 3-preview7 Should be safe to use synchronous ping.
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs
Show resolved
Hide resolved
|
Closing this as this has been superceded by #10697 |
PR Summary
Refactor the Test-Connection cmdlet according to PowerShell/PowerShell-RFC#172
PR Context
Resolves #6768
NOTE: Currently this changes the pattern from
Ping.Send()toPing.SendAsync()with a manual event handler. This is due to a bug that was only recently resolved (see https://github.com/dotnet/corefx/issues/38770#issuecomment-507788270)We can return to the simpler
Ping.Send()pattern once we hit .NET Core 3-preview8 per the comment in that issue. 🙂TODO:
Additional suggestions:
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.