Commit graph

6341 commits

Author SHA1 Message Date
Ilya
097e14426f Avoid extra unnecessary allocations in PSMemberInfoInternalCollection<T> (#7435)
`PSMemberInfoInternalCollection<T>` uses OrderedDictionary class internally. `OrderedDictionary` in dotnet core 2.1 allocates `ArrayList` and `Hashtable` after any first using any property. Even if the `OrderedDictionary` object is actually empty.

The commit postpones the internal allocations until it's really necessary. Given that `PSMemberInfoInternalCollection<T>` is used in each PSObject and is often empty, this change dramatically reduces memory allocations.
2018-08-06 11:06:37 -07:00
Staffan Gustafsson
d620c4fd1e Improve performance of Import-CSV up to 10 times (#7413)
Speed up the creation of PSObjects in CSV cmdlets by

- Use the overload Add(PSMember, bool prevalidated) for all objects except the first when adding the `NoteProperty` members.
- Add a new constructor to PSObject that preallocates the `_instanceMembers` collection with an initial capacity.
- Improve performance of AddToTypesXmlCache by avoiding an expensive copying of members just to check for the existence of one of them, perf is significantly increased, and allocations are reduced.
- Reduce allocations and GC pressure by preallocating and reusing `StringBuilders` and `List<string>` for line parsing in CSV cmdlets.
- Use `List<string>` instead of `Collection<string>` to get fewer virtual calls and better inlining.
- Reduce allocations by using a preallocated value factory in `TypeTable.GetMembers(ConsolidatedString types)`.
- Replace a `Linq.Any()` with a `List.Count > 0` in binder code.

The main gain is from taking advantage of the fact that all objects created by `Import-Csv` have the same shape (the same properties).
2018-08-06 10:58:55 -07:00
Greg Zimmerman
f0ea0d380f Add preview icon to macOS launcher (#7448) 2018-08-05 11:00:39 -07:00
kwkam
fbfbb4f005 [Feature] Fix Move-Item -Path with wildcard char (#7397)
Unescape non-literal, non-glob path in ProccessRecord and
set the context.SuppressWildcardExpansion in RenameItem.
This solve the issue where Rename-Item complains -Path does not exist
when both -Path and CWD contains special characters.
2018-08-05 17:31:06 +05:00
Robert Holt
dbdcf6e5eb Fix to not duplicate the System32 module path when starting pwsh from pwsh (#7414) 2018-08-03 11:22:30 -07:00
Dongbo Wang
25c127c3bc
Update CI scripts to support running tests for experimental features (#7419) 2018-08-03 11:20:14 -07:00
Aditya Patwardhan
ac8ac4f25b Update NuGet packaging code for the new markdown assembly (#7431) 2018-08-02 23:00:54 -07:00
Staffan Gustafsson
81313743df Improving performance of LanguagePrimitives.TryConvertTo. (#7418)
Before the fix the TryConvertTo() is implemented in terms of Convert(), but with wrapping exception handling. This is costly performance wise. By inlining the implementation of ConvertTo(), and getting access to the FigureConversion output we can determine upfront on at least some occations that a conversion is not available.
2018-08-03 09:18:05 +05:00
Steve Lee
f8b3abaac7 Add support for passing files and markdown directly to Show-Markdown (#7354)
* add support for -Path/-LiteralPath and piping strings directly to Show-Markdown

* update tests to set vt100 support
2018-08-02 15:49:38 -07:00
Christoph Bergmeister [MVP]
5717a5dffc Add xunit project to PowerShell.sln and make it runable from within VisualStudio (#7254)
* add csproj ref to sln

* Remove Microsoft.NET.Test.Sdk NuGet reference. The xunit.runner.visualstudio package is now sufficient for running tests in VS in the latest version (15.7.5)

* use RTM versions of XUnit 2.4.0 that got published today

* Update XUnit in hosting project as well to newer release
2018-08-02 11:51:04 -07:00
Dongbo Wang
73b6d810bd
Make logging tests for macOS pending (#7433) 2018-08-01 16:49:39 -07:00
Jianyun
344878dcbb Set the cursor to the place where a user hits tab key (#7299)
* Set the cursor to the place where a user hits tab key
2018-08-01 13:31:49 -07:00
Ilya
5d03e1653a
Remove empty xml comment lines (#7401) 2018-08-01 10:39:13 +05:00
Sergey Vasin
740d059d51 Change parameters order in Get-Help and help in order to get first -Full and then -Functionality when using Get-Help -Fu<tab> and help -Fu<tab>. (#7370) 2018-07-31 11:13:18 +05:00
Christoph Bergmeister [MVP]
779957b12a Update WCF and NJsonSchema NuGet packages to latest released patch version (#7411) 2018-07-31 09:53:38 +05:00
Sergey Vasin
58ac08c60a Use -HaveCount instead of -Be in Where-Object.Tests.ps1. (#7379) 2018-07-31 08:51:42 +05:00
Sergey Vasin
fcc519bb08 Fix parameter name in the Get-Variable cmdlet error message. (#7384)
Before the fix when using Get-Variable or Get-Alias cmdlets with the -Scope parameter with wrong value, the error message refers to 'scopeID' parameter instead of 'Scope'.
2018-07-31 08:50:41 +05:00
Aleksandar Nikolić
ca7f103a15 Fix casing of GitHub in best-practice.md (#7392)
Fix Github to GitHub.
2018-07-30 10:36:41 -07:00
Sergey Vasin
da6d2647ac Use -BeExactly and -HaveCount instead of -Be in TabCompletion.Tests.ps1. (#7380) 2018-07-30 10:32:52 +05:00
Sergey Vasin
9e30419501 Use -BeExactly and -HaveCount instead of -Be in BugFix.Tests.ps1. (#7386) 2018-07-30 08:17:28 +05:00
Aleksandar Nikolić
27df6dcb32 Fix a typo in issue-management.md (#7393) 2018-07-27 17:44:59 -07:00
Aleksandar Nikolić
a5f9b50319 Fix typos in docs/maintainers/README.md (#7390) 2018-07-27 17:29:07 -07:00
Aditya Patwardhan
4e7c2ed663 Fix several issues in Markdown cmdlets (#7329)
- Formatting file should be used for `MarkdownOptionInfo` object instead of the types file for adding script property.
- Downlevel windows consoles which do not support VT100 escape sequences should be handled gracefully.
- Add helpuri fwlink for cmdlets.
- Make `-Path` a positional parameter for `ConvertFrom-Markdown`
- make `-InputObject` a positional parameter for `Set-MarkdownOption`
2018-07-27 17:26:35 -07:00
Dan Thompson
e7c315b65c Start-DevPowerShell: add -Configuration and handle -ArgumentList more properly (#7300)
- Allow specifying the configuration, rather than the `bin` folder.
- Do not attempt to pass null/empty `ArgumentList` to `Start-Process`.
2018-07-26 10:30:05 -07:00
Ilya
d97c9e701b Bulk update format for files in Management folder with codeformatter (#7346) 2018-07-26 10:14:09 -07:00
Dongbo Wang
63430e91b9
Set 'PowerShellVersion' to 3.0 for built-in modules to make Windows PowerShell work when starting from PSCore (#7365) 2018-07-26 10:10:20 -07:00
Steve Lee
b767d5cacd Fix IsHardLink() to return false instead of throwing exception when unable to determine (#7355) 2018-07-26 10:08:38 -07:00
Paul Higinbotham
20f7577548 Fix ThreadJob tests so that they will run more reliably (#7360) 2018-07-26 10:02:05 -07:00
Dongbo Wang
41111a15e6
Update 'Utils.IsComObject' to use 'Marshal.IsComObject' since CAS is no longer supported in .NET Core (#7344)
A comment from the existing `Utils.IsComObject` mentions that: "We can't use System.Runtime.InteropServices.Marshal.IsComObject(obj) since it doesn't work in partial trust."

Partial trust is a concept of Code Access Security (CAS)/Security-Transparent. CAS and Security-Transparent are no longer supported in .NET Core, so we should use `Marshal.IsComObject` instead.
2018-07-26 09:59:07 -07:00
Dan Travison
1583318d72 Correct the comment for 'WSManReceiveDataResult.Unmarshal'. (#7364) 2018-07-25 16:37:10 -07:00
Steve Lee
1244278e7e [package] (#7345)
enable `pwsh-preview` to work on Windows
2018-07-25 13:32:10 -07:00
Dan Travison
936626b7e8 Update PowerShell to reference 'psrp.1.4.5-0' on Unix build (#7350) 2018-07-25 10:04:00 -07:00
Ilya
e3854815ab Cleanup: replace 'Utils.FileExists()/DirectoryExists()/ItemExists()' with .NET methods (#7129) 2018-07-25 10:02:09 -07:00
Dongbo Wang
87d8fc969c
Fix sequence point update for switch/if/for/while/do-while/do-until statements (#7305)
- Make switch-statement report correct error position when it fails to evaluate the condition.
- Make for-statement report correct error position when it fails to evaluate the initializer.
- For the condition of `if/for/while/do-while/do-until` statements, the sequence point update is either duplicate in some cases (for `if/for/while`) which causes debugger to stop at the condition twice  before moving forward, or missing (for `do-while/do-until`) which causes debugger to skip the condition. They are fixed.
2018-07-25 09:56:32 -07:00
Joshua Cooper
439f97c533 Update Docker link to PowerShell-Docker (#7351) 2018-07-25 12:28:37 +05:00
Adam Gauthier
e34554c3ca Ignore Newtonsoft.Json metadata properties in ConvertFrom-Json (#7308)
Some values are not converted from json to PSCustomObject, because Newtonsoft.Json reads them and thinks they are metadata properties only useful for deserialization. This change makes Newtonsoft.Json "ignore" those properties so they are converted correctly from json to PSCustomObject.
2018-07-25 08:56:49 +05:00
Steve Lee
f5a7d79175 Add support for parsing Link Header with variable whitespace (#7322)
Fix is to change the regex to allow for variable or no whitespace and associated tests to handle these two cases.
2018-07-24 10:56:00 +05:00
Travis Plunk
80d2af8934
Cleanup Docker files (#7328)
* update docker read me to point to new repo
* remove unused files
2018-07-23 15:19:58 -07:00
Dongbo Wang
5c11f09706
Add maintainer's best practice document and update maintainer list (#7311) 2018-07-20 21:31:21 -07:00
Ilya
e9d5f68ba5 Format Utility csproj with updated codeformatter (#7263)
Related #4708.

Format Microsoft.PowerShell.Commands.Utility.csproj by codeformatter with default options.

The codeformatter is used that I compiled with newest Roslyn packages (version 2.8.2).
2018-07-20 18:51:13 -07:00
Dan Travison
6febd1f883 Update Build script owners (#7321) 2018-07-20 12:32:49 -07:00
Aditya Patwardhan
ed4a454ac4 Make MUSL NuGet package optional (#7316) 2018-07-20 11:08:25 -07:00
Greg Zimmerman
d9c570a90d Fix macOS launcher app to allow release and preview versions. (#7306)
Fixes #7074. This PR allows concurrent versions of the macOS launcher app to exist. The application name will be either PowerShell or PowerShell-preview. It is now dynamically built and removed post fpm to avoid post build conflicts, see #5262 .
2018-07-20 10:53:09 -07:00
Travis Plunk
fd4494f224 Add 'Snapcraft' to spelling dictionary (#7318) 2018-07-19 19:55:04 -07:00
Travis Plunk
90dcce6c40 Merge branch 'release-v6.1.0-preview.4' into master 2018-07-19 16:38:26 -07:00
Dongbo Wang
08e3955231 Merged PR 3912: Update package versions for the new release 2018-07-19 22:15:44 +00:00
Travis Plunk
c74be0ba40 Merged PR 3869: initial draft of changelog
initial draft of changelog
2018-07-19 21:09:30 +00:00
Ilya
a3786158ca
Fix docs comments in utility folder (#7192) 2018-07-17 10:07:16 +05:00
Steve Lee
63041b4aec Update Enable-PSRemoting so configuration name for Preview releases (#7202)
The intent was to have the version of the PSSessionConfiguration name not include the `v` for the version string.  Also, Preview releases should standardize on `PowerShell.6-Preview` instead of clobbering `PowerShell.6` so that stable and preview can co-exist side-by-side.

Need to verify on Win10 IoT if `Install-PowerShellRemoting.ps1` is still needed anymore as it may be possible to run `pwsh -c enable-psremoting` from within Windows PowerShell Core removing the need for that script which duplicates `Enable-PSRemoting` capability.

Update: Not able to get the current master build working on Win10 IoT, getting `Invalid access to memory` error.  Will have to investigate this separately from this PR and keep `Install-PowerShellRemoting.ps1` for now.

Fix https://github.com/PowerShell/PowerShell/issues/7119
2018-07-16 19:40:46 -07:00
Robert Holt
e857135d3c Enforce the 'CompatiblePSEditions' check for modules from the legacy 'System32' module path (#7183)
- Add `%WINDIR%\System32\WindowsPowerShell\v1.0\Modules` (Windows PowerShell $PSHOME) to the end of the default PSCore 6 module path (i.e. the module path as initially set at startup).
- Cause an error to be thrown by `Import-Module` when a module with `CompatiblePSEditions` not containing `"Core"` is being loaded from the 'System32' module path.
- Suppress output of modules listed by `Get-Module -ListAvailable` from Windows PowerShell $PSHOME when `CompatiblePSEditions` does not contain `"Core"`.
- Introduce the `-SkipCompatibilityCheck` switch parameter on both `Import-Module` and `Get-Module` to respectively allow importing incompatible modules and listing incompatible modules.
- Adds a  `PSEdition` column to the `PSModuleInfo` table view format.
- Ensures that completions are not given for incompatible modules on the System32 module path.
2018-07-16 19:40:46 -07:00