Skip to content

Commit 898fa22

Browse files
committed
Include NonPublic properties when expanding variables
1 parent b222d0e commit 898fa22

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/Debugging/VariableDetails.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation.
1+
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

44
using System;
@@ -298,6 +298,7 @@ private VariableDetails[] GetChildren(object obj, ILogger logger)
298298
else if (obj is IEnumerable enumerable and not string)
299299
{
300300
int i = 0;
301+
// TODO: Execute this in a delegate on the pipeline thread?
301302
foreach (object item in enumerable)
302303
{
303304
childVariables.Add(
@@ -335,7 +336,9 @@ protected static void AddDotNetProperties(object obj, List<VariableDetails> chil
335336
return;
336337
}
337338

338-
PropertyInfo[] properties = objectType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
339+
// We include NonPublic properties because the C# extension seems to as well, and this
340+
// isn't an inline local because we're often debugging it.
341+
PropertyInfo[] properties = objectType.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
339342

340343
foreach (PropertyInfo property in properties)
341344
{

0 commit comments

Comments
 (0)