Commit graph

6305 commits

Author SHA1 Message Date
Travis Plunk b3d0913d74
Add CI definition for VSTS for macOS (#7490)
Add CI definition for VSTS for macOS
  - Add VSTS YAML for mac
  - Add a function to upload log files during a test on VSTS
2018-08-10 15:13:31 -07:00
Staffan Gustafsson 1243891ea8 Improve performance on json to psobject conversion (#7482)
This amounts so a speed-up in the order of 7x. Cmdlets that benefit from this are `Convertfrom-Json` and `Invoke-RestMethod`. There are three main changes:

- Convert from `JArray` directly to object array instead of creating a `List` and do `list.ToArray()`.
- Avoid iterating through `PSObject.Properties` to check for existing members, since that is a very slow and allocation heavy code path.
- Pre-allocate the members in `PSObject` by using the newly added constructor accepting an initial member count.
2018-08-10 10:28:15 -07:00
Staffan Gustafsson 3aaa1816d1 Adding 'LanguagePrimitives.TryCompare' to provide faster comparisons (#7438) 2018-08-10 10:20:27 -07:00
Brandon Olin 8374a5c97d Remove one unneeded verbose output from 'ConvertTo-Json' (#7487) 2018-08-10 10:13:05 -07:00
Syed Faraaz Ahmad b754cd80d5 Throw error on entering non-existing type in Get-FormatData (#7434)
Write non-terminating error when `Get-FormatData` doesn't found a type definition for the provided type,
2018-08-10 09:34:02 +05:00
Staffan Gustafsson 037e12eddc Improve the performance of 'Group-Object' (#7410) 2018-08-09 12:11:06 -07:00
Staffan Gustafsson 618d9f31a0 Add '-SkipIndex' parameter to 'Select-Object' (#7483) 2018-08-09 11:59:54 -07:00
Dongbo Wang 791159d615
Add 'Former Repository Maintainers' section in maintainers/README.md (#7475) 2018-08-08 12:38:45 -07:00
Dongbo Wang ca64bfb3e3
Update the 'HelpUri' for 'Get-ExperimentalFeature' (#7466) 2018-08-08 12:38:07 -07:00
Travis Plunk d29349bb4d
Default to DefaultConsoleWidth when DotNet says WindowWidth is 0 (#7465)
Default to DefaultConsoleWidth when DotNet says WindowWidth is 0

This resolves an issue in an environment like VSTS when pwsh is spawned and DotNet is not able to determine the Console Width.
* Port changes from #6883 by @kalgiz
2018-08-07 15:27:42 -07:00
Travis Plunk 1523c218a6
Make sure that SettingFile arg is parsed before we load the settings (#7449)
Make sure that SettingFile arg is parsed before we load the settings

- Add ability to parse some setting before console host is created
- Trigger the Parse before the console host is created
- disable snapin loading from loading setting before this point
- re-enable mac logging tests.

Also, fix the following Travis-ci issues:

- make sure the Linux and macOS caches are separate to reduce the size
- update the macOS image to the closest image as used by the official build system (equivalent to VSTS hosted mac builds)
2018-08-07 15:01:31 -07:00
Bruce Payette 0c11582e6c Make Native globbing on UNIX return an absolute path when it is given an absolute path (#7106)
Fix #7089. Native globbing on UNIX was turning absolute paths into relative paths when it shouldn't. The code suppresses generating a relative path for paths starting with '~'. It also need to do the same for paths starting with '/'.
2018-08-07 14:38:22 -07:00
Aditya Patwardhan f858e6d207 Add Microsoft.PowerShell.MarkdownRender to signing xml (#7472) 2018-08-07 11:47:36 -07:00
Steve Lee 36dc96af0e Fix error message for Add-Type when -AssemblyName with wildcard is not found (#7444) 2018-08-06 11:12:39 -07:00
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