-
Notifications
You must be signed in to change notification settings - Fork 238
Closed
Labels
Description
This unit test is currently skipped, indicating a bug in product code:
PowerShellEditorServices/test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs
Lines 964 to 987 in c4f424f
// Verifies fix for issue #86, $proc = Get-Process foo displays just the ETS property set | |
// and not all process properties. | |
[Fact(Skip = "Length of child vars is wrong now")] | |
public async Task DebuggerVariableProcessObjDisplaysCorrectly() | |
{ | |
await debugService.SetLineBreakpointsAsync( | |
variableScriptFile, | |
new[] { BreakpointDetails.Create(variableScriptFile.FilePath, 19) }).ConfigureAwait(true); | |
// Execute the script and wait for the breakpoint to be hit | |
Task _ = ExecuteVariableScriptFile(); | |
AssertDebuggerStopped(variableScriptFile.FilePath); | |
StackFrameDetails[] stackFrames = await debugService.GetStackFramesAsync().ConfigureAwait(true); | |
VariableDetailsBase[] variables = debugService.GetVariables(stackFrames[0].AutoVariables.Id); | |
VariableDetailsBase var = Array.Find(variables, v => v.Name == "$procVar"); | |
Assert.NotNull(var); | |
Assert.StartsWith("System.Diagnostics.Process", var.ValueString); | |
Assert.True(var.IsExpandable); | |
VariableDetailsBase[] childVars = debugService.GetVariables(var.Id); | |
Assert.Equal(53, childVars.Length); | |
} |
It turns out that what's happening is that when this is getting the children variables:
Lines 263 to 277 in aa1c253
// If a PSObject other than a PSCustomObject, unwrap it. | |
if (psObject != null) | |
{ | |
// First add the PSObject's ETS properties | |
childVariables.AddRange( | |
psObject | |
.Properties | |
// Here we check the object's MemberType against the `Properties` | |
// bit-mask to determine if this is a property. Hence the selection | |
// will only include properties. | |
.Where(p => (PSMemberTypes.Properties & p.MemberType) is not 0) | |
.Select(p => new VariableDetails(p))); | |
obj = psObject.BaseObject; | |
} |
It throws a GetValueInvocationException
:
Exception getting "Path": "There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: $this.Mainmodule.FileName"
and @JustinGrote actually has a fix in the works with #1688, which @SeeminglyScience wants to rewrite and get in.
SeeminglyScience