Skip to content

Commit f3c3d37

Browse files
rkeithhilldaviwil
authored andcommitted
Fix #821 missing note props in dbg variable viewer.
1 parent 0788a3e commit f3c3d37

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/PowerShellEditorServices/Debugging/VariableDetails.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ private static string InsertDimensionSize(string value, int dimensionSize)
254254
return result;
255255
}
256256

257-
private static VariableDetails[] GetChildren(object obj)
257+
private VariableDetails[] GetChildren(object obj)
258258
{
259259
List<VariableDetails> childVariables = new List<VariableDetails>();
260260

@@ -281,6 +281,13 @@ private static VariableDetails[] GetChildren(object obj)
281281
// If a PSObject other than a PSCustomObject, unwrap it.
282282
if (psObject != null)
283283
{
284+
// First add the PSObject's ETS propeties
285+
childVariables.AddRange(
286+
psObject
287+
.Properties
288+
.Where(p => p.MemberType == PSMemberTypes.NoteProperty)
289+
.Select(p => new VariableDetails(p)));
290+
284291
obj = psObject.BaseObject;
285292
}
286293

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

341349
return childVariables.ToArray();

0 commit comments

Comments
 (0)