Description
I installed a new version of PowerShell on my system a few months ago. Since then, something strange happens every time I use the shell. This does not interfere with functionality, but it bothers and challenges me because every time at the end of the command I should see a red error message.
(I am not a .NET expert, and I have never done anything unexpected for .NET or PowerShell.)
Shell output
PS C:\\> my-cmdlet Cmdlet-Ausgabe... Der Typeninitialisierer für "System.Management.Automation.HostUtilities" hat eine Ausnahme verursacht. PS C:\\> _
What is the German version:
PS C:\\> my-cmdlet Cmdlet output... The type initializer for "System.Management.Automation.HostUtilities" threw an exception. PS C:\\> _
My question
Is there a way to stop these error messages (without disturbing the functionality of PowerShell v3)? - Thanks.
(If you need more information about my PowerShell, write a command and specify what information you need.)
(I hope I understand what I want to ask. However, if this is not the case, write a comment that describes what is unclear!)
UPDATE:
(Shell / exit when running $error[0].exception.tostring() )
PS %> my-cmdlet Cmdlet-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 : InvokeMethodOnNull Der Typeninitialisierer für "System.Management.Automation.HostUtilities" hat eine Ausnahme verursacht. PS %> _
What is the German version:
PS %> my-cmdlet Cmdlet-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 : InvokeMethodOnNull The type initializer for "System.Management.Automation.HostUtilities" threw an exception. PS %> _