59 Commits
Author SHA1 Message Date
github-actions[bot] 476b0c5d12 [release/v7.3.0-rc.1] Remove the ProcessorArchitecture portion from the full name as it's obsolete (#18381) 2022-10-25 12:45:42 -07:00
Dongbo Wang 38bf778b37 Re-enable the test TestLoadNativeInMemoryAssembly (#17738) 2022-07-21 14:51:22 -07:00
Paul Higinbotham a8d55851e0 Add the -ConfigurationFile command line parameter to pwsh to support local session configuration (#17447) 2022-06-06 12:12:53 -07:00
Aditya Patwardhan 1268a0a04f Update .NET to 7.0.0-preview.2 build (#16930) 2022-03-18 09:10:53 -07:00
Maksim Ivanyuk 674ef888a2 Add -HttpVersion parameter to web cmdlets (#15853) 2021-11-02 16:53:36 -07:00
6933c5b473 Only allow -File to accept .ps1 scripts on Windows (#15859)
Co-authored-by: Ilya <darpa@yandex.ru>
Co-authored-by: Paul Higinbotham <paulhi@microsoft.com>
2021-08-03 13:43:00 -07:00
xtqqczze 03b07a0062 Enable IDE0044: MakeFieldReadonly (#13880)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0044
2021-07-07 09:33:19 +05:00
xtqqczze 8337d2afd6 Fix CA1839: Use 'Environment.ProcessPath' (#15650) 2021-06-25 08:56:55 +05:00
Andrew 8d017d8a75 Move cross platform DSC code to a subsystem (#15127) 2021-05-20 17:06:59 -07:00
Dongbo Wang 5febcad3db Update prediction interface to provide additional feedback to a predictor plugin (#15421) 2021-05-20 15:52:13 -07:00
Marc-André Moreau 8f8ddc3fb7 Add LoadAssemblyFromNativeMemory function to load assemblies from memory in a native PowerShell host (#14652) 2021-04-28 14:28:41 -07:00
Steve Lee fc1d5ef096 Default to MTA on Windows platforms where STA is not supported (#15106) 2021-04-22 08:38:13 -07:00
David Bar-On 20d917c086 Fix issue #12013 - not allow mixed dash and slash in command line parameter prefix (#15142) 2021-04-13 13:20:28 -07:00
Dongbo Wang e803d3bc8d Update the ICommandPredictor to provide more feedback and also make feedback easier to be corelated (#14649) 2021-02-04 15:34:17 -08:00
xtqqczze aecada3e67 Enable CA1822: Mark private members as static (#13897) 2020-12-09 11:04:23 -08:00
xtqqczze c7bdb24ff3 Mark local variable as const (#13217)
RCS1118: Mark local variable as const https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1118.md
2020-11-24 20:06:16 +05:00
xtqqczze 358db74479 Enable CA1816: Dispose methods should call SuppressFinalize (#14074)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1816
2020-11-24 09:29:15 +05:00
xtqqczze f14c76aab9 Enable SA1516: Elements should be separated by blank line (#14137)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1516.md
2020-11-20 16:11:36 +05:00
xtqqczze 006fe4d2dd Enable IDE0082: ConvertTypeOfToNameOf (#14042)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0082
2020-11-16 19:56:07 +05:00
xtqqczze e7232b89c9 Fix PriorityAttribute name (#14094)
Fix regression after #13496
2020-11-15 16:31:50 +05:00
Ilya d9090b4a49 Write better error message if config file is broken (#13496) 2020-11-13 17:22:26 -08:00
xtqqczze 47c92090db Enable CA1068: CancellationToken parameters must come last (#13867)
* Enable CA1068: CancellationToken parameters must come last
2020-11-05 09:08:28 +05:00
xtqqczze 1d7a93c2e0 Enable CA1825: Avoid zero-length array allocations (#13961) 2020-11-04 08:56:26 +05:00
xtqqczze a2a938e964 Fix IDE0044: MakeFieldReadonly part 10 (#13893)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0044
2020-10-30 12:20:06 +05:00
xtqqczze 9932560841 Enable CA1050: Declare types in namespaces (#13872) 2020-10-26 22:34:26 +05:00
Ilya 3b83a686a1 Add null check for args in CommandLineParser (#13451) 2020-08-28 12:03:30 -07:00
Dongbo Wang 6615fa3df6 Fix test hooks for CommandLineParameterParser (#13459) 2020-08-21 11:59:30 -07:00
Dongbo Wang fc4c9cbfd7 Initial work of the subsystem plugin model (for minimal powershell) (#13186) 2020-08-20 17:41:44 -07:00
Ilya 68d46c1792 Refactor command line parser to do early parsing (#11482) 2020-08-12 09:58:46 -07:00
Dongbo Wang 4464d1b414 Add DefaultVisit method to the visitor interface and class (#13258) 2020-07-31 10:16:59 -07:00
Dongbo Wang 4b9b0788ed Revert "Use is null syntax (#13277)" (#13322)
This reverts commit 6c03776d74.
2020-07-30 16:06:38 -07:00
xtqqczze 7beec89f50 Add copyright header to .editorconfig and update files (#13306) 2020-07-30 09:47:21 -07:00
xtqqczze 6c03776d74 Use is null syntax (#13277)
Replace `== null` with `is null`
2020-07-30 18:04:03 +05:00
xtqqczze 8901d2a509 Cleanup: use int instead of uint in places where it's more appropriate (#13141) 2020-07-13 07:10:57 -07:00
xtqqczze 05cab7fa5a Formatting: Add empty line between declarations (#12824)
# PR Summary

Automated fixes:
* RCS0013: Add empty line between single-line declarations of different kind
* RCS010: Add empty line between declarations

## PR Context


## PR Checklist

- [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
    - Use the present tense and imperative mood when describing your changes
- [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---work-in-progress).
    - If the PR is work in progress, please add the prefix `WIP:` or `[ WIP ]` to the beginning of the title (the `WIP` bot will keep its status check at `Pending` while the prefix is present) and remove the prefix when the PR is ready.
- **[Breaking changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)**
    - [x] None
    - **OR**
    - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md)
        - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here -->
- **User-facing changes**
    - [x] Not Applicable
    - **OR**
    - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
        - [ ] Issue filed: <!-- Number/link of that issue here -->
- **Testing - New and feature**
    - [x] N/A or can only be tested interactively
    - **OR**
    - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting)
- **Tooling**
    - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
    - **OR**
    - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include:
        - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) for VSCode (which runs in a different PS Host).
        - Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features.
        - Impact on [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions).
        - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).
2020-05-29 04:56:33 +00:00
Steve Lee b7cb335f03 Update copyright notice to latest guidance (#12190) 2020-03-24 11:08:37 -07:00
John Dennis 895d4b3f3e Allow cross-platform CAPI-compatible remote key exchange (#11185) 2020-02-19 12:28:43 -08:00
xtqqczze a34d0f3e80 Reformat code according to EditorConfig rules (#11681) 2020-01-31 14:56:22 -08:00
Dongbo Wang 7772418dec Update PSConfiguration.ReadValueFromFile to make it faster and more memory efficient (#10839) 2019-10-30 14:44:34 -07:00
Dongbo Wang e1203aa31b Skip the flaky test 'TestAppDomainProcessExitEvenHandlerNotLeaking' for now (#10827) 2019-10-17 17:39:14 -07:00
Dongbo Wang 48db3de03e Make the event handler leaking test stable (#10790) 2019-10-16 09:55:41 -07:00
Dongbo Wang 60a930c9ba Add test for the even handler leaking fix (#10768)
Add a test for the even handler leaking fix addressed in #10626 https://github.com/PowerShell/PowerShell/pull/10626
The test is added to verify that PowerShell unregister the 'AppDomain.ProcessExit' event handler when a Runspace closes.
2019-10-11 23:34:53 +05:00
Dongbo Wang ec105da3f1 Some code cleanup work (#10698)
* Move Utils.GetUserConfigurationDirectory to Platform.ConfigDirectory
* Unify the use of Platform.ConfigDirectory and Platform.CacheDirectory
2019-10-07 14:15:01 +05:00
Kirk Munro cc0fed479a Add APIs for breakpoint management in runspaces and enable attach to process without BreakAll for PSES (#10338) 2019-09-05 11:30:25 -07:00
Ilya cf7699b4b9 Add tests for WildcardPattern.Escape() and Unescape() (#10090) 2019-08-07 13:25:10 -07:00
Ilya 2be3db8ab8 Cleanup unused pinvokes on unix (#9531)
* Remove TemporaryDirectory()
* Remove GetUserName()
* Use Environment.UserName on Unix
* Remove old comment
* Use Environment.UserName on Windows too
2019-05-07 10:22:01 +05: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
Ilya cc6540b614 Cleanup style issues in CoreAdapter and MshObject (#9190) 2019-03-23 09:52:30 +05:00
Staffan Gustafsson 42c289fc8e Improve formatting performance by having better primitives on PSObject (#8785)
By not doing excessive amounts of extra work, formatting can be sped up quite significantly (about 8x faster).
The main change comes from adding new, more efficient, primitive to query an object for the existence of an instance member.
The formatting system has been checking for if an object has properties other than some decorated properties added by PS remoting, and it doesn't this by retrieving all properties which results in heavy allocations and wasted cycles.
By adding `GetFirstOrDefault` to `PSObject` and similar primitives to the underlying Adapters, we are able to return early, without having to get all properties back.
2019-03-20 18:43:52 -07:00
Dongbo Wang 24d3152f00 Make Start-Job throw terminating exception when -RunAs32 is specified in 64-bit pwsh (#9143) 2019-03-18 10:23:29 -07:00