Skip to content

Adding PlatformNotSupportedException to Counter cmdlets when running on IoT.#2952

Merged
lzybkr merged 2 commits into
PowerShell:masterfrom
Francisco-Gamino:counter-cmdlets-fix
Jan 6, 2017
Merged

Adding PlatformNotSupportedException to Counter cmdlets when running on IoT.#2952
lzybkr merged 2 commits into
PowerShell:masterfrom
Francisco-Gamino:counter-cmdlets-fix

Conversation

@Francisco-Gamino
Copy link
Copy Markdown
Contributor

We have enabled the Counter cmdlets for PowerShell on OneCore for Windows. This means that these cmdlets are available Full Desktop with CoreCLR, Nano Server and IoT. However, one of the dependencies, the '$env:windir\System32\pdh.dll' assembly, is not available on IoT. Because of this, when the user tries to use the Counter cmdlets on IoT, they will get a PlatformNotSupportedException.

This PR includes the code change and new test cases to validate that PlatformNotSupportedException is thrown on IoT.

Copy link
Copy Markdown
Contributor

@lzybkr lzybkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing a test in Export-Counter.Tests.ps1

@PowerShellTeam PowerShellTeam added the Review - Needed The PR is being reviewed label Jan 4, 2017
@Francisco-Gamino
Copy link
Copy Markdown
Contributor Author

@lzybkr: Thanks for review. In order to run the Export-Counter cmdlet, you need to create a counter (which is not possible on IoT), this is the reason why there is not test for this scenario.
The command would be something like this: Get-Counter | Export-Counter .


Describe "Get-Counter cmdlet does not run on IoT" -Tags "CI" {

It "Get-Counter throws PlatformNotSupportedException" -Skip:$(-not [System.Management.Automation.Platform]::IsIoT) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We skip all counter test for Linux, IOS and IoT. Why do we test the throw only for IoT?

Copy link
Copy Markdown
Contributor Author

@Francisco-Gamino Francisco-Gamino Jan 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @iSazonov. The Counter cmdlets are present on CoreCLR for Windows systems only (which are Desktop with CoreCLR, Nano Server and IoT). On GitHub, we run our tests against Desktop, OSX, and Linux (Ubuntu). Because of this, almost all tests (with the exception of these two in this PR) will be skipped.
Going back to your question, we only throw on IoT because '$env:windir\System32\pdh.dll' is not present. Also, these cmdlets are not available on OSX and Ubuntu, so there is nothing to test there. I hope this make sense. Thanks.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Francisco-Gamino Thanks for clarification!

@lzybkr lzybkr merged commit 66691a1 into PowerShell:master Jan 6, 2017
rjmholt pushed a commit to rjmholt/PowerShell that referenced this pull request Jan 9, 2017
…on IoT. (PowerShell#2952)

* Adding PlatformNotSupportedException to *-Counter cmdlets for IoT as pdh.dll is not available.
* Adding tests to validate PlatformNotSupportedException for the Counter cmdlets on IoT.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants