説明
数か月前に、システムに新しい PowerShell バージョンをインストールしました。それ以来、シェルを使用するたびに奇妙なことが起こります。機能に問題はありませんが、コマンドの実行が終了するたびに赤いエラー メッセージが表示されなければならないため、厄介で悩ましい問題です。
(私は .NET の専門家ではなく、.NET や PowerShell に対して予期しないことをしたことはありません。)
シェルの出力
PS C:\\> my-cmdlet
Cmdlet-Ausgabe...
Der Typeninitialisierer für "System.Management.Automation.HostUtilities" hat eine Ausnahme verursacht.
PS C:\\> _
それはドイツ語版です:
PS C:\\> my-cmdlet
Cmdlet output...
The type initializer for "System.Management.Automation.HostUtilities" threw an exception.
PS C:\\> _
私の質問
これらのエラー メッセージを(PowerShell v3 の機能に問題を起こさずに) 停止する方法はありますか? - ありがとう。
(私の PowerShell に関する詳細情報が必要な場合は、コマンドを作成し、必要な情報を説明してください。)
(聞きたいことが明確になればいいのですが、そうでない場合は、不明な点を説明するコメントを書いてください!)
アップデート:
(Shellin-/実行中の出力$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 %> _
そのドイツ語版:
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 %> _