bug: Could not load type 'System.Diagnostics.PerformanceCounter'
See original GitHub issueSteps to reproduce
the script error.ps1 is attached.
- download WinSCP .Net assembly from https://winscp.net/download/WinSCP-5.9.6-Automation.zip
- 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”) - copy attached script: error.ps1 inthe the same directory
- 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
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
.NET Core/Framework: Could not load type 'System. ...
Visual Studio caught an exception shown as: System.TypeLoadException: 'Could not load type 'System.Diagnostics.PerformanceCounter' from assembly ...
Read more >Could not load file or assembly 'System.Diagnostics. ...
I have a web in ASP.Net Core (4.6.1 framework) that uses Facebook and MS external login that I created with Visual Studio 2015...
Read more >Fix: The type name 'PerformanceCounter' could not be found ...
Fix: CS1069 The type name ' PerformanceCounter ' could not be found in the namespace ' System. Diagnostics '. This type has been...
Read more >Could not load file or assembly 'System.Diagnostics. ...
Hello, We bought license for DevArt DotConnect Oracle Professional 9.6. Installed successfully and referenced below .dlls from installed folder ...
Read more >Resolve problems related to System.Diagnostics.Tracing ...
Common.targets: Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Diagnostics.Tracing, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
#4306 is tracking the lack of counter CmdLets. I’m not aware of a workaround.
@mi-hol Your effort is truly appreciated. When reviewing comments reported in #4062, people can easily get here via the link to learn more information about the issue.
Thanks for bringing up your concern about this issue being closed. I should have better explained the “why” when closing it. Lesson learned 😃