Commit Graph
202 Commits
Author SHA1 Message Date
Jordan Borean c6329ddd54 Add MethodInvocation trace for overload tracing (#21320) 2025-07-14 15:42:14 -07:00
Matthias Wolf eb1cc6ddcd Make inherited protected internal instance members accessible in PowerShell class scope (#25245) 2025-05-12 14:30:12 -07:00
Staffan Gustafsson 9cbbb8ff32 Add PSForEach and PSWhere as aliases for the PowerShell intrinsic methods Where and Foreach (#25511) 2025-05-05 17:13:02 -07:00
Dongbo Wang a6005f3879 Move .NET method invocation logging to after the needed type conversion is done for method arguments (#25022) 2025-03-18 11:43:44 -07:00
Patrick Meinecke 36740ab4a2 Assign the value returned by the MaybeAdd method 2024-12-11 15:31:04 -05:00
Jordan Borean 06e2093e8c Change call to optional add in the binder expression 2024-12-09 14:35:05 -05:00
Jordan Borean 89921dd500 Turn off AMSI member invocation on nix release builds
Turn off the AMSI member invocation logging for non-Windows release
builds. This is slightly more efficient as there's no extra work to
create the AMSI string.
2024-12-09 14:35:05 -05:00
Jordan Borean ecdf7805ca Fix up .NET method invocation with Optional argument (#21387) 2024-07-01 15:46:39 -07:00
Jordan Borean 6c66879c92 Optimize the += operation for a collection when it's an object array (#23901) 2024-06-17 16:23:04 -07:00
167a492415 Redirecting to a variable should be possible (#20381)
* add tests

* fix formatting issues

* Make redirection to variable an experimental feature.

Update test to check for experimental feature status.
Set-Variable will still have the -append parameter, but if used when the experimental feature is disabled, a parameter binding error will result.

* Check to be sure provider is not null.

* update to use different FullyQualifiedErrorId

* use Experimental attribute for append parameter rather than runtime check.

* Revert "update to use different FullyQualifiedErrorId"

This reverts commit 8b34af1ac19ecdb821b34534e446ab129830c92f.

* Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs

Co-authored-by: Ilya <darpa@yandex.ru>

* Move remediation steps into resource.

Update Set-Variable -Append to be correct when -name and -value are used.
Add tests for the new behavior in Set-Variable.

* Change expected error for contrained language mode and redirection.

* Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs

Co-authored-by: Ilya <darpa@yandex.ru>

* Support redirection of native app.

Add tests to validate.

* testexe needs proper case to run on linux.

* Address codefactor issues 01.

* Update src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs

Co-authored-by: Steve Lee <slee@microsoft.com>

* Update src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs

Co-authored-by: Steve Lee <slee@microsoft.com>

* Update src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs

Co-authored-by: Steve Lee <slee@microsoft.com>

---------

Co-authored-by: Ilya <darpa@yandex.ru>
Co-authored-by: Steve Lee <slee@microsoft.com>
2024-06-11 12:42:04 -04:00
Dongbo Wang 7d62cf54ac Fix 4 issues for the WDAC logging feature (#20913) 2023-12-13 11:46:21 -08:00
James Truher [MSFT] 77e8021256 Set experimental features to stable for 7.4 release (#20285) 2023-09-22 17:01:22 -07:00
Ikko Eltociear Ashimine ad1d9763f9 Fix typo in Binders.cs (#20147)
defered -> deferred
2023-08-21 18:09:00 +05:00
Aditya Patwardhan ebe0b54340 Update to .NET 8 Preview 4 (#19696) 2023-06-21 15:17:22 -07:00
Berkan Diler 0f53e80335 Make use of the new Random.Shared property (#18417) 2023-06-12 17:31:04 -07:00
CarloToso 0b42d92d4d six files (#19695) 2023-05-25 10:12:42 -07:00
Paul Higinbotham e5728b63bf Add WDAC Audit logging (#19641) 2023-05-22 16:40:55 -07:00
Patrick Meinecke 2424ad83aa Support byte stream piping between native commands and file redirection (#17857) 2023-04-27 17:17:32 -07:00
CarloToso 69e9b439fd Fix codefactor if part 5 (#19286) 2023-03-16 22:02:42 +05:00
CarloToso 0d6b93a23f Fix codefactor if part 2 (#19267) 2023-03-04 22:30:14 +05:00
Dongbo Wang 3cdd1fa6ef Revert "Use ArgumentNullException.ThrowIfNull part 2 (#19258)" (#19263)
This reverts commit 8d8f45e3df.
2023-03-02 12:00:23 -08:00
CarloToso 8d8f45e3df Use ArgumentNullException.ThrowIfNull part 2 (#19258) 2023-03-02 22:29:46 +05:00
Dongbo Wang ef0af95845 Make the exception error in PowerShell able to associate with the right history entry (#19095) 2023-02-08 10:18:32 -08:00
spaette ec0eb22062 Fix typos in comments (#19064) 2023-02-03 10:40:43 +05:00
spaette d29f34b5c2 typos (#19058) 2023-01-30 09:48:00 -08:00
Dongbo Wang b195088c5a Revert some of the interpolated string changes (#19018) 2023-01-25 09:46:47 -08:00
CarloToso 33ba57387d Use interpolated strings 12 (#19003) 2023-01-23 22:35:20 +05:00
CarloToso c156c9cadb Use interpolated strings 4 (#18980) 2023-01-21 21:27:21 +05:00
CarloToso a01fb37243 Use interpolated strings 8 (#18988) 2023-01-20 09:50:51 +05:00
Steve Lee 27b5a0632d Add -ProgressAction common parameter (#18887) 2023-01-09 09:40:40 -08:00
James Truher [MSFT] 4f57804f46 Fix up all comments to be in the proper order with proper spacing (#18619) 2023-01-03 12:12:42 -08:00
CarloToso 2ddc63f151 Replace ArgumentNullException(nameof()) -> ArgumentNullException.ThrowIfNull() (#18784) 2022-12-14 18:30:33 +05:00
Dongbo Wang ae3c3169ee Fix SuspiciousContentChecker.Match to detect a pre-defined string when the text starts with it (#18693) 2022-12-01 22:26:43 -08:00
Dongbo Wang 79b8140199 Make PowerShell class not affiliate with Runspace when declaring the NoRunspaceAffinity attribute (#18138) 2022-09-22 10:49:08 -07:00
Dongbo Wang 1a82574743 Treat [NullString]::Value as the string type when resolving methods (#18080) 2022-09-15 17:35:56 -07:00
Steve Lee ce746969ab Make experimental feature PSAMSIMethodInvocationLogging stable (#18041) 2022-09-12 09:20:20 -07:00
Dongbo Wang 3fbd90a4b0 Handle PSObject argument specially in method invocation logging (#18060) 2022-09-12 09:15:14 -07:00
Frode Flaten 4b4f1d144f Use null propagation operator in /engine (#17789) 2022-07-29 09:06:07 +05:00
Dmitry Volodin 9fe96f3c20 Use compound assignment in /interpreter and /runtime (#17727) 2022-07-25 16:55:56 -07:00
MartinGC94 edac193cf0 Use discards for unused variables (#17620) 2022-07-05 14:26:51 -07:00
Dongbo Wang 36fcec3bdd Fix ForEach method to set property on a scalar object (#17213) 2022-05-02 10:07:12 -07:00
Dongbo Wang b898da8842 Make a variable assignment in a ParenExpression to return the variable value (#17174) 2022-04-22 10:55:38 -07:00
Dongbo Wang a3c4a163ff Allow the PSGetMemberBinder to get value of ByRef property (#16956) 2022-03-04 15:01:18 -08:00
ayousuf23 31c14f2ad3 Updated background invocation & operator to use -WorkingDirectory when starting a new job (#16180) 2022-02-21 10:02:30 -08:00
Paul Higinbotham 0834c65877 Add AMSI method invocation logging as experimental feature (#16496)
* Add AMSI method invocation logging as experimental feature

* Add fix for value type errors in logging expression

* Fix recursion error
2022-01-04 08:30:14 -08:00
Paul Higinbotham cadd5762ea Fix ForEach-Object -Parallel when passing in script block variable (#16564)
ForeEach-Object -Parallel using variable processing walks the script block AST to determine if the using variable was defined in the current scope, and does this by tracking the number of 'ForEach-Object -Parallel' commands in the call chain.
However, the provided script block is different, depending on whether it is passed in as a variable or via parameter binding.

$myScript = '"Hello!"'
1 | ForEach-Object -Parallel ([scriptblock]::Create($myScript))
# Script block Ast does not contain the 'ForEach-Object' command in the call chain

1 | ForEach-Object -Parallel { "Hello!" }
# Script block Ast does contain the 'ForEach-Object' command in the call chain

This change takes into account the two forms of script blocks
2021-12-14 08:11:19 +05:00
Dongbo Wang a32700a1c1 Add clean block to script block as a peer to begin, process, and end to allow easy resource cleanup (#15177) 2021-10-11 14:49:09 -07:00
Dongbo Wang 286f12a37c Update .NET adapter to handle interface static members properly (#15908) 2021-08-14 07:56:14 -07:00
xtqqczze 883ca98dd7 Seal private classes (#15725)
* Seal private classes

* Fix CS0509

* Fix CS0628
2021-07-19 14:09:12 +05:00
xtqqczze 4c2d6dcfca Make classes sealed (#15675)
Fix [RCS1225](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1225.md)
2021-07-04 16:49:52 +05:00