GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — Add 5 'InvokeAsync' overloads and 'StopAsync' to the 'PowerShell' type by KirkMunro · Pull Request #8056 · PowerShell/PowerShell Conversation
|
|
Note that I have not added unit tests yet for this PR. I looked to see where BeginInvoke and EndInvoke were tested, and they are included as part of a Pester test; however, PowerShell does not support async/await, so Pester does not appear to be an appropriate test framework for these changes. Please identify how these new methods should be automatically tested. I haven't added C# unit tests to this repo yet, so I'm not sure how I should proceed. Thank you. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Kirk Munro (@KirkMunro) Have you any gists with demo? It would help to document the enhancement. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't have examples showing how complicated this can be using BeginInvoke/EndInvoke, because I just went straight to defining these locally in projects where I have used async PowerShell invocation since they are just so much simpler, so I don't have a before/after example to show for comparison. Also, the code is so short, I'll just share it here instead of in a gist. Here's a snippet showing what use of this looks like when you want async invocation of PowerShell from a .NET assembly with these additional methods in place: using (var ps = PowerShell.Create()) { ps.AddCommand("Connect-AzureRmAccount") .AddParameter("ServicePrincipal") .AddParameter("TenantId", tenantName) .AddParameter("Subscription", subscriptionId) .AddParameter("Credential", credential); var results = await ps.InvokeAsync(); // Process results } |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Kirk Munro (@KirkMunro) You can add C# tests here: https://github.com/PowerShell/PowerShell/tree/master/test/csharp |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@PowerShell/powershell-committee agree that we should expose a task model for async PowerShell, leaving implementation details to PR review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Bruce Payette (@BrucePay) Can you please review the signature of the proposed task-based async APIs? In committee's discussion on this, there are proposals that we might want to re-implement the async invocation in the task-based model instead of wrapping the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Regarding c# unit tests, I didn't get to them before going on vacation this week, so I'll come back to this PR next week and catch up. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@powershell-maintainers The |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) I'll move the tests over. Thanks for letting me know the correct path for those tests. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Wait. Ilya (@iSazonov), that path doesn't exist in master, so this is a new process then? How are tests under that path executed locally for verification? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Kirk Munro (@KirkMunro) We haven't such tests at all. And my question is for MSFT team where we should place these tests. I point my new unmerged code which have engine API xUnit tests too. I look how CoreFX places API tests and do the same. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) Ok, thanks. I'll wait until the other maintainers discuss with you what should be done with these then, and follow the process accordingly. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Kirk Munro (@KirkMunro) Looks like Ilya (@iSazonov) has created a place for the xUnit tests in #8356 😄 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, binary tests was moved to new folder. Now all tests run parallel (excluding macOS). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You xUnit tests were failing in CIs. Please fix them. I'm also fine that you remove the xUnit tests for this PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I removed them since they were just duplicates of the Pester tests, and I'm not set up at the moment to easily test C# Unit tests (hence the issues with the CI not working). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Pending any further feedback, I think this PR is good to go with enough tests to cover the new Async APIs well enough. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Kirk Munro (@KirkMunro) Thanks for your contribution! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.