Commit graph

1637 commits

Author SHA1 Message Date
Michael Klement 73716e9792 Make scriptblock-based calculated properties work again in ConvertTo-Html (#8427) 2019-01-09 13:55:03 +05:00
Sergey Vasin 6f071f0ba5 Fix Join-String cmdlet FormatString parameter logic (#8449) 2019-01-09 11:06:20 +05:00
Steve Lee d6000fdea8 Allow Windows users in developer mode to create symlinks without elevation (#8534) 2019-01-08 10:43:24 -08:00
Steve Lee 64fcddcb53 Help function should only pass content to pager if content was found (#8528) 2019-01-08 09:56:56 -08:00
Steve Lee 031cbf0f16 Change clear-host to simply called [console]::clear and remove clear alias from Unix (#8603)
Based on @PowerShell/powershell-committee decision, standardizing on [Console]::Clear() on all platforms and removing clear alias on non-Windows.
2019-01-08 22:38:56 +05:00
Dongbo Wang 4a63201139 Remove 'en-us' from our doc links (#8602) 2019-01-07 17:11:17 -08:00
Steve Lee d51b5fdc30 help function shouldn't use pager for AliasHelpInfo (#8552) 2019-01-07 13:39:57 -08:00
Kirk Munro 23f6e8ff40 Add S.M.A.PowerShell.Create method overload with Runspace argument (#8057) 2019-01-07 11:04:42 -08:00
Ilya b8f9532b41 Style: Use the type alias 'string' instead of 'String' in places that are appropriate (#8573) 2019-01-07 10:46:00 -08:00
xtqqczze 379cbb60cd Correctly capitalize the ForEach operator in *.ps1 (#8583) 2019-01-06 17:00:56 +05:00
xtqqczze f0f301bc5e Avoid use of mkdir alias in *.ps1 and *.psm1 (#8582) 2019-01-04 14:31:24 +05:00
xtqqczze 1a3aadfc4e Regularize redirection operator spacing in *.ps1 and *.ps1m (#8581)
Add space after redirection operator.
2019-01-03 12:59:14 +05:00
Ilya dfd2f69369
Style: Change 'String.' to 'string.' (#8568) 2018-12-31 20:44:16 +05:00
Ilya f31750c0d1
Fix typo in AMSI test (#8561) 2018-12-29 18:16:50 +05:00
xtqqczze 70de294fea Remove use of cmdlet aliases from .\test\powershell (#8546) 2018-12-28 13:48:23 +05:00
xtqqczze b850d57c78 Style: Remove preceding spaces from C# preprocessor-type keywords (#8540) 2018-12-26 11:59:10 +05:00
Ilya d8af22c33b
Style: Change 'Byte{}' to 'byte[]' (#8525) 2018-12-24 11:23:18 +05:00
Steve Lee 4af3068566 Code cleanup: Add space after closing brace where needed (#8530)
* Update TestService

* Update WebListener

* Update Controllers

* Update ExpTest

* Update MyApp

* Update Logic

* Update Logic

* Update MyApp

* Update Microsoft.Management.Infrastructure.CimCmdlets

* Update Microsoft.PowerShell.Commands.Diagnostics

* Update Microsoft.PowerShell.ScheduledJob

* Update Microsoft.WSMan.Management

* Update Microsoft.WSMan.Runtime

* Update ResGen

* Update TypeCatalogGen

* Update commands

* Update Eventing

* Update Reader

* Update utility

* Update ShowCommand

* Update trace

* Update WebCmdlet

* Update Common

* Update CoreCLR

* Update common

* Update format-object

* Update format-wide

* Update out-file

* Update out-printer

* Update out-string

* Update OutGridView

* Update LocalAccounts

* Update Commands

* Update security

* Update CoreCLR

* Update DscSupport

* Update engine

* Update help

* Update logging

* Update namespaces

* Update security

* Update utils

* Update config

* Update perfCounters

* Update tracing

* Update cmdletization

* Update other

* Update cim

* Update xml

* Update CoreCLR

* Update common

* Update DefaultFormatters

* Update out-console

* Update out-textInterface

* Update DisplayDatabase

* Update Utilities

* Update COM

* Update ComInterop

* Update CommandCompletion

* Update debugger

* Update ExperimentalFeature

* Update hostifaces

* Update interpreter

* Update lang

* Update Modules

* Update parser

* Update runtime

* Update client

* Update commands

* Update common

* Update fanin

* Update server

* Update WireDataFormat

* Update Binding

* Update Operations

* Update interface

* Update cmdletization

* Update cim

* Update management

* Update WindowsTaskbarJumpList

* Update msh
2018-12-24 11:20:06 +05:00
Mathias R. Jessen 0e971a42bf Fix xml nesting bug in CustomSerializer.WriteMemberInfoCollection() (#8476)
WriteMemberInfoCollection() calls WriteEndElement() at most once, even if WriteStartElement() has been called more than once. This commit moves the WriteEndElement() call up immediately after the elements text value has been written.
2018-12-22 22:50:11 +05:00
Steve Lee 2eb7ca8309 Fix formatting of header of table when center aligned (#8497) 2018-12-22 12:57:44 +05:00
Dongbo Wang 2bfbcd4f07 Remove empty lines; correct space on closing square brackets, negative signs, and generic brackets (#8508) 2018-12-21 12:23:04 +05:00
Luke Jeremy 56fc426f8b Add -UseMinimalHeader to Start-Transcript to minimize transcript header (#8402) 2018-12-20 11:12:14 -08:00
Steve Lee 110f78b818 Add -RepeatHeader to Format-Table to enable repeating header for each screen full (#8481)
When using a screen reader or just getting the output of a table with lots of rows, the header is no longer on the screen and the columns may no longer make sense without the context.  This change adds a `-RepeatHeader` switch to `Format-Table` to enable re-outputting the header after every screen full (minus 1 row).  Expectation is that the user is piping the output to a pager (e.g. less) which uses the bottom row for pager information.  I followed the `AutoSize` parameter as the way to get the parameter from the cmdlet into the deep formatting object where it's needed.
2018-12-20 11:05:34 -08:00
Joel Sallow (/u/ta11ow) 64bbdbe61c Add Tests for ConfirmImpact Ratings (#8214) 2018-12-20 23:15:42 +05:00
Ilya c857392c34
Fix style issues in xUnit tests (#8465) 2018-12-18 21:11:21 +05:00
Ilya a9f106da58 Move xUnit tests in new folder (#8356)
## Motivation

I have a PR where there are many new xUnit tests.
It would also be useful to create new xUnit tests for public APIs.
The number of xUnit tests will increase and their ordering is required.

## PR Summary

- Move C# xUnit tests in new folder. This allows to put new xUnit tests in directory structure in accordance with directory structure where cs files are.
- Use an xUnit TestCaseOrderer attribute to sequentially process tests for `powershell.config.json`.
- Update README.md
- A race condition was fixed which allowed  to run all XUnit tests in single batch job.
2018-12-13 14:22:07 -08:00
Aditya Patwardhan 551ed10b36 Fix EnvironmentVariable test and add missing null check in CommandHelpProvider (#8408)
* Disable NewItemUnauthorizedAccessError tests.
* Added expected value for $env:HOMEPATH for user with temporary profile.
* Added a missing null check in CommandHelpProvider.cs
2018-12-11 14:20:22 -08:00
Aditya Patwardhan ee5fc080e2 Remove dotnet dependency to start WebListener (#8390)
WebListener.exe (which was already being built) is sufficient to start web listener. Remove the dependency on `dotnet` being present to start the web listener.

Use `Start-Process` instead of `Start-Job` to launch the WebListener.
2018-12-11 14:15:32 -08:00
Steve Lee f17601298b Reset output attributes if column had ESC char when using Format-Table; Replace ... with unicode ellipsis (#8326)
change ellipsis when truncating to single unicode character
reset console output if previous column contains ESC
update existing format-table tests

If content included a VT100 ESC sequence (like changing color), this affected all output after that cell in the table.  Fix is to detect that a cell contained ESC and reset the console after it.  Also, change the 3 character ellipsis `...` to use the single unicode character `…` so that more text is available.

Fix https://github.com/PowerShell/PowerShell/issues/7767
2018-12-11 13:56:46 -08:00
Aditya Patwardhan 1d32d05157 Merged PR 6201: Update docs and csproj version
Update docs and csproj version
2018-12-07 18:24:07 +00:00
Dongbo Wang 2dcf52f3fc
Update folder path for storing optimization profile and add test to validate loaded assemblies and libraries on startup (#8406)
- Update folder path for storing optimization profile file.
- Add test to validate loaded assemblies and libraries on startup.
2018-12-06 14:26:09 -08:00
Dongbo Wang c1e171622a
More changes and cleanup to reduce the startup time (#8396)
Major changes are:
- Rename `s_wasSystemPolicyDebugPolicy` to `s_allowDebugOverridePolicy` to make it less confusing. Also slightly refactor `HelperSecurity.psm1` and `ConstrainedLanguageDebugger.Tests.ps1` to remove unneeded code. There is no functional change in this commit.
- Remove the unneeded static property `IsInbox`, as PowerShell Core won't be shipped in-box with Windows in the foreseeable feature. Even if we do in future, we won't be needing it because Windows PowerShell will probably be gone by that time.
- Update 'BindRunspace' to avoid getting all commands and unneeded method calls.
- Avoid creating a `IsSafeValueVisitor` every time when `IsScriptBlockInFactASafeHashtable` runs.
2018-12-05 18:29:50 -08:00
Steve Lee 52aef57ab6 Add Enable-ExperimentalFeature and Disable-ExperimentalFeature cmdlets (#8318)
[breaking change]
Major changes are as follows:
- Add `Enable-ExperimentalFeature` and `Disable-ExperimentalFeature` cmdlets.
- Remove `-ListAvailable` from `Get-ExperimentalFeature`.
- Add `ArgumentCompleter` for `Get-ExperimentalFeature` cmdlet.
- Refactor some existing Experimental Feature tests.
- Make `ConfigScope` public and renamed `SystemWide` to `AllUsers`. Also update experimental feature code to prefer the current user config over the all user config.
2018-12-05 12:20:58 -08:00
Travis Plunk 142814c12a
Fix an intermittent failure in macOS logging tests (#8385)
Fix an intermittent failure in macOS logging tests
  - make tests wait for the correct number of log entries
  - make tests not fail with an `Index was outside the bounds of the array.` error
2018-12-03 14:29:49 -08:00
Aditya Patwardhan a62eb62701 Remove all reference to AppVeyor and Travis CI from docs (#8376) 2018-12-03 10:14:11 -08:00
Dongbo Wang a11810bf33
Improve powershell startup time (#8341)
Major changes are as follows:
- Avoid `SecuritySupport.IsProductBinary` and unnecessary AMSI/suspicious code scan at startup time
   - Update `CompiledScriptBlockData.IsProductCode` to avoid unnecessary calls to `IsProductBinary`, which attempts to retrieve catalog signature of the target file.
   - Update `PerformSecurityChecks` to skip AMSI and suspicious code scan for the `.psd1` file that contains a safe `HashtableAst` only.
- Use customized `ReadOnlyBag` instead of `ImmutableHashSet` so that we can avoid loading the `System.Collections.Immutable.dll` completely.
- Replace `SHA1` with `CRC32` when generating module analysis cache file name
   - This remove the loading of `System.Security.Cryptography.Algorithms.dll` at startup
- Move `ConvertFrom-SddlString` to C# to remove the `Utility.psm1` file.
- Crossgen `Microsoft.ApplicationInsights.dll` and enable tiered compilation
   - Even pwsh with crossgen assemblies spends a lot time in jitting at the startup, about `191.6ms` comparing with `24.7ms` for Windows PowerShell.
   - Jitting `Microsoft.ApplicationInsights.dll` takes about `51.6ms`.
   - By crossgen `Microsoft.ApplicationInsights.dll` and enable tiered compilation, the jitting time drops to about `98.9ms`.
2018-12-02 12:52:39 -08:00
Travis Plunk 2a469b7d0f
Revert "Remove workaround for fixed invalid json array deserializing bug (#8346)" (#8375)
Revert "Remove workaround for fixed invalid json array deserializing bug (#8346)"

This reverts commit 60a4e2f346.

This change caused the test which verified the functionality this workaround enabled, to start failing
2018-11-30 14:32:11 -08:00
Aditya Patwardhan 3794a5e39f
Created a csproj to pin test modules and updated build.psm1 accordingly (#8350) 2018-11-30 11:49:38 -08:00
Paul Higinbotham 743a964392 Fix Export-ModuleMember bug for scriptblocks having no context (#8363)
Export-ModuleMember cmdlet throws an exception if module functions are exported across language boundaries (Windows only).  But a scriptblock LanguageMode property can be null if the scriptblock is created without a PowerShell context, and this can happen through the PowerShell API called from C#.  In this case Export-ModuleMember throws erroneously when no language mode restrictions are in play.

Fix is to check if LanguageMode is null before comparing context and scriptblock language modes.
2018-11-30 11:45:33 -08:00
Aditya Patwardhan 13e2559392
Fix Get-Help for advanced functions with MAML help content (#8353) 2018-11-30 09:49:32 -08:00
Kirk Munro e721f7bbc3 Debug parameter now sets debugpreference to continue (#8195)
With this commit, users who invoke a command with -Debug will no longer be presented with a prompt asking them if they want to enter a nested prompt, continue execution, or halt execution entirely. Instead, any messages sent to the debug stream will simply be sent to the debug stream and the script will continue execution.
2018-11-30 19:46:51 +05:00
Adam Gauthier 60a4e2f346 Remove workaround for fixed invalid json array deserializing bug (#8346) 2018-11-30 16:49:33 +05:00
Mathias R. Jessen 950377faab Conditionally mark getter/setter implementations virtual in generated classes (#8303)
When implementing interfaces, PowerShell incorrectly produces non-virtual get/set methods for interface-defined properties.
This commit adds a lookup method for interface-defined properties and marks get/set methods for properties with matching signatures virtual.
2018-11-30 16:48:27 +05:00
PRASOON KARUNAN V 6e523f21eb Fix for PSDrive creation with a UNC path with a trailing backslash or forward slash when combined with -Persist (#8305) 2018-11-30 08:49:22 +05:00
Aditya Patwardhan 8c3de33ae1
Update help content for TabCompletion tests only if it does not exist (#8355) 2018-11-29 16:16:36 -08:00
Luke Jeremy 0cc1f06be4 Remove Persist parameter from New-PSDrive on non-Windows platform (#8291) 2018-11-29 19:02:08 +05:00
Paul Higinbotham 06571637e4 Add SkipCA and SkipCN check requirement to WinRM/OMI HTTPS connection (#8279) 2018-11-27 16:16:00 -08:00
Paul Higinbotham 6a388f0b7d Add fix for Start-Job initialization script should not be executed as trusted in system lockdown (#8284) 2018-11-26 10:38:13 -08:00
Joel Sallow (/u/ta11ow) 775552c0f5 Test-Path: Return $false when given an empty or $null -Path/-LiteralPath value (#8080) 2018-11-21 10:08:31 +05:00
Hubert Bukowski a8627b83e5 Token calculation fix for Get-Help executed on ScriptBlock for comment help. (#8238) 2018-11-20 11:11:17 -08:00