Repository navigation
Start-Transcript throws when $Transcript is a PSObject wrapped string #24740
Description
Activity
- addedNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.
on Jan 5, 2025 Patrick Meinecke (@SeeminglyScience) mentioned in PowerShell discord that a workaround can be performed by adding this line,
$Transcript = [string]$Transcriptafter setting up the preference variable shown in example #3 of the PowerShell help docs. I can confirm this does work under Windows and Linux.SeeminglyScience commented
on Jan 5, 2025 ContributorMore actionsStart-Transcriptsupports tilde, the issue is that the variable's value is wrapped in aPSObjectand the code doesn't handle it.PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs
Line 180 in c0d7fb7
_outFilename = (string)value; This line should be
_outFilename = (string)PSObject.Base(value);Reacted by Bill Kindle, Michael Klement, Armaan Mcleod and Santiago Squarzon- changed the title
[-]Start-Transcript doesn't support a path that starts with '~\'[/-][+]`Start-Transcript` throws when `$Transcript` is a `PSObject` wrapped `string`[/+]on Jan 5, 2025 - addedIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsand removedNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.
on Jan 8, 2025 - addedIn-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issue
on Feb 6, 2025 microsoft-github-policy-service commented
on Feb 7, 2025 ContributorMore actions📣 Hey Bill Kindle (@billkindle), how did we do? We would love to hear your feedback with the link below! 🗣️
🔗 https://aka.ms/PSRepoFeedback
Prerequisites
Steps to reproduce
First bug report I've filed for PowerShell ever, so go easy on me :-). Here's the PowerShell doc's Github issue I had raised that is now closed with the suggestion of filing a bug report.
I believe I've stumbled upon a bug with Start-Transcript when using one of the Start-Transcript examples when using preference variables in PowerShell 7.4.6 (on Windows and Linux) when using '~' in the path.
Using
Start-Transcriptafter using the example #3 in the docs, I get an error:However, if I use
Start-Transcript $Trasncript, the command works and a transcript is created without issue. I do not get this error using the example with a UNC path or full local path. It seems to only happen when using '~' in both Windows and Linux.Expected behavior
Actual behavior
Error details
Environment data
Visuals
No response