Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 6 additions & 15 deletions src/mono/wasm/debugger/BrowserDebugProxy/ValueTypeClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public static async Task<ValueTypeClass> CreateFromReader(
JArray fields = new();
if (includeStatic)
{
IEnumerable<FieldTypeClass> staticFields = fieldTypes
.Where(f => f.Attributes.HasFlag(FieldAttributes.Static));
IEnumerable<FieldTypeClass> staticFields =
fieldTypes.Where(f => f.Attributes.HasFlag(FieldAttributes.Static));
foreach (var field in staticFields)
{
var fieldValue = await sdbAgent.GetFieldValue(typeId, field.Id, token);
Expand Down Expand Up @@ -98,19 +98,10 @@ JObject GetFieldWithMetadata(FieldTypeClass field, JObject fieldValue, bool isSt
if (isStatic)
fieldValue["name"] = field.Name;

fieldValue["__section"] = isStatic
? field.Attributes switch
{
FieldAttributes.Private | FieldAttributes.Static => "private",
FieldAttributes.Public | FieldAttributes.Static => "result",
_ => "internal"
}
: field.Attributes switch
{
FieldAttributes.Private => "private",
FieldAttributes.Public => "result",
_ => "internal"
};
fieldValue["__section"] = field.Attributes.HasFlag(FieldAttributes.Private)
? "private" :
field.Attributes.HasFlag(FieldAttributes.Public) ?
"public" : "internal";

if (field.IsBackingField)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ public async Task PropertyGettersTest(string eval_fn, string method_name, int li
// Static properties
PublicStaticDTProp = TGetter("PublicStaticDTProp"),
PrivateStaticDTProp = TGetter("PrivateStaticDTProp"),
InternalStaticDTProp = TGetter("InternalStaticDTProp"),
}, local_name);

// Invoke getters, and check values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ await RuntimeEvaluateAndCheck(
[InlineData("EvaluateBrowsableNonAutoPropertiesClassStatic", "TestEvaluatePropertiesNone", "testPropertiesNone", 5, true)]
[InlineData("EvaluateBrowsableNonAutoPropertiesStructStatic", "TestEvaluatePropertiesNone", "testPropertiesNone", 5, true)]
public async Task EvaluateBrowsableNone(
string outerClassName, string className, string localVarName, int breakLine, bool propsAreGetters = false) => await CheckInspectLocalsAtBreakpointSite(
string outerClassName, string className, string localVarName, int breakLine, bool allMembersAreProperties = false) => await CheckInspectLocalsAtBreakpointSite(
$"DebuggerTests.{outerClassName}", "Evaluate", breakLine, $"DebuggerTests.{outerClassName}.Evaluate",
$"window.setTimeout(function() {{ invoke_static_method ('[debugger-test] DebuggerTests.{outerClassName}:Evaluate'); 1 }})",
wait_for_event_fn: async (pause_location) =>
Expand All @@ -923,7 +923,7 @@ public async Task EvaluateBrowsableNone(
await CheckValue(testNone, TObject($"DebuggerTests.{outerClassName}.{className}"), nameof(testNone));
var testNoneProps = await GetProperties(testNone["objectId"]?.Value<string>());

if (propsAreGetters)
if (allMembersAreProperties)
await CheckProps(testNoneProps, new
{
list = TGetter("list", TObject("System.Collections.Generic.List<int>", description: "Count = 2")),
Expand Down Expand Up @@ -989,7 +989,7 @@ public async Task EvaluateBrowsableNever(string outerClassName, string className
[InlineData("EvaluateBrowsableNonAutoPropertiesClassStatic", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 5, true)]
[InlineData("EvaluateBrowsableNonAutoPropertiesStructStatic", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 5, true)]
public async Task EvaluateBrowsableCollapsed(
string outerClassName, string className, string localVarName, int breakLine, bool propsAreGetters = false) => await CheckInspectLocalsAtBreakpointSite(
string outerClassName, string className, string localVarName, int breakLine, bool allMembersAreProperties = false) => await CheckInspectLocalsAtBreakpointSite(
$"DebuggerTests.{outerClassName}", "Evaluate", breakLine, $"DebuggerTests.{outerClassName}.Evaluate",
$"window.setTimeout(function() {{ invoke_static_method ('[debugger-test] DebuggerTests.{outerClassName}:Evaluate'); 1 }})",
wait_for_event_fn: async (pause_location) =>
Expand All @@ -999,7 +999,7 @@ public async Task EvaluateBrowsableCollapsed(
var (testCollapsed, _) = await EvaluateOnCallFrame(id, localVarName);
await CheckValue(testCollapsed, TObject($"DebuggerTests.{outerClassName}.{className}"), nameof(testCollapsed));
var testCollapsedProps = await GetProperties(testCollapsed["objectId"]?.Value<string>());
if (propsAreGetters)
if (allMembersAreProperties)
await CheckProps(testCollapsedProps, new
{
listCollapsed = TGetter("listCollapsed", TObject("System.Collections.Generic.List<int>", description: "Count = 2")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class ClassWithProperties

private static DateTime PrivateStaticDTProp => new DateTime(6, 5, 4, 3, 2, 1);
public static DateTime PublicStaticDTProp => new DateTime(3, 6, 1, 7, 9, 4);
internal static DateTime InternalStaticDTProp => new DateTime(2, 3, 1, 5, 0, 3);
}

struct StructWithProperties
Expand All @@ -77,5 +78,6 @@ struct StructWithProperties

private static DateTime PrivateStaticDTProp => new DateTime(6, 5, 4, 3, 2, 1);
public static DateTime PublicStaticDTProp => new DateTime(3, 6, 1, 7, 9, 4);
internal static DateTime InternalStaticDTProp => new DateTime(2, 3, 1, 5, 0, 3);
}
}