Quantcast
Channel: Active questions tagged powershell-3.0 - Stack Overflow
Viewing all articles
Browse latest Browse all 134

PowerShell 3: Every Command Execution Results In "The type initializer [...] threw an exception" Error

$
0
0

Description

I've installed the new PowerShell version on my system a few months ago. Since that, something strange happens every time I use the shell. It doesn't trouble the functionality, but it's troubling and bugging me because every time at the end of a command execution I have to see the a red error message.

(I'm not a .NET expert and I never did something unanticipated to .NET or PowerShell.)

Output Of The Shell

PS C:\\> my-cmdletCmdlet-Ausgabe...   Der Typeninitialisierer für "System.Management.Automation.HostUtilities" hat eine Ausnahme verursacht.PS C:\\> _

That's the German version of:

PS C:\\> my-cmdletCmdlet output...   The type initializer for "System.Management.Automation.HostUtilities" threw an exception.PS C:\\> _

My Question

Is there any way to stop these error messages (without troubling the functionality of PowerShell v3)? - Thanks.

(If you need more information about my PowerShell, please write a command and describe which information you need.)

(I hope it's clear what I wanted to ask. However, if it isn't, please write a comment describing what's unclear!)


UPDATE:

(Shellin-/output while running $error[0].exception.tostring())

PS %> my-cmdletCmdlet-Ausgabe...Der Typeninitialisierer für "System.Management.Automation.HostUtilities" hat eine Ausnahme verursacht.PS %> $error[0].exception.tostring()Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.In Zeile:1 Zeichen:1+ $error[0].exception.tostring()+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId : InvokeMethodOnNullDer Typeninitialisierer für "System.Management.Automation.HostUtilities" hat eine Ausnahme verursacht.PS %> _

That the German version of:

PS %> my-cmdletCmdlet-Output...The type initializer for "System.Management.Automation.HostUtilities" threw an exception.PS %> $error[0].exception.tostring()You cannot call a method on a null-valued expression.On line:1 char:1+ $error[0].exception.tostring()+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException+ FullyQualifiedErrorId : InvokeMethodOnNullThe type initializer for "System.Management.Automation.HostUtilities" threw an exception.PS %> _

Viewing all articles
Browse latest Browse all 134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>