| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Dongbo Wang (@daxian-dbw) Can you please review these changes? |
Sorry, something went wrong.
There was a problem hiding this comment.
One comment, otherwise looks fine to me
Sorry, something went wrong.
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
Sorry, something went wrong.
|
Restarted CIs for what looks like unrelated failures in Update-Help tests. |
Sorry, something went wrong.
|
Paul Higinbotham (@PaulHigin) it would be good to fix CodeFactor violations in the new code that is added; thank you. |
Sorry, something went wrong.
|
Restarted CIs again. |
Sorry, something went wrong.
|
One more time restarted CIs. |
Sorry, something went wrong.
|
🎉v7.2.0-preview.3 has been released which incorporates this pull request.:tada: Handy links: |
Sorry, something went wrong.
|
Paul Higinbotham (@PaulHigin) - Should this be backported to 7.1.x? |
Sorry, something went wrong.
|
Aditya Patwardhan (@adityapatwardhan) I think the impact of this change is small, since if involves nested foreach calls. So I would say it does not need to be backported as it probably does not affect a lot of users. |
Sorry, something went wrong.
|
Removed the back port label as per comment from Paul Higinbotham (@PaulHigin) |
Sorry, something went wrong.
|
This is not unique to parallel foreach, it applies to nested start-job and nested invoke-command calls (double-hop) or any combination of those, like using invoke-command and then running start-job in the remote session, etc. Does this fix work for these scenarios as well (everywhere $using is supported) or was this somehow scoped to parallel foreach? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
This fixes a bug in ForEach-Object -Parallel where a using variable in a nested ForEach-Object -Parallel throws an error even when the variable is defined in the correct scope (Issue #11817).
PR Context
This error was occurring because, when ForEach-Object -Parallel was assembling the user variable map, it was searching all nested scriptblocks within the ForEach scriptblock, with the result of finding nested using variables where the variable had not yet been defined. Since the nested scriptblock using variable had not been defined in the current scope, a mapping error was thrown.
Fix is to change the using variable map function to not search nested scriptblocks in the ForEach -Parallel case. This way foreach -parallel using variable mapping is always performed only for the current scope.
Many thanks to Michael Klement (@mklement0) for pointing out the fix.
PR Checklist