Commit graph

7112 commits

Author SHA1 Message Date
Travis Plunk cee1e54e75
Add ability to cross compile (#9374)
`-CrossGen` won`t work, but this gives basic ability to build for another platform.
This also means you cannot really package for another platform.
2019-04-16 14:14:29 -07:00
Steve Lee 73114ee36c Enable building of msix package (#9289)
Add support in packaging.psm1 to produce a .msix AppX package.  Update the docker image to use the new msix package type.  Update the associated yml files so AzDevOps performs the build.

## PR Context

Enable publishing PSCore6 to Microsoft Store
2019-04-15 17:07:15 -07:00
Travis Plunk 23451ac32f
Create dependabot config.yml (#9368)
Create dependabot config.yml
2019-04-15 11:49:17 -07:00
Tyler James Leonhardt 13fd3af810 New New-PSBreakpoint cmdlet & new -Breakpoint parameter for Debug-Runspace (#8923)
This PR does 4 things:

* Adds a new cmdlet `New-PSBreakpoint` which creates new `Breakpoint` objects and writes them to the pipeline
* Adds a `-Breakpoint` parameter to `Debug-Runspace` which will receive `Breakpoint` objects
* Makes the constructors for `*Breakpoint` public for use with the API
* Makes `Debugger.GetBreakpoint(string id)` and `Debugger.GetBreakpoints()` public since `SetBreakpoints` is public

Note: `New-PSBreakpoint` and `Set-PSBreakpoint` (which already exists) are similar... but `Set-PSBreakpoint` also sets the breakpoints in the _current_ runspace. This is not ideal if we want to set breakpoints in a _different runspace than the current one_.

## PR Context  

The "Attach to process" debugging experience in the PowerShell extension for VSCode is _ok_ but it's not great.

The reason it's not great is due to the `BreakAll` feature of PowerShell debugging which, when you run `Debug-Runspace`, will break at the first piece of code that gets run. This is not ideal when you "Attach to process" _and then_ run your code in the other runspace.

Today, the experience drops you in `PSReadLine`'s psm1 if PSRL is available or in the vscode PowerShell helper psm1.

It's unexpected for the user and not ideal.

This PR will allow the extension to pass in the breakpoints that need to be set initially with `BreakAll` turned off for none of this silly behavior.

### Silly behavior example

If you want a repro, try this:

PowerShell instance 1:
```
Enter-PSHostProcess -Id $otherprocesspid
Debug-Runspace 1
```

PowerShell instance 2:
```
./runfoo.ps1
```

Note that you end up NOT `runfoo.ps1`
2019-04-13 19:14:53 -07:00
ThreeFive-O d67ee7aee3 Style: Match file name casings of C# source files for Utility commands (#9329)
Renames C# source files for `Microsoft.Powershell.Commands.Utility` to follow a common file name casing scheme.

## PR Context

This PR is only a style change and doesn't affect any logic.
2019-04-13 19:05:21 -07:00
Aditya Patwardhan 02974a986d Create test package for macOS on release builds (#9344) 2019-04-13 19:01:28 -07:00
Aditya Patwardhan 0418246682 Make CodeCoverage configuration build portable PDBs (#9346) 2019-04-13 19:00:30 -07:00
Aditya Patwardhan be505772e2 Add AcessToken variable to jobs that perform signing (#9351) 2019-04-13 18:59:51 -07:00
dependabot[bot] 36c0825470 Build(deps): Bump NJsonSchema from 9.13.28 to 9.13.29 (#9349) 2019-04-13 18:58:14 -07:00
Travis Plunk 5913c88aaf
Mark tests in macOS CI which use applescript as pending/inconclusive (#9352)
Mark tests in macOS CI which use applescript as pending/inconclusive
2019-04-12 18:12:29 -07:00
James Truher [MSFT] 1006db647b Reduce time for stack overflow test (#9302)
Create a small class to do the work.
I saw 100x performance improvement in this test.
2019-04-12 14:21:33 -07:00
Sytze Andringa 4884317d00 Added more tests for import-alias by file regarding parsing difficult aliases strings (#9247) 2019-04-11 10:40:24 -07:00
Travis Plunk 35a7978581
Fix version of PowerShellGet in changelog (#9335)
Fix version of PowerShellGet in changelog
2019-04-10 17:57:24 -07:00
Keith Hill d05737a098 Fix help paging issues on macOS/Linux and with custom pager that takes arguments (#9033)
* Pipe help system output through Out-String -Width when not using more

This fixes #7175 by using Out-String to properly wrap text before
sending to less or the user specified PAGER.

* Set the string output width when sending help to pager app

Fix #7175

* Fix #8912 by using PS tokenize to get custom pager cmd & args

* Fix macOS/Linux test failures

* It appears that while running in tests, ConsoleWidth is 0, set min val

* Address PR feedback
2019-04-10 14:17:19 -07:00
Reece Dunham 2d87948d8e Move from npm to Yarn for markdown tests (#9312)
Yarn is better because...
* it validates package checksums
* it has emojis 🤟
* it is faster and employs better caching
2019-04-10 14:16:22 -07:00
dependabot[bot] 46a62991d6 Build(deps): Bump System.Net.Http.WinHttpHandler from 4.5.2 to 4.5.3 (#9333) 2019-04-10 10:27:46 -07:00
Travis Plunk e2bfced875
Update repo for Ubuntu 14.04 EOL (#9324)
Update repo for Ubuntu 14.04 EOL
  - also remove a missed instance of Fedora 27
2019-04-09 17:54:13 -07:00
Ilya aba3bd5df1
Cleanup: sort usings (#9283) 2019-04-09 22:45:26 +05:00
Travis Plunk b990c76992
Add CI for install-powershell.sh and amazon linux (#9314) 2019-04-08 14:45:15 -07:00
Dongbo Wang e299a30128 Fixing test run crash by not passing script block to the callback (#9298) 2019-04-08 11:06:27 -07:00
Travis Plunk 98b2e147c1
Only search for functions in Constrained Language help tests (#9301)
Only search for functions in Constrained Language help tests

## PR Context

Searching for only functions is faster
2019-04-08 11:01:33 -07:00
Christoph Bergmeister [MVP] f5fc0535ac Preserve user shortcuts pinned to Taskbar during MSI upgrade (#9305)
Fixes #8919 

Preserve user shortcuts pinned to Taskbar during MSI upgrade by not removing shortcuts in this case (assuming the user has not changed the installation directory), see https://stackoverflow.com/a/33402698/1810304
This also requires the Guid to not always be re-generated, which PR #7701 originally added to ensure shortcuts get removed when RTM and preview are installed, the underlying problem was rather that RTM and preview shared the same GUIDs, therefore the GUIDs are hard-coded again but different for RTM and preview, therefore the shortcuts will still always get removed on uninstall. But this also means those GUIDs should change when the default installation directory changes, i.e. in PowerShell 7. Should we write the code to already take this into account that it does not get forgotten?

Tested by first reproducing the issue by building installers locally (and bumping the patch version. Then the fix was applied to verify the solution, it. For this to take effect the version from which an MSI is being upgraded must have this fix already, i.e. if this fix got shipped in `6.2.1`, then on upgrading to it, the issue would still occur but when upgrading `6.2.1` to `6.2.2` the shortcut would start being preserved. I am wondering if we could maybe improve this to show effect earlier by trying to extract the used (auto-generated) GUIDs in the `6.2.0` and `6.2.0-rc` packages out and use them...
Please not that we probably need to take this out for `7.0` because the base installation directory will change. This also assumes that the user has not specified a different installation directory on upgrade but this is a bit of an edge case where I think other things might break as well.
2019-04-07 12:25:56 -07:00
Steve Lee b63696572f Fix skipping of tests in RemoteSession.Basic.Tests.ps1 (#9304)
Moved check if able to write to $PSHome as way to skip test to `BeforeAll` which already contained a check if running on Windows.

## PR Context

As part https://github.com/PowerShell/PowerShell/pull/9279, tests were updated to be skipped if the test requires writing to `$PSHome` but is not able to.  However, these tests already had a skip mechanism in place so the additional check caused the test to run when it should have skipped.

Co-authored-by: Travis Plunk <github@ez13.net>
2019-04-05 17:00:41 -07:00
Travis Plunk e10603c4f0
Make sure non-Windows CI fails when a test fails (#9303)
Make sure non-Windows CI fails when a test fails

## PR Context

We discovered that some tests were failing after a PR and the CI was not failing
2019-04-05 15:49:30 -07:00
Ilya 6118c37ce3 Fix stylecop hungarian (#9281)
Add very popular "is" and "_is" prefixes.
2019-04-05 10:56:21 -07:00
Ilya b927c46eb4
Add QuoteFields parameter to ConvertTo-Csv and Export-Csv (#9132) 2019-04-05 22:19:01 +05:00
Steve Lee fbe581134f Add more users to failures detection and fix alias for static analysis (#9292) 2019-04-05 10:01:06 -07:00
Steve Lee b8317de469 Update tests to account for when $PSHOME is readonly (#9279)
Co-Authored-By: SteveL-MSFT <slee@microsoft.com>


Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2019-04-04 23:01:01 -07:00
Staffan Gustafsson 4ec36a0d4a Fixing progress for Get-ComputerInfo (#9236) 2019-04-04 16:15:43 -07:00
Aditya Patwardhan 074b344133
Remove duplicate Policheck task and pin to specific version (#9297) 2019-04-04 16:14:57 -07:00
Joel Sallow (/u/ta11ow) 3f52adb0ae Add Binary Parsing Support & Refactor TryGetNumberValue & ScanNumberHelper (#7993)
Fixes #7557 

* Adds support for binary parsing in format echoing hex: `0b11010110`
  * Works with all existing type suffixes and multipliers.
  * Supports arbitrary length parsing with `n` suffix using BigInteger; details below.
* Adds `NumberFormat` enum to specify hex/binary/base 10 for the tokenizer, replacing old `bool hex`.
* Adds `n` suffix for all numeric literals to support returning value as a `BigInteger` if requested. This bypasses the issue of large literals losing accuracy when they cast through `double`.
* Adds tests for all new behaviours.

---

### Binary / Hex Parsing Implementation

* Mimics old sign bit behaviour for int and long types. Sign bits accepted for 8 or 16-bit Hex parsing, and 8, 16, 32, 64 for binary.
  * i.e., `0xFFFFFFFF -eq ([int]-1)` and `0xFFFFFFFFFFFFFFFF -eq ([long]-1)`, but suffixing `u` creates `int.MaxValue` and `long.MaxValue`, respectively, instead.
* Sign bits higher than this are accepted for bigint-suffixed numerals:
    * Hex: Bigint-suffixed hex treats the high bit of any literal with a length multiple of 8 as the sign bit
    * Binary: Bigint-suffixed binary accepts sign bits at 96 and 128 chars, and from there on every 8 characters.
    * Prefixing the literal with a 0 will bypass this and be treated as unsigned, e.g. `0b011111111`
* Specifying an `u`nsigned suffix (or combination suffix that includes `u`) ignores sign bits, similar to how parsing a hex string using `[Convert]::ToUint32()` would do so.
* Supports negating literals using `-` prefix. This can result in positive numbers due to sign bits being permitted, just like hex literals.

---

### Refactored numeric tokenizer parsing

**New flow:**

1. Check for `real` (`.01`, `0.0`, or `0e0` syntaxes)
    1. If the decimal suffix is present, TryParse directly into decimal. If the TryParse fails, TryGetNumberValue returns `false`.
    2. TryParse as `Double`, and apply multiplier to value. If the TryParse fails, TryGetNumberValue returns `false`.
        1. Check type suffixes and attempt to cast into appropriate type. This will return `false` if the value exceeds the specified type's bounds.
        2. Default to parsing as `double` where no suffix has been applied.
2. Check number format.
    * If binary, manually parse into BigInteger using optimized helper function to directly construct the BigInteger bytes from the string.
    * If hex, TryParse into `BigInteger` using some special casing to retain original behaviours in int/long ranges.
    * If neither binary nor hex, TryParse normally as a `BigInteger`.
3. Apply multiplier value before attempting any casts to ensure type bounds can be appropriately checked without overflows.
4. Check type suffixes.
    * If a specific type suffix is used, check type bounds and attempt to parse into that type.
      * If the value exceeds the type's available values, the parse fails. Otherwise, a straight cast is performed.
5. If no suffix is used, the following types are bounds-checked, in order, resulting in the first successful test determining the type of the number. 
    * `int`
    * `long`
    * `decimal` (base-10 literals only)
    * `double` (base-10 literals only)
    * ~~`BigInteger` for binary or hex literals.~~ If the value is outside `long` range (for hex and binary) or `double` range (for base 10), the parse will fail; higher values must be explicitly requested using the `n`/`N` BigInteger suffix.

---

*This is a breaking change* as binary literals are now read as numbers instead of generic tokens which could potentially have been used as function / cmdlet names or file names.

Notes:
* Binary literal support was approved by the committee in #7557 
* ~~The same issue is still under further discussion for underscore support in numeric literals and whether BigInteger parsing ought to be exposed to the user at all.~~
    * ~~Supporting underscore literals is a further breaking change causing some generic tokens like `1_000_000` to be read as numerals instead.~~ Per @SteveL-MSFT's [comment](https://github.com/PowerShell/PowerShell/pull/7993#issuecomment-442651543) this proposal was rejected.
    * ~~Removing underscore support or preventing standard parsing from accepting BigInteger ranges is a relatively trivial matter. It is my personal opinion that there is no particular reason *not* to hand the user a BigInteger when they enter a sufficiently large literal, but I will defer to the PowerShell Committee's judgement on this.~~
2019-04-03 15:10:02 -07:00
Aditya Patwardhan 4bd41e836c
Publish windows daily build to MyGet (#9288) 2019-04-03 13:22:51 -07:00
Dongbo Wang 74b71f2f39 Style: Update StyleCop rules (#8500) 2019-04-03 10:09:56 +05:00
dependabot[bot] 2b4fe626b7 Build(deps): Bump Microsoft.CodeAnalysis.CSharp from 2.10.0 to 3.0.0 (#9277) 2019-04-02 16:50:14 -07:00
Aditya Patwardhan 28ec8ac831 Fix build order in windows-daily build (#9275)
The windows-daily build had a bug which caused the packaging builds to be kicked off before tests. This PR fixes the build order.

## PR Context

Fix for failing daily build.
2019-04-02 14:25:36 -07:00
Aditya Patwardhan 4b5fe2e72b
Fix variable name in windows-daily.yml (#9274) 2019-04-02 12:45:01 -07:00
Aditya Patwardhan 10fa1fc1dd
Move artifacts to artifact staging directory before uploading (#9273) 2019-04-02 11:56:48 -07:00
Travis Plunk 5e4b4d1351 Make command searcher not use wildcard search for execution (#9202) 2019-04-02 11:54:11 -07:00
Travis Plunk b7c7aa176e
Make install-powershell.ps1 work on Windows Server 2012 R2 (#9271) 2019-04-02 10:39:09 -07:00
Rene Hernandez 75da390d1e Add ItemSeparator and AltItemSeparator properties in ProviderInfo (#8587)
Add two properties in `ProviderInfo` class: `ItemSeparator` and `AltItemSeparator`.
On windows, the default values for those two properties are `ItemSeparator = '\'` and `AltItemSeparator = '/'`.
On unix, the default values for those two properties are `ItemSeparator = '/'` and `AltItemSeparator = '\'`.

Registry provider is the only exception, both properties for it have the value `\`.
2019-04-02 09:59:36 -07:00
Aditya Patwardhan 34fa5e472d
Fix publishing daily nupkg to MyGet (#9269) 2019-04-01 16:58:43 -07:00
James Truher [MSFT] 2f0d127ef8 Check to be sure that the test result file has actual results before uploading (#9253)
VSTS produces a warning if the result set is 0, we will skip uploading this to avoid the warning and better support automation scenarios.

## PR Context

We have automation which checks our test results and if the result set is 0 for that file, a warning is produced. This PR will avoid uploading that file into the test results (which is valid, as there are no run tests). We will still add the file to our artifact list for completeness.
2019-04-01 16:47:55 -07:00
Steve Lee 8a0ecaf620 Add timestamp to pshost trace listener (#9230)
Static analysis CI was executed separately.
2019-04-01 13:27:41 -07:00
dependabot[bot] 4005f50faa Build(deps): Bump NJsonSchema from 9.13.27 to 9.13.28 (#9265)
Bumps [NJsonSchema](https://github.com/rsuter/NJsonSchema) from 9.13.27 to 9.13.28.
- [Release notes](https://github.com/rsuter/NJsonSchema/releases)
- [Commits](https://github.com/rsuter/NJsonSchema/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-01 22:26:16 +05:00
Travis Plunk f649751ed2
Update release process template to clarify that most tasks are coordinated by the release pipeline (#9238)
Co-authored-by: Reece Dunham <me@rdil.rocks>
2019-03-30 16:09:54 -07:00
Travis Plunk 14980aa943
Add secret scanning to CI (#9249)
Add secret scanning to CI

## PR Context

This should prevent us from having any secrets in our history
2019-03-30 10:17:25 -07:00
ThreeFive-O 665cd26ab0 Fix several problems in WritingPesterTests guideline (#9078) 2019-03-29 15:29:41 -07:00
pougetat 0ee5278b40 Fix Get-Module -FullyQualifiedName option to work with paths (#9101) 2019-03-29 15:27:09 -07:00
Travis Plunk 17f5a5ccbe
Add component detection to all jobs (#8964)
Add component detection to all jobs.
2019-03-29 15:18:55 -07:00
Aditya Patwardhan 8beacd1f7f Update ChangeLog for 6.2.0 (#9245)
Update the change log for 6.2.0 in master
2019-03-28 13:54:55 -07:00