Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
78d63442
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
78d63442
编写于
10月 29, 2019
作者:
D
Dustin Coleman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not return favorites in expansions of null values
上级
b8a5611e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
89 addition
and
1 deletion
+89
-1
src/ExpressionEvaluator/CSharp/Test/ResultProvider/ObjectFavoritesTests.cs
...luator/CSharp/Test/ResultProvider/ObjectFavoritesTests.cs
+45
-0
src/ExpressionEvaluator/Core/Source/ResultProvider/Expansion/MemberExpansion.cs
...r/Core/Source/ResultProvider/Expansion/MemberExpansion.cs
+1
-1
src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/ObjectFavoritesTests.vb
...r/VisualBasic/Test/ResultProvider/ObjectFavoritesTests.vb
+43
-0
未找到文件。
src/ExpressionEvaluator/CSharp/Test/ResultProvider/ObjectFavoritesTests.cs
浏览文件 @
78d63442
...
...
@@ -81,6 +81,51 @@ class C
EvalResult
(
"s2"
,
@"""S2"""
,
"string"
,
"(new C()).a.s2"
,
DkmEvaluationResultFlags
.
RawString
|
DkmEvaluationResultFlags
.
CanFavorite
,
editableValue
:
@"""S2"""
));
}
[
Fact
]
public
void
ExpansionOfNullValue
()
{
var
source
=
@"class A
{
string s1 = ""S1"";
string s2 = ""S2"";
}
class B
{
A a1 = new A();
A a2 = null;
}"
;
var
assembly
=
GetAssembly
(
source
);
var
type
=
assembly
.
GetType
(
"B"
);
var
rootExpr
=
"new B()"
;
var
favoritesByTypeName
=
new
Dictionary
<
string
,
DkmClrObjectFavoritesInfo
>()
{
{
"A"
,
new
DkmClrObjectFavoritesInfo
(
new
[]
{
"s2"
})
}
};
var
runtime
=
new
DkmClrRuntimeInstance
(
ReflectionUtilities
.
GetMscorlib
(
assembly
),
favoritesByTypeName
);
var
value
=
CreateDkmClrValue
(
value
:
Activator
.
CreateInstance
(
type
),
type
:
runtime
.
GetType
((
TypeImpl
)
type
));
var
evalResult
=
FormatResult
(
rootExpr
,
value
);
Verify
(
evalResult
,
EvalResult
(
rootExpr
,
"{B}"
,
"B"
,
rootExpr
,
DkmEvaluationResultFlags
.
Expandable
));
var
children
=
GetChildren
(
evalResult
);
Verify
(
children
,
EvalResult
(
"a1"
,
"{A}"
,
"A"
,
"(new B()).a1"
,
DkmEvaluationResultFlags
.
Expandable
|
DkmEvaluationResultFlags
.
CanFavorite
|
DkmEvaluationResultFlags
.
HasFavorites
),
EvalResult
(
"a2"
,
"null"
,
"A"
,
"(new B()).a2"
,
DkmEvaluationResultFlags
.
CanFavorite
));
// A a1 = new A();
var
more
=
GetChildren
(
children
[
0
]);
Verify
(
more
,
EvalResult
(
"s2"
,
@"""S2"""
,
"string"
,
"(new B()).a1.s2"
,
DkmEvaluationResultFlags
.
RawString
|
DkmEvaluationResultFlags
.
CanFavorite
|
DkmEvaluationResultFlags
.
IsFavorite
,
editableValue
:
@"""S2"""
),
EvalResult
(
"s1"
,
@"""S1"""
,
"string"
,
"(new B()).a1.s1"
,
DkmEvaluationResultFlags
.
RawString
|
DkmEvaluationResultFlags
.
CanFavorite
,
editableValue
:
@"""S1"""
));
}
[
Fact
]
public
void
FilteredExpansion
()
{
...
...
src/ExpressionEvaluator/Core/Source/ResultProvider/Expansion/MemberExpansion.cs
浏览文件 @
78d63442
...
...
@@ -79,7 +79,7 @@ internal sealed class MemberExpansion : Expansion
foreach
(
var
member
in
allMembers
)
{
if
(
member
.
IsFavorite
)
if
(
member
.
IsFavorite
&&
!
value
.
IsNull
)
// Favorites are never static
{
favoritesMembersByName
.
Add
(
member
.
Name
,
member
);
}
...
...
src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/ObjectFavoritesTests.vb
浏览文件 @
78d63442
...
...
@@ -69,6 +69,49 @@ End Class"
EvalResult
(
"s2"
,
"
""
S2
""
"
,
"String"
,
"(new C()).a.s2"
,
DkmEvaluationResultFlags
.
RawString
Or
DkmEvaluationResultFlags
.
CanFavorite
,
editableValue
:
=
"
""
S2
""
"
))
End
Sub
<
Fact
>
Public
Sub
ExpansionOfNullValue
()
Dim
source
=
"Class A
Dim s1 As String =
""
S1
""
Dim s2 As String =
""
S2
""
End Class
Class B
Dim a1 As A = new A()
Dim a2 As A = Nothing
End Class"
Dim
assembly
=
GetAssembly
(
source
)
Dim
type
=
assembly
.
GetType
(
"B"
)
Dim
rootExpr
=
"new B()"
Dim
favoritesByTypeName
=
New
Dictionary
(
Of
String
,
DkmClrObjectFavoritesInfo
)
From
{
{
"A"
,
New
DkmClrObjectFavoritesInfo
(
New
String
()
{
"s2"
})}
}
Dim
runtime
=
New
DkmClrRuntimeInstance
(
ReflectionUtilities
.
GetMscorlib
(
assembly
),
favoritesByTypeName
)
Dim
value
=
CreateDkmClrValue
(
value
:
=
Activator
.
CreateInstance
(
type
),
type
:
=
runtime
.
GetType
(
type
))
Dim
result
=
FormatResult
(
rootExpr
,
value
)
Verify
(
result
,
EvalResult
(
rootExpr
,
"{B}"
,
"B"
,
rootExpr
,
DkmEvaluationResultFlags
.
Expandable
))
Dim
children
=
GetChildren
(
result
)
Verify
(
children
,
EvalResult
(
"a1"
,
"{A}"
,
"A"
,
"(new B()).a1"
,
DkmEvaluationResultFlags
.
Expandable
Or
DkmEvaluationResultFlags
.
CanFavorite
Or
DkmEvaluationResultFlags
.
HasFavorites
),
EvalResult
(
"a2"
,
"Nothing"
,
"A"
,
"(new B()).a2"
,
DkmEvaluationResultFlags
.
CanFavorite
))
' Dim a1 As A = new A()
Dim
more
=
GetChildren
(
children
(
0
))
Verify
(
more
,
EvalResult
(
"s2"
,
"
""
S2
""
"
,
"String"
,
"(new B()).a1.s2"
,
DkmEvaluationResultFlags
.
RawString
Or
DkmEvaluationResultFlags
.
CanFavorite
Or
DkmEvaluationResultFlags
.
IsFavorite
,
editableValue
:
=
"
""
S2
""
"
),
EvalResult
(
"s1"
,
"
""
S1
""
"
,
"String"
,
"(new B()).a1.s1"
,
DkmEvaluationResultFlags
.
RawString
Or
DkmEvaluationResultFlags
.
CanFavorite
,
editableValue
:
=
"
""
S1
""
"
))
End
Sub
<
Fact
>
Public
Sub
FilteredExpansion
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录