-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve PSMethod-to-Delegate conversion #6570
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
One thing I'm curious about is the MethodGroup
tuple type. I've seen similar code in MutableTuple and wonder (1) why we use this and (2) if we document that anywhere. Anyway, that's orthogonal to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup!
LGTM
Looks like an unrelated network test failure:
I've restarted it. |
Thanks @rjmholt and @powercode for your reviews! |
* Revert "Pull PSReadLine from PSGallery" (PowerShell#5986) This reverts commit beffdcf. * update 6.0.1 change log (PowerShell#5937) * Remove Fedora 25, Add Fedora 27 (PowerShell#5984) Fedora 25 was EOL on December 12, 2017 https://fedoramagazine.org/fedora-25-end-life/ Signed-off-by: Eli Uriegas eli.uriegas@docker.com * tests: fix function to test for docker OS due to change to use linuxkit for mac (PowerShell#5843) * Also, fix syntax issues to allow to work with released Pester * Start using Travis-CI cache (PowerShell#6003) * Fix a NullReference exception in Enter-PSHostProcess (PowerShell#5995) * Return better error for 'pwsh -WindowStyle' on unsupported platforms. (PowerShell#5975) * Change Microsoft.PowerShell.Commands.SetDateCommand.SystemTime to struct. (PowerShell#6006) Change Microsoft.PowerShell.Commands.SetDateCommand.SystemTime class to struct and resolve the error in Set-Date cmdlet - SetLocalTime function is causing a parameter error (error code 0x00000057). * Add Simplified multipart/form-data Support to Web Cmdlets Through -Form Parameter (PowerShell#5972) - Adds -Form Parameter to Invoke-WebRequest and Invoke-RestMethod. - Form Accepts any IDictionary. - Keys are used as multipart/form-data field names (PSObject unwrapped and ConvertTo<String>(Object)). - FileInfo values are added as StreamContent with application/octet-stream content type and the FileInfo.Name as the file name. - Strings are treated as StringContent. - Singe values are converted to string with ConvertTo<String>(Object) and treated as StringContent - Top level collections are enumerated and converted as above. Nested collections are treated as a single value and converted accordingly. - Form is mutually exclusive with -Body and -InFile. - Per PowerShell-Committee decision, -Form makes no assumptions about the HTTP method used. It can theoretically be used with any method. User will need to manually supply -Method POST to post the form. - ContentType and content related headers supplied to -Headers will be ignored/cleared as MultipartFormDataContent requires control of these headers. * Add '-settingsfile' to 'pwsh' to support loading a custom powershell config file. (PowerShell#5920) Support loading a custom `powershell.config.json` file via the command-line for use in testing. This change supports replacing the default `powershell.config.json` file that's usually loaded from the `PSHome` directory with a custom version file. The primary use-cases for this command-line option are as follows: 1. Allow the CI system to disable settings that impact test run times; such as disabling syslog usage on Linux and MacOS 2. Support testing of syslog and os_log without interfering with normal PowerShell operations during test runs via launching an instance with custom log settings. * Fix .gitignore (PowerShell#5991) Use single '*' in file name /src/TypeCatalogGen/powershell*.inc * update date on change log (PowerShell#6023) * Skip tests that use ExecutionPolicy cmdlets on Unix (PowerShell#6021) * CI Build: Use TRAVIS_PULL_REQUEST_SHA to accurately get the commit message (PowerShell#6024) * Rework Windows Start menu folder name (PowerShell#5891) Changes the Windows start menu folder name from ProductSemanticVersionWithName to ProductSemanticVersionWithNameAndOptionalArchitecture - now the start menu is `PowerShell` for all versions. * update processes to allow for coordinated vulnerability disclosure (PowerShell#6042) * Resort parameter list in alphabetical order (PowerShell#6052) After PowerShell#5920 we should reorder parameter list (PowerShell#4989) * new `Issue-Announcement` label (PowerShell#6041) * Adds script to patch the shortcut working directory to the user's home folder. (PowerShell#6043) Update the shortcut created by the installer to use %HOMEDRIVE%%HOMEPATH% for the working directory. * Fix "Pull Request Process" dead link (PowerShell#6066) Fix "Pull Request Process" anchor links in governance.md * Add Environment Variable override of telemetry (PowerShell#6063) Inspired by dotnet cli, and allows for Telemetry opt-out on packaging systems such as AppImage and Snapcraft where the filesystem is immutable. * add comments about where most of the packages are from (PowerShell#6016) * Test: Add Verbosity and more accurate timeout implementation for Start-WebListener (PowerShell#6013) - Add verbosity to the WebListener when it fails to assist in troubleshooting - Switch the WebListener initialization timeout to count cycles instead of using fixed dates to work around possible VM CI sleep/ issues. * Build: Update PowerShell to build with .NET Core SDK 2.1.4 (PowerShell#6054) * Change Web Cmdlet Tests to Use 127.0.0.1 not Localhost (PowerShell#6069) Change Web Cmdlets Tests to Use 127.0.0.1 instead of localhost due to dotnet/corefx#24104 This provides a decent speed boost to the WebCmdlet tests (Faster in dozens of times). * Remove unsupported members from the enum 'Language' in Add-Type (PowerShell#5829) [breaking change] Remove the unsupported members (various versions of CSharp and `JScript`) from the enum 'Language' in Add-Type. After this change, `Add-Type -Language` only supports `CSharp` and `VisualBasic`. * Doc: Fix the command to build type catalog in internals.md (PowerShell#6084) * Fix the filtering of analytic events on Unix platforms. (PowerShell#6086) - Remove previous `UseAlwaysAnalytic` workaround in `SysLogProvider.Log` - Update Script Block logging to always log to the operational channel with `UseAlwaysOperational` - Fix `PSChannel` on Linux to use a bitmask - Handle `UseAlwaysOperational` and `UseAlwaysAnalytic` keywords but adding to `_keywordFilter` if the associated channels were selected in the configuration * [Feature] Remove -TimeOutSec from non timeout related tests (PowerShell#6055) The timeout mechanism should be supported by the test framework (Pester here). * change logo to SVG (PowerShell#6072) Current README uses a PNG which doesn't scale for high dpi displays (starts to look fuzzy). Created 64 pixel wide version of svg of the black logo and inserted into README.md. Note that it currently doesn't render as the absolute URL points to master so that it gets rendered correctly in other places where the README.md is used (like docker hub). * Enable setting PSSession Name when using SSHTransport and added Transport property (PowerShell#5954) When using New-PSSession -SSHTransport -Name ... the Name parameter wasn't being used when creating the remoterunspace so an automatically generated one was always created. Fix is to explicitly pass the transport name when generating a runspace name including other transports like VMBus and Container. Refactor runspace name generation code to produce "RunspaceN" and added a Transport property. Tests will have to wait until we have the infrastructure for remoting tests and Enable-SSHRemoting work is complete. Fix PowerShell#5951 Fix PowerShell#2426 * Add registry value for easy detection (PowerShell#6094) Add registry value for easy detection. For example, the presence of a single key of 6.0.* x64. This is much faster than MSI detection. Note there are currently two GUIDs, one for 6.0.* x64 and one for 6.0.* x86. fixes PowerShell#6090 * Update test framework and tests to support 4x version of Pester (PowerShell#6064) * Test fixes and changes needed to support Pester 4.0.8 * Replace 'Should Contain' with new 'Should FileContentMatch' assertion Explicitly check for string creation with write-output * Use the current version of pester and install it in modulesDir * Simplify logic for relative path test. Multiple '..' is not needed for a relative path, a single one will do. Also, on multi-drive systems using split-path -noqualifier will probably do the wrong thing with regard to constructing a correct path. Remove extraneous Should Not Throw test, if this throws, the test will fail, we don't need to explicitly assert the not throw * In some environments it is possible that computer name is 'localhost', so that should be allowed * [feature] Add link for migrating tests from Pester v3 to v4 Fix up capitalization and white space issues Change one test to check FullyQualifiedErrorId rather than just `Should Throw` * [feature] update invoke-item test to handle the case where multiple notepad processes are running * Fix spelling issue with Pester 4x, calling it Pester 4 should be sufficient * Use 'RequireAdminOnWindows' tag in Set-Date tests (PowerShell#6034) * Use 'RequireAdminOnWindows' tag instead of 'Test-IsElevated' function. * Fix incorrect condition of user privilege in Linux/macOS CI * Update 'Restore-PSPester' to use 'Save-Module' (PowerShell#6112) Update Restore-PSPester to use 'Save-Module' to get the latest version of Pester. We have moved to the latest version of Pester via PR PowerShell#6064 * Msi installer: Add smoke test (PowerShell#6105) PR 6043 broke the installer (issue PowerShell#6095). To prevent this from happening in the future, add a smoke test that installs the msi in appveyor build and make build fail if installation failed. It uses the exit code to determine the success. The reason why it does not fail in the current state is because as I pointed out here, the failing custom action is not returning its exit code. * add scripts to set/update the release tag in VSTS (PowerShell#6107) * Improve table view for Certs and Signatures by adding EnhancedKeyUsageList and StatusMessage (PowerShell#6123) * add EnhancedKeyUsageList to default table view of X509Certs add StatusMessage to default table view of cert signatures * set fixed width of 20 to Subject so more room for EnhancedKeyUsageList content change EnhancedKeyUsageList to script to just show the friendly name * Get-ChildItem <PATH>/* -file should include <Path> as search directory (PowerShell#5431) * get-childitem <PATH>/* -file should include <Path> as search directory * [Feature] Added check for -Directory and more tests * [Feature] Added check for the dynamic parameter type * Refactor the Get-Content tests to use -TestCases. (PowerShell#6082) * Update examples to 6.0.1 and removed a removed parameter in Install-PowerShellRemoting.ps1 (PowerShell#6060) The PowerShellVersion parameter no longer exists in Install-PowerShellRemoting.ps1. Updated examples to 6.0.1 from alpha 9 * add guidance on adding copyright and license header to new source files (PowerShell#6140) * Update Raspbian installation instructions to create pwsh symlink (PowerShell#6122) * Update Raspbian installation instructions to create pwsh symlink * [breaking-change] Fix range operator (PowerShell#5732) Breaking-change: "0".."9" returns [char] previously in PowerShell Core (6.0.0, 6.0.1), now it returns [int]. After the change, the behavior is the same as in Windows PowerShell. * Update copyright and license headers (PowerShell#6134) Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files. Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks. Separate PR coming to update contribution document for new source files: PowerShell#6140 Manually reviewed each change. Fix PowerShell#6073 * Invoke-Item.Tests.ps1 handles finding multiple ping executables. (PowerShell#6120) Invoke-Item.Tests.ps1 handles finding multiple ping executables. Fixes Issue PowerShell#5220 * Enable $env:PAGER to work correctly if arguments are used (PowerShell#6144) Correctly parse $env:PAGER with args like 'less -w'. * Support running tests in root privilege on Linux. (PowerShell#6145) Support running tests in root privilege on Linux by adding the `REQUIRESUDOONUNIX` tag. - Delete skip tag in tests which require `sudo`. * fix spelling failures in CI (PowerShell#6191) This fixes spelling failures in CI. It appears to be caused by a change in the tool used to test spelling This change: -Updates the dictionary for new and words which are detected differently -updates markdown where it is more appropriate -adds one file to the markdown tests. * Add tests for Set-Item Cmdlet for Function Provider. (PowerShell#6166) * change the registry version detection value to semver from the default value (PowerShell#6192) change the registry version detection value to semanticversion from the default value fixes PowerShell#6171 * Revert PR 6043 - Adds script to patch the shortcut working directory to the user's home folder (PowerShell#6203) Revert PR 6043 - Remove failing script from MSI reverted from commit 795c611 * [feature] Make UTF-8 Default Encoding for application/json (PowerShell#6109) When a charset is not supplied for a JSON response, the default encoding should be UTF-8 per RFC 8259. This commit changes the default charset to UTF-8 for JSON responses when a charset is not defined. * Add options to enable PSRemoting and register Windows Event Logging Manifest to MSI installer (PowerShell#5999) * Docker package test fix and updates (PowerShell#6169) * Add common aliases for all write-* commands default message parameter (PowerShell#5816) * add common write aliases * add Message alias to the MessageData parameter for Write-Information add Msg and Message alias to the Object perameter for Write-Host * Add tests for new aliases * Add -SkipHeaderValidation Support to ContentType on Web Cmdlets (PowerShell#6018) * Add SkipHeaderValidation Support to ContentType on Web Cmdlets * Move -SkipHeaderValidation Tests to Contexts * Add ContentType -SkipHeaderValidation Tests * Improve ContentType Exception * Improve error message on invalid -ContentType * Add tests for *-Item Cmdlets in Function Provider (PowerShell#6172) * [breaking change] Throw terminating error in New-TemporaryFile and make it not rely on the presence of the 'TEMP' environment variable (PowerShell#6182) - Fixes issue PowerShell#4634 by throwing a terminating error as agreed. - Makes the command not rely on the presence of the TEMP environment variable to get path to temp directory and use the .Net method Path.GetTempPath() instead. - Catch exception more specific as given by the documentation - Improve existing test. * Don't add trailing spaces to last column when using Format-Table (PowerShell#5568) * don't add trailing space to last column in table * fix out-file tests to new behavior of no padding trailing spaces * Refactor new-msipackage into packaging.psm1 (PowerShell#6208) Refactor new-msipackage and related function into packaging.psm1 * Docs: correct a linux installation typo (PowerShell#6219) * Add Password parameter to Get-PfxCertificate cmdlet (PowerShell#6113) Add Password parameter to Get-PfxCertificate cmdlet to allow automatization instead of prompting for password every time. * fix various places that still refer to old versions of pwsh (PowerShell#6179) * Fix a typo in the help content of `pwsh` in ManagedEntranceStrings.resx * Make it clearer how and what to mark as "not applicable" in PR template (PowerShell#6209) * use powershell windowsservercore docker image for release builds (PowerShell#6226) * Set pipeline thread stack size to 10MB (PowerShell#6224) * Uses TLS 1.2 on Windows during Start-PSBootstrap (PowerShell#6235) * Fixed TLS version error on Windows when building PowerShell * Use TLS 1.2 in Start-PSBootStrap Without Breaking HTTPS (PowerShell#6236) * Add RequireSudoOnUnix tag for get-help <cmdletName> tests. (PowerShell#6223) * Fix table alignment and padding. (PowerShell#6230) - The original change to remove extra padding didn't take into account alignment. Fix logic to accommodate left, center, and right alignment in the table format and also add tests. - Fix ImplicitRemoting test that validates formatting to use same instance due to formatting changes in this PR - Only use loopback to same powershell instance for formatting test as the other tests implicitly expect Windows PowerShell. * Fix date tests failing in travis CI full builds (PowerShell#6249) * Add scripts to generate unified Nuget package (PowerShell#6167) Remove the functions which generated Nuget packages for Windows. Add function New-UnifiedNugetPackage to generate nuget packages for each assembly with unix and windows runtimes. Add function New-NuSpec and New-ReferenceAssembly for creating the required items forNew-UnifiedNugetPackage. Add a sample for cross platform project with conditional compilation for Linux. Add function Publish-NugetToMyGet to publish nuget packages to powershell.myget.or * fix MSI creation errors, and capture wixpdb for later patch creation (PowerShell#6221) - add `wixpdb` output when creating `MSI` package - capture `wixpdb` in official build - clean up anything left behind from previous MSI builds before starting MSI build to prevent using dirty files. - make sure MSI creation fails if there is an error - ignore `.wixpdb` files in git - Add functionality to `Start-NativeExecution` to - only display output if there is an error - log caller information - WXS validation error fixes - Remove unused `ExitDialog` to fix ICE82 - Add KeyPath to `SetPath` to fix ICE18 - Use `HKMU` which translates to `HKLM` to runtime to fix various validation errors about creating the shortcut - Suppress Validation errors - suppress ICE61, which is about same version upgrades being allowed - suppress ICE57, caused by the shortcut not being installed per user * revert tests marked pending in PowerShell#6230 (PowerShell#6251) * Fix the terse output on Windows for unelevated test run (PowerShell#6252) * Fix the terse output on Windows for unelevate test run * Make the regex pattern more accurate * use add instead of invoke web request in nanoserver docker file (PowerShell#6255) * change the artifact count for wixpdb (PowerShell#6254) * Fix `Start-PSPester` to include or exclude 'RequireSudoOnUnix' tag smartly on Unix (PowerShell#6241) If `-sudo` is specified, make sure to include 'RequireSudoOnUnix' tag on Unix if the 'Tag' is not specified. If `-sudo` is not specified, make sure to exclude `RequireSudoOnUnix` tag on Unix if the 'ExcludeTag' is not specified. * Add 'Path' alias to '-FilePath' parameters and others for several commands (PowerShell#5817) * Restore modules from the NuGet package cache by using dotnet restore (PowerShell#6111) * Remove AppVeyor specific cmdlet from 'Start-NativeExecution' (PowerShell#6263) Refreshed the cache by running `dotnet nuget locals all --clear` before `dotnet restore`. * FixBuild: Revert the changes to get Pester from NuGet cache (PowerShell#6282) Attempt to fix the macOS build. In PowerShell#6263, I tried flushing the cache and it worked in the PR. However, after merging the PR, it turns out the master CI build failed again with the same Pester package restore error. So I'm reverting the change that got Pester from NuGet cache. * Updated install md bin path (not packaged documentation) (PowerShell#5914) * Cleanup after Powershell install for CentOS/Fedora Docker Images (PowerShell#6264) * Adding "yum clean all" to CentOS 7 Dockerfile reduces docker image size by 76MB * Adding "dnf clean all" to Fedora Dockerfile reduces docker image size by 168MB * Refactor Web Cmdlets Tests to Pester 4 Syntax (PowerShell#6257) * Pass with Update-PesterTest * Search and Replace Pass * [Feature] Move to BeTrue * Update docs with test guidelines with RequireSudoOnUnix tag. (PowerShell#6274) * Updating testing docs with RequireSudoOnUnix tag. * Enable the pending Save-Help tests in CI (PowerShell#6289) Some CI level 'Save-Help' tests were disabled in PowerShell#2806 because HelpInfo URIs for powershell modules were broken (tracked by PowerShell#2807). However, they were forgotten to be enabled when the URI issue was fixed. This PR reenables those tests. * get-childitem -LiteralPath should accept 'Include' or 'Exclude' filter (PowerShell#5462) * get-childitem -LiteralPath should accept 'Include' or 'Exclude' filter * Test for OsLocalDateTime property of Get-ComputerInfo. (PowerShell#6253) * Test for OsLocalDateTime property in ComputerInfo. * Add TLS1.2 workaround for code coverage script (PowerShell#6299) * Update CimDSCParser to fix Configuration compilation for DSC (PowerShell#6225) Update CimDSCParser to fix Configuration compilation for DSC * MSI: Cause preview builds to install Side by side with release builds (PowerShell#6301) MSI: Cause preview builds to install Side by side with release builds - change the upgrade code if there is a preview part of the version * Make sure explorer context menu can be patched (PowerShell#6302) Make sure explorer context menu can be patched - set keypath for explorer log context menu * Tests for Get-Process Cmdlet for Module and FileVersion parameters (PowerShell#6272) * Tests for Get-Process cmdlet. * Tests for Get-Process run as admin. * Skipping some Get-Process tests on Linux * Skip test for -FileVersionInfo parameter for Linux because of the bug that cause the command to hang. * Add checks for ErrorId in Get-Process tests * Change one Get-Process test status to pending for MacOs * MSI: Make sure that file components are patchable (PowerShell#6303) MSI: Make sure that file components are patchable - avoid changing names and guids of components between builds as this prevents patch generation - This required submitting the file generated by heat - add code to make sure the generated file is not out of date * Add support for Debian in installpsh-debian.sh (PowerShell#6314) The script installpsh-debian only works for Ubuntu distributions. This PR adds support for Debian as well. Related issue: PowerShell#5700 * Remove support for Ubuntu 17.04 in installpsh-debian.sh * Rename some tests because they are duplicates (PowerShell#6312) Also remove a couple of language tests which were actually duplicated Change the one loop which loops through test cases to include an iteration number to remove test name duplication * Use new Pester syntax: -Parameter for Pester tests in Modules/CimCmdlets (PowerShell#6306) * Use new Pester syntax: -Parameter for Pester tests in Modules/CimCmdlets. * make Linux packages use correct version scheme for preview releases (PowerShell#6318) Fixes PowerShell#6315 make Linux packages use correct version scheme for preview releases - Now uses <Major>.<Minor>.<Patch>~<PreviewName> instead of <Major>.<Minor>.<Patch>-<PreviewName> as the - was interpretted as an iteration of the release not a preview. * markdown test: use strict in javascript (PowerShell#6328) * Clean build during daily build to ensure MSI package is generate correctly (PowerShell#6334) Clean build during the daily build to ensure MSI package is generated correctly - Do another clean build directly before packaging to clean up files that test has added * Build: Only restore once (PowerShell#6335) * don't restore with every publish * Exclude lines about Pester executing test scripts from terse logs (PowerShell#6336) * Rename log and logerror to Write-Log [$message] [-error] (PowerShell#6333) Fix PowerShell#6332 This change renames log and logerror functions to a single Write-Log [$message] [-error] function to avoid conflicting with the log command on MacOS. * Specify the runtime when running 'dotnet restore' in 'Start-PSBuild' (PowerShell#6345) * Build: Remove two unneeded lines from 'Invoke-AppveyorFinish' (PowerShell#6344) * Make relation-link handling in web cmdlets case insensitive (PowerShell#6338) * Make sure package verification failure fails the AppVeyor build (PowerShell#6337) * Make a relative redirect URI absolute when 'Authorization' header present (PowerShell#6325) * Add negative tests for Copy-Item over remote sessions (PowerShell#6231) * Add '-Restore' when build win-arm and win-arm64 (PowerShell#6353) * Added Service Point Manager call to force Tls12. (PowerShell#6310) Calls [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 during bootstrap to download PowerShell core to avoid an error. * Use new Pester syntax: -Parameter for Pester tests in Microsoft.PowerShell.Management module. (PowerShell#6294) * Clean the intermediate artifact 'psoptions.json' from build (PowerShell#6356) * When doing daily/test build in a non-release branch use the branch name as the preview name (PowerShell#6355) * fix errors in start-psbootstrap during release builds (PowerShell#6159) set Debian front end to non-interactive during apt-get commands, to avoid error with prompting add libffi-dev, which is required for ruby/fpm let fpm update to the latest * Minor code clean-up changes (PowerShell#5737) * Add no appimage build (PowerShell#6380) * MSI: update architecture specific filenames (PowerShell#6379) * Support non-GitHub commits in the change log generation script (PowerShell#6389) * Add lambda support to -replace operator Add support for replacement lambdas when using the -replace operator. Requires minimal changes to existing code by using the following overload: Regex.Replace(string input, MatchEvaluator evaluator) when a ScriptBlock is passed in as the replacement argument. * Pass the 'Match' object to $_ for the substitute script block in '-replace' operation (PowerShell#6029) * Update CODEOWNERS * Use new Pester syntax: -Parameter for Pester tests in engine. (PowerShell#6298) * Use new Pester syntax: -Parameter for Pester tests in engine. * Build: Remov version forcing code from NuGet package generation (PowerShell#6390) * Update version numbers to 6.0.2 (PowerShell#6402) * Add script to update the version number * Update version to 6.0.2 * Update to DotNet 2.0.6 (PowerShell#6403) Update to DotNet 2.0.6 - this addresses [Microsoft Security Advisory CVE-2018-0875: Hash Collision can cause Denial of Service](PowerShell/Announcements#4) - This is a port of PowerShell@d607f20 to 6.1 * Fix 'PropertyOnlyAdapter' to allow calling base methods (PowerShell#6394) For a PropertyOnlyAdapter, the property may come from various sources, but methods, including parameterized properties, still come from DotNetAdapter. So, the binder can optimize on method calls for objects that map to a custom PropertyOnlyAdapter. * Add configuration for https://github.com/probot/stale (PowerShell#6393) * Add yml for https://github.com/probot/stale * Standard deviation implementation on Measure-Object (PowerShell#6238) Implement iterative standard deviation algorithm for Measure-Object * Add 'NullReference' checks to two code paths related to 'PseudoParameterBinder' (PowerShell#5738) 1. Add a null check in the tab completion code on the binding result returned from `PseudoParameterBinder`; 2. Add a null check in `CommandDiscovery.LookupCommandProcessor` on the `CommandInfo` object returned from the method `LookupCommandInfo`. * Correct the '%c', '%l', '%k', '%s' and '%j' formats in 'Get-Date -UFormat' (PowerShell#4805) * Add `Waiting - DotNetCore` label (PowerShell#6406) Also, organize labels in alphabetical order. * Update to Governance doc to reflect current working model (PowerShell#6323) With some changes in the PowerShell Team, need to update Governance doc to reflect current working model being used * Make Resolve-Path -Relative return useful path when $PWD and -Path is on different drive (PowerShell#5740) * commands: make rvpa -relative do not return ./absolute_path This happens on Windows when $pwd and -path is on different drive * only return relative path inside current root * fix secret and JavaScript compliance issues (PowerShell#6408) fix secret and JavaScript compliance issues - mark secrets as a test only secrets - make javascript use strict in a specific function * Change 6.0.1 references to 6.0.2 for 'linux.md' (PowerShell#6411) * Stop 'ConvertTo-Json' when 'Ctrl+c' is hit (PowerShell#6392) * Update the 'ChangeLog.md' for 6.0.2 release (PowerShell#6417) * Update 'macos.md' and 'windows.md' with the version number '6.0.2' (PowerShell#6416) * remove runas.exe from tests as we have tags to control this behavior (PowerShell#6432) remove runas.exe from tests as we have tags to control this behavior - this should reduce the likelihood of errors * migrate the mac offical binary build to VSTS mac hosted preview (PowerShell#6363) create a PowerShellPackage...ps1 that works with these VMs (vs our custom VM) create a script to create the \powershell folder with correct permissions a YML VSTS build definition * MSI: remove the version from the product name (PowerShell#6415) MSI: remove the version from the product name During patching the original MSI information is displayed. This makes installing a patch for an MSI with a specific version very confusing. * Fix the NullRefException when using '-PipelineVariable' with 'DynamicParam' block (PowerShell#6433) * Add Alpine Linux support (PowerShell#6367) sys/sysctl header is not available in musl-libc based systems and system calls are available without any header inclusion. I have ported the cmake test from CoreFX repo (https://github.com/dotnet/corefx/blob/431475b8/src/Native/Unix/configure.cmake#L560). Progress towards: PowerShell#4605 * Change `Get-FileHash` tests to use raw bytes (PowerShell#6430) * Change filehash tests to use raw bytes * Remove testablescript.ps1 from Get-FileHash tests * Use BOM-less UTF8 input for Get-FileHash * Use new Pester syntax: -Parameter for Pester tests in Language. (PowerShell#6304) * MSI: update path with proper value (PowerShell#6441) MSI: update path with proper value - Add verification that path is updated * Fix error in windows provider when the environment as an existing set of variables name that only differs by case (PowerShell#6320) - make the provider storage for the environment on windows ignore duplicates - add tests to verify existing environment get-item behavior * Throw better parsing error when statements should be put in named block (PowerShell#6434) * Make '-CI' not depend on '-PSModuleRestore' in 'Start-PSBuild' (PowerShell#6450) * Restore for official Linux arm builds (PowerShell#6455) * Restore for official Linux arm builds (PowerShell#6455) * Use 'Unregister-Event' to remove an event subscriber when removing 'PSEdit' function (PowerShell#6449) * Fix release packaging build (PowerShell#6459) The release packaging build needs to have 'dotnet' in path, fixed that by adding Find-DotNet Refactored restore logic so it can be used from both Start-PSBuild and Copy-PSGalleryModules * Fix release packaging build (PowerShell#6459) The release packaging build needs to have 'dotnet' in path, fixed that by adding Find-DotNet Refactored restore logic so it can be used from both Start-PSBuild and Copy-PSGalleryModules * Use new Pester syntax: -Parameter for Pester tests in modules: Microsoft.PowerShell.Utility and Microsoft.WSMan.Management. (PowerShell#6366) * Add '-AsArray' parameter to 'ConvertoTo-Json' command (PowerShell#6438) Add `-AsArray` parameter to `ConvertoTo-Json` command to always pack the output string in array brackets, even if the input is a single object. * Update tests in Modules/Microsoft.PowerShell.Diagnostics to use new Pester syntax. (PowerShell#6351) * Update tests in Modules/Microsoft.PowerShell.Core to use new Pester syntax. (PowerShell#6349) * Update tests in Microsoft.PowerShell.Security folder to use Pesterv4 syntax (PowerShell#6256) * Upgrade tests in test\powershell\Host folder to PesterV4 syntax (PowerShell#6250) * Update change log for 6.1.0-preview.1 (PowerShell#6480) * Update docs for v6.1.0-preview.1 release (PowerShell#6481) * Update docs * Added the missing 'stable' label * Update stale bot message (PowerShell#6462) Fix PowerShell#6446 Add "Community members are welcome to grab these works." * Add Test-Json cmdlet (NJsonSchema) (PowerShell#5229) Resolve PowerShell#4220. The cmdlet is based on NJsonSchema. It allows to check: JSON by only parsing JSON against Schema implicitly check Schema by parsing (based on previous line check) NJsonSchema is under MIT (approved see PowerShell#5229 (comment)) * Add -Resume Feature to Web Cmdlets (PowerShell#6447) Fixes PowerShell#5964 Adds -Resume switch to Invoke-WebRequest and Invoke-RestMethod -Resume requires -OutFile Enables the ability to resume downloading a partially or incompletely downloaded file. File Size is the only indicator of local and remote file parity. If the local file is smaller than the remote file and the remote endpoint supports resume, the local file will be appended with the remaining bytes. If the local file is larger than the remote file, the local file will be overwritten If the remote server does not support resume, the local file will be overwritten If the local file is the same size as the remote file, the remote endpoint will return a 416 status code. This response is special-cased as a success in this instance. The local file remains untouched and it is assumed the file was already successfully downloaded previously. If the local file does not exist it will be created and the entire remote file will be requested. Added tests for all code new code paths (I'm pretty sure anyway) Added /Resume Controller to WebListener Documented /Resume Controller Updated .spelling to reflect terms in WebListener docs Note: I had to change the way GetResponse() tracks the current URI as we now have 3 places where the call is taking place. I don't foresee this causing any regressions. This area needs some refactoring. especially if we want to implement a retry mechanism * MSI: add function to generate a MSP (PowerShell#6445) add a function to generate an MSP * Add the parameter '-Not' to 'Where-Object' (PowerShell#6464) * Doc: Update Ubuntu source creation commands to use 'curl -o' (PowerShell#6510) Updated the Ubuntu source creation commands to remove the need for piping * Fix error in windows provider when the environment has accidental duplicates that differ only by case (PowerShell#6489) Fix error in windows provider when the environment has accidental duplicates that differ only by case. Make the provider storage for the environment on windows ignore duplicates and only report the effective value. Add tests to verify existing environment get-item behavior and to ensure that Get-Item env:<var> reports the same as $env:<var>, namely the effective value. Fixes PowerShell#6305 and supersedes PowerShell#6320 based on discussion in PowerShell#6460. * Update Dockerfile test to use ubuntu 17.10 as the base image (PowerShell#6503) * Make sure that the width of the header is at least the size of the label (or propertyname) (PowerShell#6487) * Enable [Environment]::OSVersion to return current OS rather than compatible version (PowerShell#6457) * add application manifest dictating compatibility so that osversion shows appropriate os version on Windows * Change the 'SaveError' method in Parser to use `nameof` for error ids (PowerShell#6498) Many error messages in PowerShell currently use a LINQ expression to pass both the name of the error and the message through in the error processing. This PR uses the `nameof` feature to carry the error name/ID and gets rid of LINQ expression reflection, hopefully improving performance, especially in editor scenarios. * Use new Pester syntax: -Parameter for Pester in SDK and Provider tests (PowerShell#6490) * Add PowerShell logging tests for macOS and Linux (PowerShell#6025) This PR fixes the logging issue on Linux where logging is initialized before `-settingsFile` is parsed causing custom log settings to be ignored. (see ConsoleHost.cs and ManagedEntrance.cs) The PR also includes basic logging tests for Linux and MacOS. PSSyslog.psm1 contains the functions to retrieve selected logged items (based on PowerShell's log id and a timestamp) and Logging.Tests.ps1 contains tests for Linux and MacOS. * Make LanguagePrimitive.GetEnumerable treat 'DataTable' as Enumerable (PowerShell#6511) * Make LanguagePrimitive.GetEnumerable treat 'DataTable' as Enumerable * Use new Pester syntax: -Parameter for Pester tests in modules: PowerShellGet, PackageManagement, PSReadLine (PowerShell#6488) * Fixed scenarios where `NullOrEmpty` string was used instead of `-BeNullOrEmpty` (PowerShell#6535) * Remove empty `Should -Be` statements (PowerShell#6536) * Simplify the paths the MSI uses (PowerShell#6442) - Implementation of PowerShell/PowerShell-RFC#115 (If anything changes in the RFC, we will treat it as a bug, and fix it later) - Update registry and directory paths to use 6 for the version for stable and 6-preview for a preview release - Add checkbox to set path - default checkbox to off for preview builds and on for stable builds * Remove duplicate 'Restore-PSPackage' (PowerShell#6544) * Mark Save-Help PackageManagement tests as pending (PowerShell#6545) * Update 'Update-Help' to save help content in user scope by default (PowerShell#6352) Add the parameter `-Scope` to `Update-Help`, which takes `AllUsers` or `CurrentUser`. The default value is `CurrentUser`. * Clean up workflow logic in the module loading component (PowerShell#6523) Clean up workflow logic in the module loading component. Workflow module is not supported in PSCore. Currently, Import-Module throws a terminating error when seeing .xaml modules. After the change, Import-Module throws a non-terminating error when seeing .xaml modules. * Updating solution file with new project type guids * Removing invalid resources to make Visual Studio builds compile. * Add Unix project to sln * Map configurations to correct configurations This reverts commit 9cbf601. * Fix formatting of tables where headers span multiple rows (PowerShell#6504) * In cases where the header spans multiple rows, need to correctly calculate whitespace and trim appropriately * Use System.Span<int> and C# 7.2 language in SMA * Added new ref assemblies to Files.wxs refactor tests to remove similar xml content added single column test case * add comment about project guids * change project type for unix project * add mappings for unix project * Add comments about configuration mappings * rename solution to powershell * Terminate the loop in PsUtils.GetMainModule() which was infinite in case there was no main module. (PowerShell#6358) * Terminate the loop in GetMainModule if main module is null. * Run tests with FileVersionInfo also on non-windows platforms. Add test for process which main module can be null. * Fix error when 'Format-Wide -AutoSize | Out-String' is called. (PowerShell#6491) * Add checking if an output width is specified. * change _failedToReadConsoleWidth variable to _noConsole bool value. This variable is to cache the default console width when failed to get 'Console.WindowWidth' value. * Add ported Test-Connection cmdlet (PowerShell#5328) The Test-Connection cmdlet works on Windows and Unix. Implemented: Ping Continues Ping Traceroute Detect MTU size (seems don't work on Unix because of .Net Core issue) Connect to TCP port Not jet implemented: I'm putting this off for the future. Detect blackhole routers PingPath Additional considerations As you can see in the tests .Net Core has issues in API implementation. As a result, some tests are skipped on Unix. There is also one issue on Windows. Related comments added to tests. I'm going to open an issue(s) in CoreFX repo. I think we should break the feedback into two parts: scripting functionality interactive functionality (display output) Now I have implemented the output to the screen as the progress bar and as text (without ETS) - we have to decide what is best to use. * Fix running 'pwsh' produced from 'dotnet build' (PowerShell#6549) * Fix line ending in 'DefaultCommands.Tests.ps1' from CRLF to LF (PowerShell#6553) * Engine: Fix several code cleanup issues (PowerShell#6552) * Remove the FullCLR-only symbol-info related code from 'EventManager.cs' (PowerShell#6563) This is because the `AssemblyBuilder` family types do not support emitting symbol information in .NET Core. * Use C# latest language in proj files (PowerShell#6559) Address PowerShell#6547 We begin using C# 7.2 features (Span) but .Net Core doesn't seem use "Latest" as default for a language. So we explicitly set the value. * Use -Throw and -ErrorId native Pester parameters. (PowerShell#6574) * Support 'user@host:port' syntax for SSH Transport (PowerShell#6558) * Update installpsh-<distrofamily>.sh Installers to Handle "preview" in version number (PowerShell#6573) * Improve PSMethod-to-Delegate conversion (PowerShell#6570) Two small improvements: 1. Avoid unnecessary reflection in `ConvertPSMethodInfoToDelegate`. `PSMethod` already has the `MethodInfo` information with its `adapterData` field. 2. Avoid creating the generic `PSMethod<>` type for `PSMethod` that represents constructors, because constructors cannot be converted to a delegate anyways. In case that the `PSMethod` represents constructors, we use a simple `PSMethod` instance instead. Also, rename the type `Unit` to `VOID` to make it more readable, since that type represents `typeof(void)`. * Added check for existence of Location HTTP header before using it (PowerShell#6560) The HTTP RFC (https://tools.ietf.org/html/rfc7231#section-6.4) does not require a Location header to be present for redirects, thus it is required to check if the Location header is returned before using it. * Fix Copy.Item.Tests.ps1 (PowerShell#6596) Fix formatting, absent parameter names and use -Throw and -ErrorID parameters with Should function. * Fix formatting in Convert-Path.Tests.ps1. (PowerShell#6595) * Fix formatting in Clear-Item.Tests.ps1. (PowerShell#6593) * Fix formatting Clear-EventLog.Tests.ps1 (PowerShell#6594) * Fix typos and formatting in Clear-Content.Tests.ps1 (PowerShell#6592) * Fix typos and formatting. * Capitalize function parameters. * Added line break to Acess Denied error message. (PowerShell#6607) * Some fixes in Get-Date -UFormat (PowerShell#6542) * Use UTC datetime in Get-Date -UFormat %s Fix %l output from 0..11 to 1..12 Fix %V using Gregorian calendar * Use a workaround for ISO 8601 week of year (uformat %V) * Add Missing Start-WebListener to Web Cmdlet Tests (PowerShell#6604) * make gem use sudo for macOS (PowerShell#6610) gem install requires sudo on official macOS build VMs. - make bootstrap use sudo for macOS * Create the default PSSession configuration, not tied to a specific PowerShell version. (PowerShell#6519) Create the default PSSession configuration, not tied to a specific PowerShell version. When Enable-PSRemoting command is run, it creates 2 sessions configurations: first, the same as it was before with the name containing the current version expressed as: 'PowerShell.$PSVersionTable.GitCommitId' second with the default name 'PowerShell.6' so that administrators wouldn't have to guess which specific version is installed on the target. PR addresses the issue: PowerShell#6470 * Improve performance of parsing RegexOption for '-split' by using if branches (PowerShell#6605) * Engine: Make some minor cleanup changes (PowerShell#6609) - Remove the calls to `GetTypeInfo()` in the generated `.resx` binding C# binding code (change in the tool `ResGen`). - Remove the unused methods in `SessionState.cs`. - Remove the calls to `GetTypeInfo()` from `Compiler.cs` and other files in `engine\runtime`. - Fix typos in `VariableAnalysis.cs` and `ClassOps.cs`. - Minor perf improvement in `MutableTuple.cs` by using indexing instead of linq extension method `last()`. * Engine: Clean up unneeded 'GetTypeInfo()' calls in interpreter code (PowerShell#6613) Clean up unneeded `GetTypeInfo()` calls in interpreter code. The `GetTypeInfo()` calls were added back in the early days of .NET Core, when most of the properties and methods of `System.Type` were removed. Now those properties and methods are back in `System.Type`, so there is no need to keep those calls. * Make the 'PSISERemoteSessionOpenFile' a support event (PowerShell#6582) Make the `PSISERemoteSessionOpenFile` a support event, so that `Get-EventSubscriber` won't show that subscriber. `Get-EventSubscriber -Force` can still show the support event subscribers. `Unregister-Event -Force` needs to be used to remove a support event subscriber. The event subscriber for `PSInternalRemoteDebuggerStopEvent` and `PSInternalRemoteDebuggerBreakpointUpdatedEvent` are already made support events. And this PR makes it the same for `PSISERemoteSessionOpenFile`. * Fix formatting in Add-Content.Tests.ps1 file. (PowerShell#6591) * Fix formatting. * Capitalize TestDrive and add empty strings. * fix error about setting readonly variable (PowerShell#6617) * Re-order UFormat options in Get-Date (PowerShell#6627) Place in alphabetical order the options * Support importing module paths that end in trailing directory separator (PowerShell#6602) * Remove support for file to opt-out of telemetry, only support env var (PowerShell#6601) Since a PR added support to opt out of telemetry via an environment variable, we can remove the, always intended to be a temporary, solution of deleting a file to opt out of telemetry since the environment variable can be defined at the system level and exist before even installing PowerShell Core. Because the variable is defined as opt out, a value of true, yes, or 1 means no telemetry is sent. * Fix for the Register-PSSessionConfiguration command (PowerShell#6630) Fix for the Register-PSSessionConfiguration command, as some tests were failing in: https://ci.appveyor.com/project/PowerShell/powershell-f975h Probably because of changes in PowerShell#6519 * Clean up 'GetTypeInfo()' calls under engine/parser (PowerShell#6636) `GetTypeInfo()` were added when porting PowerShell to early version of .NET Core (prior .NET Core 1.0). Most properties and methods in `System.Type` were missing at that time. Now the call is not needed anymore and should be removed. * Add meta properties to mac VSTS yml (PowerShell#6619) Add meta properties to mac VSTS YAML - Add a property to clean the build machine - Add a property to set the format of the build name - add a property to set which queue to run the build in * Clean up 'GetTypeInfo()' calls in 'help', 'cimSupport' and 'DscSupport' folders (PowerShell#6633) 'GetTypeInfo()' were added when porting PowerShell to early version of .NET Core (prior .NET Core 1.0). Most properties and methods in 'System.Type' were missing at that time. Now the call is not needed anymore and should be removed. * Clean up 'GetTypeInfo()' calls in other engine sub-folders (PowerShell#6635) 'GetTypeInfo()' were added when porting PowerShell to early version of .NET Core (prior .NET Core 1.0). Most properties and methods in 'System.Type' were missing at that time. Now the call is not needed anymore and should be removed. * Clean up 'GetTypeInfo()' calls in engine folder (PowerShell#6634) 'GetTypeInfo()' were added when porting PowerShell to early version of .NET Core (prior .NET Core 1.0). Most properties and methods in 'System.Type' were missing at that time. Now the call is not needed anymore and should be removed. * Remove extraneous SSH and install docs from the 'demos' folder (PowerShell#6628) * Formatting: Use cache for dash padding strings (PowerShell#6625) * Reformat Format-Table tests (PowerShell#6657) * Convert identations to spaces * Remove alias tests and extra lines * Remane extra Describe * Remove extra parentheses and add spaces * Port Windows PowerShell AppLocker and DeviceGuard UMCI application white listing support (PowerShell#6133) These changes port Windows PowerShell support for Applocker and DeviceGuard User Mode Code Integrity (UMCI) to PSCore6. Windows PowerShell uses public APIs to determine if a system is in locked down mode via AppLocker or DeviceGuard, and automatically runs in constrained language mode. For more information about PowerShell constrained language, see: https://blogs.msdn.microsoft.com/powershell/2017/11/02/powershell-constrained-language-mode/ This support for application whitelisting has mostly existed in PSCore6, but the primary APIs were stubbed out in CorePSStub.cs because they relied on Windows only DeviceGuard (wldp.dll) and AppLocker (Safer APIs) public APIs. These changes re-implement PowerShell lock down APIs on PSCore6 for Windows platforms only. The AppLocker and DeviceGuard public APIs are currently only implemented in Windows OSes and are not supported on Linux or MacOS platforms. Tests have also been ported to PSCore6 and run only for Windows platforms. * Reduce allocations in TableWriter (PowerShell#6648) * [Feature] Reduce allocations in TableWriter * Revert iterator ReadOnlySpan is not supported in iterators * Use columnsThresHold with stackalloc * Add new reliable tests for Get-Date -UFormat (PowerShell#6614) * Add tests for Format-Table -Wrap (PowerShell#6670) * Correct a typo in comment for 'Invoke-WebRequest' (PowerShell#6700) * Add '-WorkingDirectory' parameter to pwsh (PowerShell#6612) Add `-WorkingDirectory` parameter to `pwsh` to allow starting in right working directory. * Pretty print Export-FormatData XML output (PowerShell#6691) Pretty print Export-FormatData XML output by default. Refactor Export-FormatData tests, remove test duplications.
This is so nice. Been asking for this for years! :) Great job @powercode ! |
PR Summary
Related to #5618
Two improvements:
ConvertPSMethodInfoToDelegate
.PSMethod
already has theMethodInfo
information with itsadapterData
field.PSMethod<>
type forPSMethod
that represents constructors, because constructors cannot be converted to a delegate anyways. In case that thePSMethod
represents constructors, we use a simplePSMethod
instance instead.Also, rename the type
Unit
toVOID
to make it more readable, since that type representstypeof(void)
.PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
to the beginning of the title and remove the prefix when the PR is ready.[feature]
if the change is significant or affects feature tests