Skip to content

bug: Could not load type 'System.Diagnostics.PerformanceCounter' #4295

@mi-hol

Description

@mi-hol

Steps to reproduce

the script error.ps1 is attached.

  1. download WinSCP .Net assembly from https://winscp.net/download/WinSCP-5.9.6-Automation.zip
  2. unzip in a directory named C:\PS_B4)
    Note:
    in case a different directory name is choosen, script code below needs to be adapted before running it!
    $WinSCPnet_dll = ("C:\PS_B4\WinSCPnet.dll")
  3. copy attached script: error.ps1 inthe the same directory
  4. run powershell.exe
    .\error.ps1

Expected behavior

no error

and text:
script: ended successfully

Actual behavior

error gets

thrown:

Exception calling ".ctor" with "0" argument(s): "Could not load type 'System.Diagnostics.PerformanceCounter' from assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'."

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.4
OS                             Microsoft Windows 10.0.14393
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-ExternalThe issue is caused by external component(s).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions