未验证 提交 e8187087 编写于 作者: T Thays Grazia 提交者: GitHub

fix behavior of JMC (#75783)

上级 774324e5
......@@ -238,6 +238,9 @@ async Task<JArray> GetRootHiddenChildrenForProperty()
JObject fieldValue = await ReadFieldValue(sdbHelper, retDebuggerCmdReader, field, id.Value, typeInfo, valtype, isOwn, parentTypeId, getCommandOptions, token);
numFieldsRead++;
if (typeInfo.Info.IsNonUserCode && getCommandOptions.HasFlag(GetObjectCommandOptions.JustMyCode) && field.Attributes.HasFlag(FieldAttributes.Private))
continue;
if (!Enum.TryParse(fieldValue["__state"].Value<string>(), out DebuggerBrowsableState fieldState)
|| fieldState == DebuggerBrowsableState.Collapsed)
{
......@@ -311,7 +314,7 @@ JArray GetHiddenElement()
int typeId,
string typeName,
ArraySegment<byte> getterParamsBuffer,
bool isAutoExpandable,
GetObjectCommandOptions getCommandOptions,
DotnetObjectId objectId,
bool isValueType,
bool isOwn,
......@@ -347,6 +350,10 @@ JArray GetHiddenElement()
MethodAttributes getterAttrs = getterInfo.Info.Attributes;
MethodAttributes getterMemberAccessAttrs = getterAttrs & MethodAttributes.MemberAccessMask;
MethodAttributes vtableLayout = getterAttrs & MethodAttributes.VtableLayoutMask;
if (typeInfo.Info.IsNonUserCode && getCommandOptions.HasFlag(GetObjectCommandOptions.JustMyCode) && getterMemberAccessAttrs == MethodAttributes.Private)
continue;
bool isNewSlot = (vtableLayout & MethodAttributes.NewSlot) == MethodAttributes.NewSlot;
typePropertiesBrowsableInfo.TryGetValue(propName, out DebuggerBrowsableState? state);
......@@ -454,7 +461,7 @@ async Task UpdateBackingFieldWithPropertyAttributes(JObject backingField, string
{
string returnTypeName = await sdbHelper.GetReturnType(getMethodId, token);
JObject propRet = null;
if (isAutoExpandable || (state is DebuggerBrowsableState.RootHidden && IsACollectionType(returnTypeName)))
if (getCommandOptions.HasFlag(GetObjectCommandOptions.AutoExpandable) || getCommandOptions.HasFlag(GetObjectCommandOptions.ForDebuggerProxyAttribute) || (state is DebuggerBrowsableState.RootHidden && IsACollectionType(returnTypeName)))
{
try
{
......@@ -568,10 +575,6 @@ JObject GetNotAutoExpandableObject(int methodId, string propertyName, bool isSta
for (int i = 0; i < typeIdsCnt; i++)
{
int typeId = typeIdsIncludingParents[i];
var typeInfo = await sdbHelper.GetTypeInfo(typeId, token);
if (typeInfo.Info.IsNonUserCode && getCommandType.HasFlag(GetObjectCommandOptions.JustMyCode))
continue;
int parentTypeId = i + 1 < typeIdsCnt ? typeIdsIncludingParents[i + 1] : -1;
string typeName = await sdbHelper.GetTypeName(typeId, token);
......@@ -604,7 +607,7 @@ JObject GetNotAutoExpandableObject(int methodId, string propertyName, bool isSta
typeId,
typeName,
getPropertiesParamBuffer,
getCommandType.HasFlag(GetObjectCommandOptions.ForDebuggerProxyAttribute),
getCommandType,
id,
isValueType: false,
isOwn,
......
......@@ -60,7 +60,8 @@ internal enum GetObjectCommandOptions
ForDebuggerProxyAttribute = 8,
ForDebuggerDisplayAttribute = 16,
WithProperties = 32,
JustMyCode = 64
JustMyCode = 64,
AutoExpandable = 128
}
internal enum CommandSet {
......
......@@ -290,7 +290,7 @@ public async Task ExpandPropertyValues(MonoSDBHelper sdbHelper, bool splitMember
typeId,
className,
Buffer,
autoExpand,
autoExpand ? GetObjectCommandOptions.AutoExpandable : GetObjectCommandOptions.None,
Id,
isValueType: true,
isOwn: i == 0,
......
......@@ -1067,7 +1067,11 @@ public async Task InspectThisThatInheritsFromClassNonUserCode(string class_name,
{
myField = TNumber(0),
myField2 = TNumber(0),
}, "this_props", num_fields: 2);
propB = TGetter("propB"),
propC = TGetter("propC"),
e = TNumber(50),
f = TNumber(60),
}, "this_props", num_fields: 6);
}
else
{
......
......@@ -16,11 +16,11 @@ public class ClassNonUserCodeToInheritThatInheritsFromNormalClass : NormalClass
private int d;
public int e;
protected int f;
public int G
private int G
{
get {return f + 1;}
}
public int H => f;
private int H => f;
public ClassNonUserCodeToInheritThatInheritsFromNormalClass()
{
......
......@@ -10,11 +10,11 @@ public class ClassWithoutDebugSymbolsToInherit
private int d;
public int e;
protected int f;
public int G
private int G
{
get {return f + 1;}
}
public int H => f;
private int H => f;
public ClassWithoutDebugSymbolsToInherit()
{
......
......@@ -1300,11 +1300,11 @@ public class ClassNonUserCodeToInherit
private int d;
public int e;
protected int f;
public int G
private int G
{
get {return f + 1;}
}
public int H => f;
private int H => f;
public ClassNonUserCodeToInherit()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册