Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
69b1bdd2
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,发现更多精彩内容 >>
提交
69b1bdd2
编写于
3月 02, 2015
作者:
C
Charles Stoner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Skip GetMemberValue for Nullable<T> error value
上级
6e5efac8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
64 addition
and
14 deletion
+64
-14
src/ExpressionEvaluator/CSharp/Test/ResultProvider/ExpansionTests.cs
...ionEvaluator/CSharp/Test/ResultProvider/ExpansionTests.cs
+31
-0
src/ExpressionEvaluator/Core/Source/ResultProvider/Formatter.Values.cs
...nEvaluator/Core/Source/ResultProvider/Formatter.Values.cs
+5
-10
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs
...aluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs
+17
-2
src/ExpressionEvaluator/Core/Source/ResultProvider/ResultProvider.cs
...ionEvaluator/Core/Source/ResultProvider/ResultProvider.cs
+6
-2
src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmClrValue.cs
...r/Core/Test/ResultProvider/Debugger/Engine/DkmClrValue.cs
+5
-0
未找到文件。
src/ExpressionEvaluator/CSharp/Test/ResultProvider/ExpansionTests.cs
浏览文件 @
69b1bdd2
...
...
@@ -2152,5 +2152,36 @@ protected class C : B
// Also need to check Access, StorageType, and TypeModifierFlags fields.
// ...
}
[
WorkItem
(
1130978
)]
[
Fact
]
public
void
NullableValue_Error
()
{
var
source
=
@"class C
{
bool F() { return false; }
int? P
{
get
{
while (!F()) { }
return null;
}
}
}"
;
DkmClrRuntimeInstance
runtime
=
null
;
GetMemberValueDelegate
getMemberValue
=
(
v
,
m
)
=>
(
m
==
"P"
)
?
CreateErrorValue
(
runtime
.
GetType
(
typeof
(
int
?)),
"Function evaluation timed out"
)
:
null
;
runtime
=
new
DkmClrRuntimeInstance
(
ReflectionUtilities
.
GetMscorlibAndSystemCore
(
GetAssembly
(
source
)),
getMemberValue
:
getMemberValue
);
using
(
runtime
.
Load
())
{
var
type
=
runtime
.
GetType
(
"C"
);
var
value
=
CreateDkmClrValue
(
type
.
Instantiate
(),
type
:
type
);
var
memberValue
=
value
.
GetMemberValue
(
"P"
,
(
int
)
System
.
Reflection
.
MemberTypes
.
Property
,
"C"
,
DefaultInspectionContext
);
var
evalResult
=
FormatResult
(
"o.P"
,
memberValue
);
Verify
(
evalResult
,
EvalFailedResult
(
"o.P"
,
"Function evaluation timed out"
,
"int?"
,
"o.P"
));
}
}
}
}
src/ExpressionEvaluator/Core/Source/ResultProvider/Formatter.Values.cs
浏览文件 @
69b1bdd2
...
...
@@ -143,6 +143,8 @@ internal string GetUnderlyingString(DkmClrValue value, DkmInspectionContext insp
private
string
GetUnderlyingStringImpl
(
DkmClrValue
value
,
DkmInspectionContext
inspectionContext
)
{
Debug
.
Assert
(!
value
.
IsError
());
if
(
value
.
IsNull
)
{
return
null
;
...
...
@@ -167,22 +169,15 @@ private string GetUnderlyingStringImpl(DkmClrValue value, DkmInspectionContext i
else
if
(!
IsPredefinedType
(
lmrType
))
{
// Check for special cased non-primitives that have underlying strings
if
(
string
.
Equals
(
lmrType
.
FullName
,
"System.Data.SqlTypes.SqlString"
,
StringComparison
.
Ordinal
))
if
(
lmrType
.
IsType
(
"System.Data.SqlTypes"
,
"SqlString"
))
{
var
fieldValue
=
value
.
GetFieldValue
(
InternalWellKnownMemberNames
.
SqlStringValue
,
inspectionContext
);
return
fieldValue
.
HostObjectValue
as
string
;
}
do
else
if
(
lmrType
.
IsOrInheritsFrom
(
"System.Xml.Linq"
,
"XNode"
))
{
if
(
string
.
Equals
(
lmrType
.
FullName
,
"System.Xml.Linq.XNode"
,
StringComparison
.
Ordinal
))
{
return
value
.
EvaluateToString
(
inspectionContext
);
}
lmrType
=
lmrType
.
BaseType
;
return
value
.
EvaluateToString
(
inspectionContext
);
}
while
(
lmrType
!=
null
);
}
return
null
;
...
...
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs
浏览文件 @
69b1bdd2
...
...
@@ -595,11 +595,26 @@ private static bool IsMscorlibType(this Type type, string @namespace, string nam
return
type
.
IsType
(
@namespace
,
name
)
/*&& type.Assembly.IsMscorlib()*/
;
}
private
static
bool
IsType
(
this
Type
type
,
string
@namespace
,
string
name
)
internal
static
bool
IsOrInheritsFrom
(
this
Type
type
,
string
@namespace
,
string
name
)
{
do
{
if
(
type
.
IsType
(
@namespace
,
name
))
{
return
true
;
}
type
=
type
.
BaseType
;
}
while
(
type
!=
null
);
return
false
;
}
internal
static
bool
IsType
(
this
Type
type
,
string
@namespace
,
string
name
)
{
Debug
.
Assert
((
@namespace
==
null
)
||
(
@namespace
.
Length
>
0
));
// Type.Namespace is null not empty.
Debug
.
Assert
(!
string
.
IsNullOrEmpty
(
name
));
return
(
type
.
Namespace
==
@namespace
)
&&
(
type
.
Name
==
name
);
return
string
.
Equals
(
type
.
Namespace
,
@namespace
,
StringComparison
.
Ordinal
)
&&
string
.
Equals
(
type
.
Name
,
name
,
StringComparison
.
Ordinal
);
}
}
}
src/ExpressionEvaluator/Core/Source/ResultProvider/ResultProvider.cs
浏览文件 @
69b1bdd2
...
...
@@ -297,8 +297,12 @@ private static string GetTypeName(DkmInspectionContext inspectionContext, DkmClr
{
Debug
.
Assert
(
value
.
Type
.
GetProxyType
()
==
null
);
var
nullableValue
=
value
.
GetNullableValue
(
inspectionContext
);
if
(
nullableValue
==
null
)
DkmClrValue
nullableValue
;
if
(
value
.
IsError
())
{
expansion
=
null
;
}
else
if
((
nullableValue
=
value
.
GetNullableValue
(
inspectionContext
))
==
null
)
{
Debug
.
Assert
(
declaredType
.
Equals
(
value
.
Type
.
GetLmrType
()));
// No expansion of "null".
...
...
src/ExpressionEvaluator/Core/Test/ResultProvider/Debugger/Engine/DkmClrValue.cs
浏览文件 @
69b1bdd2
...
...
@@ -330,6 +330,11 @@ public DkmClrValue GetMemberValue(string MemberName, int MemberType, string Pare
throw
new
ArgumentNullException
(
"inspectionContext"
);
}
if
(
this
.
IsError
())
{
throw
new
InvalidOperationException
();
}
var
runtime
=
this
.
Type
.
RuntimeInstance
;
var
memberValue
=
runtime
.
GetMemberValue
(
this
,
MemberName
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录