Windows PowerShell Home
Confusing error message on Start-Transcript if $TRANSCRIPT is not a string
3/10/2014 2:19:29 PM
User(s) can reproduce this bug
Suppose a user defines the variable $TRANSCRIPT which is not a string. Perhaps a user even does not think of transcribing but just uses this variable for something else.
PS> $TRANSCRIPT = 1
Then a user starts transcribing by Start-Transcript and gets this error message:
Start-Transcript : Unable to cast object of type 'System.Int32' to type 'System.String'.
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Start-Transcript], InvalidCastException
+ FullyQualifiedErrorId : System.InvalidCastException,Microsoft.PowerShell.Commands.StartTranscriptCommand
The error message should explain what happens. Namely, by the convention, the cmdlet uses the variable $TRANSCRIPT if it is defined. This has to be mentioned in the error message.
P.S. It is about PS v3.0 (perhaps it is fixed in v4.0, I cannot check this).
How often does this happen?
Have you seen this problem before in this product?
Yes, this happens in previous released versions
to post a comment.
Please enter a comment.
to post a workaround.
Please enter a workaround.
© 2014 Microsoft