From b0766a99d98014a5928c20c2bb0c21159e42de2a Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Thu, 28 Jul 2022 16:24:31 +0200 Subject: [PATCH] [wasm][debugger] Added support for getting members of static structures. (#69542) * Added info flow about being static + including static. * Added static testcases to Browsable, changed names to more suitable. * Fixed tests affected by adding static members to GetProperties reply. * Removed whitespaces I did not intend to correct. * Test require full name after merge with main. * Added @radical's sugestions. * Fixed tests: Private attr is detected even when it's not set. * Better way of checking attr flags. --- .../BrowserDebugProxy/JObjectValueCreator.cs | 7 +- .../MemberObjectsExplorer.cs | 23 +- .../debugger/BrowserDebugProxy/MonoProxy.cs | 2 +- .../BrowserDebugProxy/MonoSDBHelper.cs | 23 +- .../BrowserDebugProxy/ValueTypeClass.cs | 54 +- .../DebuggerTestSuite/CallFunctionOnTests.cs | 7 +- .../EvaluateOnCallFrameTests.cs | 52 +- .../debugger/DebuggerTestSuite/MiscTests.cs | 2 +- .../tests/debugger-test/debugger-cfo-test.cs | 2 + .../debugger-test/debugger-evaluate-test.cs | 559 +++++++++++++++++- 10 files changed, 649 insertions(+), 82 deletions(-) diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/JObjectValueCreator.cs b/src/mono/wasm/debugger/BrowserDebugProxy/JObjectValueCreator.cs index 5b2eb76ff662b..8d62ab3c5b952 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/JObjectValueCreator.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/JObjectValueCreator.cs @@ -91,7 +91,8 @@ public async Task ReadAsVariableValue( CancellationToken token, bool isOwn = false, int typeIdForObject = -1, - bool forDebuggerDisplayAttribute = false) + bool forDebuggerDisplayAttribute = false, + bool includeStatic = false) { long initialPos = /*retDebuggerCmdReader == null ? 0 : */retDebuggerCmdReader.BaseStream.Position; ElementType etype = (ElementType)retDebuggerCmdReader.ReadByte(); @@ -199,7 +200,7 @@ public async Task ReadAsVariableValue( } case ElementType.ValueType: { - ret = await ReadAsValueType(retDebuggerCmdReader, name, initialPos, forDebuggerDisplayAttribute, token); + ret = await ReadAsValueType(retDebuggerCmdReader, name, initialPos, forDebuggerDisplayAttribute, includeStatic, token); break; } case (ElementType)ValueTypeId.Null: @@ -300,6 +301,7 @@ public async Task ReadAsValueType( string name, long initialPos, bool forDebuggerDisplayAttribute, + bool includeStatic, CancellationToken token) { // FIXME: debugger proxy @@ -337,6 +339,7 @@ public async Task ReadAsValueType( typeId, numValues, isEnum, + includeStatic, token); _valueTypes[valueType.Id.Value] = valueType; return await valueType.ToJObject(_sdbAgent, forDebuggerDisplayAttribute, token); diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs index 2b92cc48368f5..30bf3127bd599 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs @@ -302,7 +302,7 @@ public static async Task> ExpandPropertyValues( bool isOwn, CancellationToken token, Dictionary allMembers, - bool includeStatic = false) + bool includeStatic) { using var retDebuggerCmdReader = await sdbHelper.GetTypePropertiesReader(typeId, token); if (retDebuggerCmdReader == null) @@ -323,7 +323,8 @@ public static async Task> ExpandPropertyValues( var attrs = (PropertyAttributes)retDebuggerCmdReader.ReadInt32(); //attrs if (getMethodId == 0 || await sdbHelper.GetParamCount(getMethodId, token) != 0) continue; - if (!includeStatic && await sdbHelper.MethodIsStatic(getMethodId, token)) + bool isStatic = await sdbHelper.MethodIsStatic(getMethodId, token); + if (!includeStatic && isStatic) continue; MethodInfoWithDebugInformation getterInfo = await sdbHelper.GetMethodInfo(getMethodId, token); @@ -336,7 +337,7 @@ public static async Task> ExpandPropertyValues( if (!allMembers.TryGetValue(propName, out JObject existingMember)) { // new member - await AddProperty(getMethodId, state, propName, getterMemberAccessAttrs); + await AddProperty(getMethodId, state, propName, getterMemberAccessAttrs, isStatic); continue; } @@ -387,7 +388,7 @@ public static async Task> ExpandPropertyValues( { // hiding with a non-auto property, so nothing to adjust // add the new property - await AddProperty(getMethodId, state, overriddenOrHiddenPropName, getterMemberAccessAttrs); + await AddProperty(getMethodId, state, overriddenOrHiddenPropName, getterMemberAccessAttrs, isStatic); continue; } @@ -419,7 +420,7 @@ async Task UpdateBackingFieldWithPropertyAttributes(JObject backingField, string allMembers[evalue["name"].Value()] = evalue; } - async Task AddProperty(int getMethodId, DebuggerBrowsableState? state, string propNameWithSufix, MethodAttributes getterAttrs) + async Task AddProperty(int getMethodId, DebuggerBrowsableState? state, string propNameWithSufix, MethodAttributes getterAttrs, bool isPropertyStatic) { string returnTypeName = await sdbHelper.GetReturnType(getMethodId, token); JObject propRet = null; @@ -431,12 +432,12 @@ async Task AddProperty(int getMethodId, DebuggerBrowsableState? state, string pr } catch (Exception) { - propRet = GetNotAutoExpandableObject(getMethodId, propNameWithSufix); + propRet = GetNotAutoExpandableObject(getMethodId, propNameWithSufix, isPropertyStatic); } } else { - propRet = GetNotAutoExpandableObject(getMethodId, propNameWithSufix); + propRet = GetNotAutoExpandableObject(getMethodId, propNameWithSufix, isPropertyStatic); } propRet["isOwn"] = isOwn; @@ -461,11 +462,12 @@ async Task AddProperty(int getMethodId, DebuggerBrowsableState? state, string pr } } - JObject GetNotAutoExpandableObject(int methodId, string propertyName) + JObject GetNotAutoExpandableObject(int methodId, string propertyName, bool isStatic) { JObject methodIdArgs = JObject.FromObject(new { - containerId = objectId.Value, + isStatic = isStatic, + containerId = isStatic ? typeId : objectId.Value, isValueType = isValueType, methodId = methodId }); @@ -563,7 +565,8 @@ public static async Task GetObjectMemberValues( isValueType: false, isOwn, token, - allMembers); + allMembers, + includeStatic); // ownProperties // Note: ownProperties should mean that we return members of the klass itself, diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs index 82541a4a75513..4f764d207daf7 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs @@ -754,7 +754,7 @@ internal async Task> RuntimeGetObjectMembers(Sess : ValueOrError.WithError(resScope); case "valuetype": var resValue = await MemberObjectsExplorer.GetValueTypeMemberValues( - context.SdbAgent, objectId.Value, getObjectOptions, token, sortByAccessLevel, includeStatic: false); + context.SdbAgent, objectId.Value, getObjectOptions, token, sortByAccessLevel, includeStatic: true); return resValue switch { null => ValueOrError.WithError($"Could not get properties for {objectId}"), diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs b/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs index ba0235f25749d..ffc21eea418cb 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs @@ -1797,20 +1797,18 @@ public async Task InvokeMethod(ArraySegment argsBuffer, int metho return await ValueCreator.ReadAsVariableValue(retDebuggerCmdReader, name, token); } - public Task InvokeMethod(int objectId, int methodId, bool isValueType, CancellationToken token) + public Task InvokeMethod(int objectId, int methodId, bool isValueType, CancellationToken token, bool isMethodStatic = false) { - if (isValueType) + if (isValueType && !isMethodStatic) { return ValueCreator.TryGetValueTypeById(objectId, out var valueType) ? InvokeMethod(valueType.Buffer, methodId, token) : throw new ArgumentException($"Could not find valuetype with id {objectId}, for method id: {methodId}", nameof(objectId)); } - else - { - using var commandParamsObjWriter = new MonoBinaryWriter(); + using var commandParamsObjWriter = new MonoBinaryWriter(); + if (!isMethodStatic) commandParamsObjWriter.Write(ElementType.Class, objectId); - return InvokeMethod(commandParamsObjWriter.GetParameterBuffer(), methodId, token); - } + return InvokeMethod(commandParamsObjWriter.GetParameterBuffer(), methodId, token); } public Task InvokeMethod(DotnetObjectId dotnetObjectId, CancellationToken token, int methodId = -1) @@ -1820,10 +1818,15 @@ public Task InvokeMethod(DotnetObjectId dotnetObjectId, CancellationTok JObject args = dotnetObjectId.ValueAsJson; int? objectId = args["containerId"]?.Value(); int? embeddedMethodId = args["methodId"]?.Value(); + bool isMethodStatic = args["isStatic"]?.Value() == true; return objectId == null || embeddedMethodId == null ? throw new ArgumentException($"Invalid object id for a method, with missing container, or methodId", nameof(dotnetObjectId)) - : InvokeMethod(objectId.Value, embeddedMethodId.Value, isValueType: args["isValueType"]?.Value() == true, token); + : InvokeMethod(objectId.Value, + embeddedMethodId.Value, + isValueType: args["isValueType"]?.Value() == true, + token, + isMethodStatic); } return dotnetObjectId.Scheme is "object" or "valuetype" @@ -1966,7 +1969,7 @@ public async Task StackFrameGetValues(MethodInfoWithDebugInformation met using var retDebuggerCmdReader = await SendDebuggerAgentCommand(CmdFrame.GetThis, commandParamsWriter, token); retDebuggerCmdReader.ReadByte(); //ignore type var objectId = retDebuggerCmdReader.ReadInt32(); - GetMembersResult asyncProxyMembers = await MemberObjectsExplorer.GetObjectMemberValues(this, objectId, GetObjectCommandOptions.WithProperties, token); + GetMembersResult asyncProxyMembers = await MemberObjectsExplorer.GetObjectMemberValues(this, objectId, GetObjectCommandOptions.WithProperties, token, includeStatic: true); var asyncLocals = await GetHoistedLocalVariables(objectId, asyncProxyMembers.Flatten(), token); return asyncLocals; } @@ -1977,7 +1980,7 @@ public async Task StackFrameGetValues(MethodInfoWithDebugInformation met { try { - var var_json = await ValueCreator.ReadAsVariableValue(localsDebuggerCmdReader, var.Name, token); + var var_json = await ValueCreator.ReadAsVariableValue(localsDebuggerCmdReader, var.Name, token, includeStatic: true); locals.Add(var_json); } catch (Exception ex) diff --git a/src/mono/wasm/debugger/BrowserDebugProxy/ValueTypeClass.cs b/src/mono/wasm/debugger/BrowserDebugProxy/ValueTypeClass.cs index 3eadb5b7517d4..c2a2513f00ba1 100644 --- a/src/mono/wasm/debugger/BrowserDebugProxy/ValueTypeClass.cs +++ b/src/mono/wasm/debugger/BrowserDebugProxy/ValueTypeClass.cs @@ -53,6 +53,7 @@ public static async Task CreateFromReader( int typeId, int numValues, bool isEnum, + bool includeStatic, CancellationToken token) { var typeInfo = await sdbAgent.GetTypeInfo(typeId, token); @@ -60,32 +61,27 @@ public static async Task CreateFromReader( var typePropertiesBrowsableInfo = typeInfo?.Info?.DebuggerBrowsableProperties; IReadOnlyList fieldTypes = await sdbAgent.GetTypeFields(typeId, token); - // statics should not be in valueType fields: CallFunctionOnTests.PropertyGettersTest + + JArray fields = new(); + if (includeStatic) + { + IEnumerable staticFields = + fieldTypes.Where(f => f.Attributes.HasFlag(FieldAttributes.Static)); + foreach (var field in staticFields) + { + var fieldValue = await sdbAgent.GetFieldValue(typeId, field.Id, token); + fields.Add(GetFieldWithMetadata(field, fieldValue, isStatic: true)); + } + } + IEnumerable writableFields = fieldTypes .Where(f => !f.Attributes.HasFlag(FieldAttributes.Literal) && !f.Attributes.HasFlag(FieldAttributes.Static)); - JArray fields = new(); foreach (var field in writableFields) { var fieldValue = await sdbAgent.ValueCreator.ReadAsVariableValue(cmdReader, field.Name, token, true, field.TypeId, false); - - fieldValue["__section"] = field.Attributes switch - { - FieldAttributes.Private => "private", - FieldAttributes.Public => "result", - _ => "internal" - }; - - if (field.IsBackingField) - fieldValue["__isBackingField"] = true; - else - { - typeFieldsBrowsableInfo.TryGetValue(field.Name, out DebuggerBrowsableState? state); - fieldValue["__state"] = state?.ToString(); - } - - fields.Add(fieldValue); + fields.Add(GetFieldWithMetadata(field, fieldValue, isStatic: false)); } long endPos = cmdReader.BaseStream.Position; @@ -95,6 +91,26 @@ public static async Task CreateFromReader( cmdReader.BaseStream.Position = endPos; return new ValueTypeClass(valueTypeBuffer, className, fields, typeId, isEnum); + + JObject GetFieldWithMetadata(FieldTypeClass field, JObject fieldValue, bool isStatic) + { + // GetFieldValue returns JObject without name and we need this information + if (isStatic) + fieldValue["name"] = field.Name; + FieldAttributes attr = field.Attributes & FieldAttributes.FieldAccessMask; + fieldValue["__section"] = attr == FieldAttributes.Public + ? "public" : + attr == FieldAttributes.Private ? "private" : "internal"; + + if (field.IsBackingField) + { + fieldValue["__isBackingField"] = true; + return fieldValue; + } + typeFieldsBrowsableInfo.TryGetValue(field.Name, out DebuggerBrowsableState? state); + fieldValue["__state"] = state?.ToString(); + return fieldValue; + } } public async Task ToJObject(MonoSDBHelper sdbAgent, bool forDebuggerDisplayAttribute, CancellationToken token) diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs index aea983d986910..bffacaf2fa23a 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/CallFunctionOnTests.cs @@ -625,7 +625,12 @@ public async Task PropertyGettersTest(string eval_fn, string method_name, int li // Auto properties show w/o getters, because they have // a backing field - DTAutoProperty = TDateTime(dt) + DTAutoProperty = TDateTime(dt), + + // Static properties + PublicStaticDTProp = TGetter("PublicStaticDTProp"), + PrivateStaticDTProp = TGetter("PrivateStaticDTProp"), + InternalStaticDTProp = TGetter("InternalStaticDTProp"), }, local_name); // Invoke getters, and check values diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs index 9fdf6b344e088..0613570a45dc7 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs @@ -979,11 +979,16 @@ await RuntimeEvaluateAndCheck( [InlineData("EvaluateBrowsableClass", "TestEvaluatePropertiesNone", "testPropertiesNone", 10)] [InlineData("EvaluateBrowsableStruct", "TestEvaluateFieldsNone", "testFieldsNone", 10)] [InlineData("EvaluateBrowsableStruct", "TestEvaluatePropertiesNone", "testPropertiesNone", 10)] - [InlineData("EvaluateBrowsableStaticClass", "TestEvaluateFieldsNone", "testFieldsNone", 10)] - [InlineData("EvaluateBrowsableStaticClass", "TestEvaluatePropertiesNone", "testPropertiesNone", 10)] - [InlineData("EvaluateBrowsableCustomPropertiesClass", "TestEvaluatePropertiesNone", "testPropertiesNone", 5, true)] + [InlineData("EvaluateBrowsableClassStatic", "TestEvaluateFieldsNone", "testFieldsNone", 10)] + [InlineData("EvaluateBrowsableClassStatic", "TestEvaluatePropertiesNone", "testPropertiesNone", 10)] + [InlineData("EvaluateBrowsableStructStatic", "TestEvaluateFieldsNone", "testFieldsNone", 10)] + [InlineData("EvaluateBrowsableStructStatic", "TestEvaluatePropertiesNone", "testPropertiesNone", 10)] + [InlineData("EvaluateBrowsableNonAutoPropertiesClass", "TestEvaluatePropertiesNone", "testPropertiesNone", 5, true)] + [InlineData("EvaluateBrowsableNonAutoPropertiesStruct", "TestEvaluatePropertiesNone", "testPropertiesNone", 5, true)] + [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 isCustomGetter = 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) => @@ -994,7 +999,7 @@ public async Task EvaluateBrowsableNone( await CheckValue(testNone, TObject($"DebuggerTests.{outerClassName}.{className}"), nameof(testNone)); var testNoneProps = await GetProperties(testNone["objectId"]?.Value()); - if (isCustomGetter) + if (allMembersAreProperties) await CheckProps(testNoneProps, new { list = TGetter("list", TObject("System.Collections.Generic.List", description: "Count = 2")), @@ -1023,9 +1028,14 @@ public async Task EvaluateBrowsableNone( [InlineData("EvaluateBrowsableClass", "TestEvaluatePropertiesNever", "testPropertiesNever", 10)] [InlineData("EvaluateBrowsableStruct", "TestEvaluateFieldsNever", "testFieldsNever", 10)] [InlineData("EvaluateBrowsableStruct", "TestEvaluatePropertiesNever", "testPropertiesNever", 10)] - [InlineData("EvaluateBrowsableStaticClass", "TestEvaluateFieldsNever", "testFieldsNever", 10)] - [InlineData("EvaluateBrowsableStaticClass", "TestEvaluatePropertiesNever", "testPropertiesNever", 10)] - [InlineData("EvaluateBrowsableCustomPropertiesClass", "TestEvaluatePropertiesNever", "testPropertiesNever", 5)] + [InlineData("EvaluateBrowsableClassStatic", "TestEvaluateFieldsNever", "testFieldsNever", 10)] + [InlineData("EvaluateBrowsableClassStatic", "TestEvaluatePropertiesNever", "testPropertiesNever", 10)] + [InlineData("EvaluateBrowsableStructStatic", "TestEvaluateFieldsNever", "testFieldsNever", 10)] + [InlineData("EvaluateBrowsableStructStatic", "TestEvaluatePropertiesNever", "testPropertiesNever", 10)] + [InlineData("EvaluateBrowsableNonAutoPropertiesClass", "TestEvaluatePropertiesNever", "testPropertiesNever", 5)] + [InlineData("EvaluateBrowsableNonAutoPropertiesStruct", "TestEvaluatePropertiesNever", "testPropertiesNever", 5)] + [InlineData("EvaluateBrowsableNonAutoPropertiesClassStatic", "TestEvaluatePropertiesNever", "testPropertiesNever", 5)] + [InlineData("EvaluateBrowsableNonAutoPropertiesStructStatic", "TestEvaluatePropertiesNever", "testPropertiesNever", 5)] public async Task EvaluateBrowsableNever(string outerClassName, string className, string localVarName, int breakLine) => await CheckInspectLocalsAtBreakpointSite( $"DebuggerTests.{outerClassName}", "Evaluate", breakLine, $"DebuggerTests.{outerClassName}.Evaluate", $"window.setTimeout(function() {{ invoke_static_method ('[debugger-test] DebuggerTests.{outerClassName}:Evaluate'); 1 }})", @@ -1046,11 +1056,16 @@ public async Task EvaluateBrowsableNever(string outerClassName, string className [InlineData("EvaluateBrowsableClass", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 10)] [InlineData("EvaluateBrowsableStruct", "TestEvaluateFieldsCollapsed", "testFieldsCollapsed", 10)] [InlineData("EvaluateBrowsableStruct", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 10)] - [InlineData("EvaluateBrowsableStaticClass", "TestEvaluateFieldsCollapsed", "testFieldsCollapsed", 10)] - [InlineData("EvaluateBrowsableStaticClass", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 10)] - [InlineData("EvaluateBrowsableCustomPropertiesClass", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 5, true)] + [InlineData("EvaluateBrowsableClassStatic", "TestEvaluateFieldsCollapsed", "testFieldsCollapsed", 10)] + [InlineData("EvaluateBrowsableClassStatic", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 10)] + [InlineData("EvaluateBrowsableStructStatic", "TestEvaluateFieldsCollapsed", "testFieldsCollapsed", 10)] + [InlineData("EvaluateBrowsableStructStatic", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 10)] + [InlineData("EvaluateBrowsableNonAutoPropertiesClass", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 5, true)] + [InlineData("EvaluateBrowsableNonAutoPropertiesStruct", "TestEvaluatePropertiesCollapsed", "testPropertiesCollapsed", 5, true)] + [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 isCustomGetter = 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) => @@ -1060,7 +1075,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()); - if (isCustomGetter) + if (allMembersAreProperties) await CheckProps(testCollapsedProps, new { listCollapsed = TGetter("listCollapsed", TObject("System.Collections.Generic.List", description: "Count = 2")), @@ -1089,9 +1104,14 @@ public async Task EvaluateBrowsableCollapsed( [InlineData("EvaluateBrowsableClass", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 10)] [InlineData("EvaluateBrowsableStruct", "TestEvaluateFieldsRootHidden", "testFieldsRootHidden", 10)] [InlineData("EvaluateBrowsableStruct", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 10)] - [InlineData("EvaluateBrowsableStaticClass", "TestEvaluateFieldsRootHidden", "testFieldsRootHidden", 10)] - [InlineData("EvaluateBrowsableStaticClass", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 10)] - [InlineData("EvaluateBrowsableCustomPropertiesClass", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 5)] + [InlineData("EvaluateBrowsableClassStatic", "TestEvaluateFieldsRootHidden", "testFieldsRootHidden", 10)] + [InlineData("EvaluateBrowsableClassStatic", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 10)] + [InlineData("EvaluateBrowsableStructStatic", "TestEvaluateFieldsRootHidden", "testFieldsRootHidden", 10)] + [InlineData("EvaluateBrowsableStructStatic", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 10)] + [InlineData("EvaluateBrowsableNonAutoPropertiesClass", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 5)] + [InlineData("EvaluateBrowsableNonAutoPropertiesStruct", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 5)] + [InlineData("EvaluateBrowsableNonAutoPropertiesClassStatic", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 5)] + [InlineData("EvaluateBrowsableNonAutoPropertiesStructStatic", "TestEvaluatePropertiesRootHidden", "testPropertiesRootHidden", 5)] public async Task EvaluateBrowsableRootHidden( string outerClassName, string className, string localVarName, int breakLine) => await CheckInspectLocalsAtBreakpointSite( $"DebuggerTests.{outerClassName}", "Evaluate", breakLine, $"DebuggerTests.{outerClassName}.Evaluate", diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs index c01c84308dc22..8e4f03f80878e 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/MiscTests.cs @@ -872,7 +872,7 @@ public async Task InspectTaskAtLocals() => await CheckInspectLocalsAtBreakpointS await CheckProps(t_props, new { Status = TGetter("Status") - }, "t_props", num_fields: 54); + }, "t_props", num_fields: 58); }); diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs index 31dfe11d1e603..612f76c739a83 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-cfo-test.cs @@ -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 @@ -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); } } diff --git a/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs b/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs index 34eee99ee6cb9..365bec20ab2a1 100644 --- a/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs +++ b/src/mono/wasm/debugger/tests/debugger-test/debugger-evaluate-test.cs @@ -649,7 +649,7 @@ public class TestEvaluateFieldsNever [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public SampleStructure sampleStructNever = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public SampleClass sampleClassNever = new(); } @@ -708,7 +708,7 @@ public class TestEvaluateFieldsCollapsed [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleStructure sampleStructCollapsed = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleClass sampleClassCollapsed = new(); } @@ -732,7 +732,7 @@ public class TestEvaluatePropertiesCollapsed [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleStructure sampleStructCollapsed { get; set; } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleClass sampleClassCollapsed { get; set; } @@ -767,7 +767,7 @@ public class TestEvaluateFieldsRootHidden [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleStructure sampleStructRootHidden = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleClass sampleClassRootHidden = new(); } @@ -791,7 +791,7 @@ public class TestEvaluatePropertiesRootHidden [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleStructure sampleStructRootHidden { get; set; } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleClass sampleClassRootHidden { get; set; } @@ -878,7 +878,7 @@ public TestEvaluateFieldsNever() {} [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public SampleStructure sampleStructNever = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public SampleClass sampleClassNever = new(); } @@ -939,7 +939,7 @@ public TestEvaluateFieldsCollapsed() {} [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleStructure sampleStructCollapsed = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleClass sampleClassCollapsed = new(); } @@ -963,7 +963,7 @@ public struct TestEvaluatePropertiesCollapsed [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleStructure sampleStructCollapsed { get; set; } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleClass sampleClassCollapsed { get; set; } @@ -1000,7 +1000,7 @@ public TestEvaluateFieldsRootHidden() {} [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleStructure sampleStructRootHidden = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleClass sampleClassRootHidden = new(); } @@ -1024,7 +1024,7 @@ public struct TestEvaluatePropertiesRootHidden [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleStructure sampleStructRootHidden { get; set; } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleClass sampleClassRootHidden { get; set; } @@ -1054,7 +1054,7 @@ public static void Evaluate() } } - public static class EvaluateBrowsableStaticClass + public static class EvaluateBrowsableClassStatic { public class TestEvaluateFieldsNone { @@ -1109,7 +1109,7 @@ public class TestEvaluateFieldsNever [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public static SampleStructure sampleStructNever = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public static SampleClass sampleClassNever = new(); } @@ -1133,7 +1133,7 @@ public class TestEvaluatePropertiesNever [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public static SampleStructure sampleStructNever { get; set; } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public static SampleClass sampleClassNever { get; set; } @@ -1168,7 +1168,7 @@ public class TestEvaluateFieldsCollapsed [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public static SampleStructure sampleStructCollapsed = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public static SampleClass sampleClassCollapsed = new(); } @@ -1192,7 +1192,7 @@ public class TestEvaluatePropertiesCollapsed [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public static SampleStructure sampleStructCollapsed { get; set; } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public static SampleClass sampleClassCollapsed { get; set; } @@ -1227,7 +1227,7 @@ public class TestEvaluateFieldsRootHidden [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public static SampleStructure sampleStructRootHidden = new(); - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public static SampleClass sampleClassRootHidden = new(); } @@ -1251,7 +1251,241 @@ public class TestEvaluatePropertiesRootHidden [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public static SampleStructure sampleStructRootHidden { get; set; } - + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleClass sampleClassRootHidden { get; set; } + + public TestEvaluatePropertiesRootHidden() + { + listRootHidden = new List() { 1, 2 }; + arrayRootHidden = new int[] { 11, 22 }; + textRootHidden = "textRootHidden"; + nullRootHidden = null; + valueTypeEnumRootHidden = new(); + sampleStructRootHidden = new(); + sampleClassRootHidden = new(); + } + } + + public static void Evaluate() + { + var testFieldsNone = new TestEvaluateFieldsNone(); + var testFieldsNever = new TestEvaluateFieldsNever(); + var testFieldsCollapsed = new TestEvaluateFieldsCollapsed(); + var testFieldsRootHidden = new TestEvaluateFieldsRootHidden(); + + var testPropertiesNone = new TestEvaluatePropertiesNone(); + var testPropertiesNever = new TestEvaluatePropertiesNever(); + var testPropertiesCollapsed = new TestEvaluatePropertiesCollapsed(); + var testPropertiesRootHidden = new TestEvaluatePropertiesRootHidden(); + } + } + + public static class EvaluateBrowsableStructStatic + { + public struct TestEvaluateFieldsNone + { + + public static List list = new List() { 1, 2 }; + public static int[] array = new int[] { 11, 22 }; + public static string text = "text"; + + public static bool[] nullNone = null; + public static SampleEnum valueTypeEnum = new(); + public static SampleStructure sampleStruct = new(); + public static SampleClass sampleClass = new(); + + public TestEvaluateFieldsNone() { } + } + + public struct TestEvaluatePropertiesNone + { + public static List list { get; set; } + public static int[] array { get; set; } + public static string text { get; set; } + public static bool[] nullNone { get; set; } + public static SampleEnum valueTypeEnum { get; set; } + public static SampleStructure sampleStruct { get; set; } + public static SampleClass sampleClass { get; set; } + + public TestEvaluatePropertiesNone() + { + list = new List() { 1, 2 }; + array = new int[] { 11, 22 }; + text = "text"; + nullNone = null; + valueTypeEnum = new(); + sampleStruct = new(); + sampleClass = new(); + } + } + + public struct TestEvaluateFieldsNever + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static List listNever = new List() { 1, 2 }; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static int[] arrayNever = new int[] { 11, 22 }; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static string textNever = "textNever"; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static bool[] nullNever = null; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleEnum valueTypeEnumNever = new(); + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleStructure sampleStructNever = new(); + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleClass sampleClassNever = new(); + public TestEvaluateFieldsNever() { } + } + + public struct TestEvaluatePropertiesNever + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static List listNever { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static int[] arrayNever { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static string textNever { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static bool[] nullNever { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleEnum valueTypeEnumNever { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleStructure sampleStructNever { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleClass sampleClassNever { get; set; } + + public TestEvaluatePropertiesNever() + { + listNever = new List() { 1, 2 }; + arrayNever = new int[] { 11, 22 }; + textNever = "textNever"; + nullNever = null; + valueTypeEnumNever = new(); + sampleStructNever = new(); + sampleClassNever = new(); + } + } + + public struct TestEvaluateFieldsCollapsed + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static List listCollapsed = new List() { 1, 2 }; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static int[] arrayCollapsed = new int[] { 11, 22 }; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static string textCollapsed = "textCollapsed"; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static bool[] nullCollapsed = null; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleEnum valueTypeEnumCollapsed = new(); + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleStructure sampleStructCollapsed = new(); + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleClass sampleClassCollapsed = new(); + public TestEvaluateFieldsCollapsed() { } + } + + public struct TestEvaluatePropertiesCollapsed + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static List listCollapsed { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static int[] arrayCollapsed { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static string textCollapsed { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static bool[] nullCollapsed { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleEnum valueTypeEnumCollapsed { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleStructure sampleStructCollapsed { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleClass sampleClassCollapsed { get; set; } + + public TestEvaluatePropertiesCollapsed() + { + listCollapsed = new List() { 1, 2 }; + arrayCollapsed = new int[] { 11, 22 }; + textCollapsed = "textCollapsed"; + nullCollapsed = null; + valueTypeEnumCollapsed = new(); + sampleStructCollapsed = new(); + sampleClassCollapsed = new(); + } + } + + public struct TestEvaluateFieldsRootHidden + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static List listRootHidden = new List() { 1, 2 }; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static int[] arrayRootHidden = new int[] { 11, 22 }; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static string textRootHidden = "textRootHidden"; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static bool[] nullRootHidden = null; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleEnum valueTypeEnumRootHidden = new(); + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleStructure sampleStructRootHidden = new(); + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleClass sampleClassRootHidden = new(); + + public TestEvaluateFieldsRootHidden() { } + } + + public struct TestEvaluatePropertiesRootHidden + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static List listRootHidden { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static int[] arrayRootHidden { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static string textRootHidden { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static bool[] nullRootHidden { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleEnum valueTypeEnumRootHidden { get; set; } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleStructure sampleStructRootHidden { get; set; } + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public static SampleClass sampleClassRootHidden { get; set; } @@ -1281,7 +1515,7 @@ public static void Evaluate() } } - public static class EvaluateBrowsableCustomPropertiesClass + public static class EvaluateBrowsableNonAutoPropertiesClass { public class TestEvaluatePropertiesNone { @@ -1313,7 +1547,7 @@ public class TestEvaluatePropertiesNever [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public SampleStructure sampleStructNever { get { return new(); } } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] public SampleClass sampleClassNever { get { return new(); } } } @@ -1337,7 +1571,7 @@ public class TestEvaluatePropertiesCollapsed [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleStructure sampleStructCollapsed { get { return new(); } } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] public SampleClass sampleClassCollapsed { get { return new(); } } } @@ -1361,7 +1595,7 @@ public class TestEvaluatePropertiesRootHidden [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleStructure sampleStructRootHidden { get { return new(); } } - + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] public SampleClass sampleClassRootHidden { get { return new(); } } } @@ -1375,6 +1609,288 @@ public static void Evaluate() } } + public static class EvaluateBrowsableNonAutoPropertiesStruct + { + public struct TestEvaluatePropertiesNone + { + public List list { get { return new List() { 1, 2 }; } } + public int[] array { get { return new int[] { 11, 22 }; } } + public string text { get { return "text"; } } + public bool[] nullNone { get { return null; } } + public SampleEnum valueTypeEnum { get { return new(); } } + public SampleStructure sampleStruct { get { return new(); } } + public SampleClass sampleClass { get { return new(); } } + } + + public struct TestEvaluatePropertiesNever + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public List listNever { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public int[] arrayNever { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public string textNever { get { return "textNever"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public bool[] nullNever { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public SampleEnum valueTypeEnumNever { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public SampleStructure sampleStructNever { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public SampleClass sampleClassNever { get { return new(); } } + } + + public struct TestEvaluatePropertiesCollapsed + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public List listCollapsed { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public int[] arrayCollapsed { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public string textCollapsed { get { return "textCollapsed"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public bool[] nullCollapsed { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public SampleEnum valueTypeEnumCollapsed { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public SampleStructure sampleStructCollapsed { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public SampleClass sampleClassCollapsed { get { return new(); } } + } + + public struct TestEvaluatePropertiesRootHidden + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public List listRootHidden { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public int[] arrayRootHidden { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public string textRootHidden { get { return "textRootHidden"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public bool[] nullRootHidden { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public SampleEnum valueTypeEnumRootHidden { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public SampleStructure sampleStructRootHidden { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public SampleClass sampleClassRootHidden { get { return new(); } } + } + + public static void Evaluate() + { + var testPropertiesNone = new TestEvaluatePropertiesNone(); + var testPropertiesNever = new TestEvaluatePropertiesNever(); + var testPropertiesCollapsed = new TestEvaluatePropertiesCollapsed(); + var testPropertiesRootHidden = new TestEvaluatePropertiesRootHidden(); + } + } + + public static class EvaluateBrowsableNonAutoPropertiesClassStatic + { + public class TestEvaluatePropertiesNone + { + public static List list { get { return new List() { 1, 2 }; } } + public static int[] array { get { return new int[] { 11, 22 }; } } + public static string text { get { return "text"; } } + public static bool[] nullNone { get { return null; } } + public static SampleEnum valueTypeEnum { get { return new(); } } + public static SampleStructure sampleStruct { get { return new(); } } + public static SampleClass sampleClass { get { return new(); } } + } + + public class TestEvaluatePropertiesNever + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static List listNever { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static int[] arrayNever { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static string textNever { get { return "textNever"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static bool[] nullNever { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleEnum valueTypeEnumNever { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleStructure sampleStructNever { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleClass sampleClassNever { get { return new(); } } + } + + public class TestEvaluatePropertiesCollapsed + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static List listCollapsed { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static int[] arrayCollapsed { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static string textCollapsed { get { return "textCollapsed"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static bool[] nullCollapsed { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public SampleEnum valueTypeEnumCollapsed { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleStructure sampleStructCollapsed { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleClass sampleClassCollapsed { get { return new(); } } + } + + public class TestEvaluatePropertiesRootHidden + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static List listRootHidden { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static int[] arrayRootHidden { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static string textRootHidden { get { return "textRootHidden"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static bool[] nullRootHidden { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleEnum valueTypeEnumRootHidden { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleStructure sampleStructRootHidden { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleClass sampleClassRootHidden { get { return new(); } } + } + + public static void Evaluate() + { + var testPropertiesNone = new TestEvaluatePropertiesNone(); + var testPropertiesNever = new TestEvaluatePropertiesNever(); + var testPropertiesCollapsed = new TestEvaluatePropertiesCollapsed(); + var testPropertiesRootHidden = new TestEvaluatePropertiesRootHidden(); + } + } + + public static class EvaluateBrowsableNonAutoPropertiesStructStatic + { + public struct TestEvaluatePropertiesNone + { + public static List list { get { return new List() { 1, 2 }; } } + public static int[] array { get { return new int[] { 11, 22 }; } } + public static string text { get { return "text"; } } + public static bool[] nullNone { get { return null; } } + public static SampleEnum valueTypeEnum { get { return new(); } } + public static SampleStructure sampleStruct { get { return new(); } } + public static SampleClass sampleClass { get { return new(); } } + } + + public struct TestEvaluatePropertiesNever + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static List listNever { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static int[] arrayNever { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static string textNever { get { return "textNever"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static bool[] nullNever { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleEnum valueTypeEnumNever { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleStructure sampleStructNever { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + public static SampleClass sampleClassNever { get { return new(); } } + } + + public struct TestEvaluatePropertiesCollapsed + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static List listCollapsed { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static int[] arrayCollapsed { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static string textCollapsed { get { return "textCollapsed"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static bool[] nullCollapsed { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleEnum valueTypeEnumCollapsed { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public SampleStructure sampleStructCollapsed { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Collapsed)] + public static SampleClass sampleClassCollapsed { get { return new(); } } + } + + public struct TestEvaluatePropertiesRootHidden + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static List listRootHidden { get { return new List() { 1, 2 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static int[] arrayRootHidden { get { return new int[] { 11, 22 }; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static string textRootHidden { get { return "textRootHidden"; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static bool[] nullRootHidden { get { return null; } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleEnum valueTypeEnumRootHidden { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleStructure sampleStructRootHidden { get { return new(); } } + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] + public static SampleClass sampleClassRootHidden { get { return new(); } } + } + + public static void Evaluate() + { + var testPropertiesNone = new TestEvaluatePropertiesNone(); + var testPropertiesNever = new TestEvaluatePropertiesNever(); + var testPropertiesCollapsed = new TestEvaluatePropertiesCollapsed(); + var testPropertiesRootHidden = new TestEvaluatePropertiesRootHidden(); + } + } + public static class StructureGetters { public struct Point @@ -1586,4 +2102,3 @@ public static class NestedClass3 } } } -