Skip to content

Rkeithhill/fix missing note props in dbgr #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/PowerShellEditorServices/Debugging/VariableDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private static string InsertDimensionSize(string value, int dimensionSize)
return result;
}

private static VariableDetails[] GetChildren(object obj)
private VariableDetails[] GetChildren(object obj)
{
List<VariableDetails> childVariables = new List<VariableDetails>();

Expand All @@ -281,6 +281,13 @@ private static VariableDetails[] GetChildren(object obj)
// If a PSObject other than a PSCustomObject, unwrap it.
if (psObject != null)
{
// First add the PSObject's ETS propeties
childVariables.AddRange(
psObject
.Properties
.Where(p => p.MemberType == PSMemberTypes.NoteProperty)
.Select(p => new VariableDetails(p)));

obj = psObject.BaseObject;
}

Expand Down Expand Up @@ -329,13 +336,14 @@ private static VariableDetails[] GetChildren(object obj)
AddDotNetProperties(obj, childVariables);
}
}
catch (GetValueInvocationException)
catch (GetValueInvocationException ex)
{
// This exception occurs when accessing the value of a
// variable causes a script to be executed. Right now
// we aren't loading children on the pipeline thread so
// this causes an exception to be raised. In this case,
// just return an empty list of children.
Logger.Write(LogLevel.Warning, $"Failed to get properties of variable {this.Name}, value invocation was attempted: {ex.Message}");
}

return childVariables.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ await this.debugService.SetLineBreakpoints(
Assert.True(var.IsExpandable);

var childVars = debugService.GetVariables(var.Id);
Assert.Equal(52, childVars.Length);
Assert.Equal(53, childVars.Length);

// Abort execution of the script
this.powerShellContext.AbortExecution();
Expand Down