Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
490b39d6
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,发现更多精彩内容 >>
提交
490b39d6
编写于
8月 09, 2016
作者:
J
Jonathon Marolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixing stack formatting per Cyrus' suggestions
上级
1bb068a7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
76 deletion
+14
-76
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioErrorReportingService.ExceptionFormatting.cs
.../VisualStudioErrorReportingService.ExceptionFormatting.cs
+14
-52
src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
+0
-18
src/VisualStudio/Core/Def/ServicesVSResources.resx
src/VisualStudio/Core/Def/ServicesVSResources.resx
+0
-6
未找到文件。
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioErrorReportingService.ExceptionFormatting.cs
浏览文件 @
490b39d6
using
System
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Text
;
...
...
@@ -8,8 +9,6 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal
partial
class
VisualStudioErrorReportingService
{
private
const
string
AsyncMethodPrefix
=
"async "
;
private
static
string
GetFormattedExceptionStack
(
Exception
exception
)
{
var
aggregate
=
exception
as
AggregateException
;
...
...
@@ -26,7 +25,7 @@ private static string GetStackForAggregateException(Exception exception, Aggrega
var
text
=
GetStackForException
(
exception
,
true
);
for
(
int
i
=
0
;
i
<
aggregate
.
InnerExceptions
.
Count
;
i
++)
{
text
=
string
.
Format
(
ServicesVSResources
.
_0_1_InnerException_2_3_4_5
,
text
,
text
=
string
.
Format
(
"{0}{1}---> (Inner Exception #{2}) {3}{4}{5}"
,
text
,
Environment
.
NewLine
,
i
,
GetFormattedExceptionStack
(
aggregate
.
InnerExceptions
[
i
]),
"<---"
,
Environment
.
NewLine
);
}
...
...
@@ -54,7 +53,7 @@ private static string GetStackForException(Exception exception, bool includeMess
else
{
stackText
+=
" ---> "
+
GetFormattedExceptionStack
(
innerException
)
+
Environment
.
NewLine
+
" "
+
ServicesVSResources
.
End_of_inner_exception_stack
;
" "
+
ServicesVSResources
.
End_of_inner_exception_stack
;
}
}
...
...
@@ -63,7 +62,7 @@ private static string GetStackForException(Exception exception, bool includeMess
private
static
string
GetAsyncStackTrace
(
Exception
exception
)
{
var
stackTrace
=
new
StackTrace
(
exception
,
true
);
var
stackTrace
=
new
StackTrace
(
exception
);
var
stackFrames
=
stackTrace
.
GetFrames
();
if
(
stackFrames
==
null
)
...
...
@@ -72,21 +71,17 @@ private static string GetAsyncStackTrace(Exception exception)
}
var
firstFrame
=
true
;
var
stringBuilder
=
new
StringBuilder
(
255
);
var
stringBuilder
=
new
StringBuilder
();
foreach
(
var
frame
in
stackFrames
)
{
var
method
=
frame
.
GetMethod
();
if
(
method
==
null
)
{
continue
;
}
var
declaringType
=
method
.
DeclaringType
;
var
declaringType
=
method
?.
DeclaringType
;
if
(
declaringType
!=
null
&&
typeof
(
INotifyCompletion
).
IsAssignableFrom
(
declaringType
))
{
continue
;
}
if
(
firstFrame
)
{
firstFrame
=
false
;
...
...
@@ -96,13 +91,13 @@ private static string GetAsyncStackTrace(Exception exception)
stringBuilder
.
Append
(
Environment
.
NewLine
);
}
stringBuilder
.
AppendFormat
(
"
{0} "
,
ServicesVSResources
.
at
);
stringBuilder
.
AppendFormat
(
"
at "
);
var
isAsync
=
FormatMethodName
(
stringBuilder
,
declaringType
);
if
(!
isAsync
)
{
stringBuilder
.
Append
(
method
.
Name
);
stringBuilder
.
Append
(
method
?
.
Name
);
var
methodInfo
=
method
as
MethodInfo
;
if
(
methodInfo
!=
null
&&
methodInfo
.
IsGenericMethod
)
if
(
methodInfo
?.
IsGenericMethod
==
true
)
{
FormatGenericArguments
(
stringBuilder
,
methodInfo
.
GetGenericArguments
());
}
...
...
@@ -140,7 +135,7 @@ private static bool FormatMethodName(StringBuilder stringBuilder, Type declaring
if
(
typeof
(
IAsyncStateMachine
).
GetTypeInfo
().
IsAssignableFrom
(
declaringType
))
{
isAsync
=
true
;
stringBuilder
.
Append
(
AsyncMethodPrefix
);
stringBuilder
.
Append
(
"async "
);
var
start
=
fullName
.
LastIndexOf
(
'<'
);
var
end
=
fullName
.
LastIndexOf
(
'>'
);
if
(
start
>=
0
&&
end
>=
0
)
...
...
@@ -168,43 +163,10 @@ private static void FormatGenericArguments(StringBuilder stringBuilder, Type[] g
return
;
}
stringBuilder
.
Append
(
"["
);
var
firstTypeParam
=
true
;
foreach
(
var
genericArgument
in
genericTypeArguments
)
{
if
(!
firstTypeParam
)
{
stringBuilder
.
Append
(
","
);
}
else
{
firstTypeParam
=
false
;
}
stringBuilder
.
Append
(
genericArgument
.
Name
);
}
stringBuilder
.
Append
(
"]"
);
stringBuilder
.
Append
(
"["
+
String
.
Join
(
","
,
genericTypeArguments
.
Select
(
args
=>
args
.
Name
))
+
"]"
);
}
private
static
void
FormatParameters
(
StringBuilder
stringBuilder
,
MethodBase
method
)
{
var
parameters
=
method
.
GetParameters
();
var
firstParam
=
true
;
foreach
(
var
t
in
parameters
)
{
if
(!
firstParam
)
{
stringBuilder
.
Append
(
", "
);
}
else
{
firstParam
=
false
;
}
var
typeName
=
t
.
ParameterType
?.
Name
??
"<UnknownType>"
;
stringBuilder
.
Append
(
typeName
+
" "
+
t
.
Name
);
}
}
private
static
void
FormatParameters
(
StringBuilder
stringBuilder
,
MethodBase
method
)
=>
stringBuilder
.
Append
(
string
.
Join
(
","
,
method
?.
GetParameters
().
Select
(
t
=>
(
t
.
ParameterType
?.
Name
??
"<UnknownType>"
)
+
" "
+
t
.
Name
)
??
Array
.
Empty
<
string
>()));
}
}
src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
浏览文件 @
490b39d6
...
...
@@ -60,15 +60,6 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to {0}{1}---> (Inner Exception #{2}) {3}{4}{5}.
/// </summary>
internal
static
string
_0_1_InnerException_2_3_4_5
{
get
{
return
ResourceManager
.
GetString
(
"_0_1_InnerException_2_3_4_5"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to '{0}' encountered an error and has been disabled..
/// </summary>
...
...
@@ -253,15 +244,6 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to at.
/// </summary>
internal
static
string
at
{
get
{
return
ResourceManager
.
GetString
(
"at"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Base Types.
/// </summary>
...
...
src/VisualStudio/Core/Def/ServicesVSResources.resx
浏览文件 @
490b39d6
...
...
@@ -705,18 +705,12 @@ Additional information: {1}</value>
<data
name=
"Close"
xml:space=
"preserve"
>
<value>
Close
</value>
</data>
<data
name=
"at"
xml:space=
"preserve"
>
<value>
at
</value>
</data>
<data
name=
"End_of_inner_exception_stack"
xml:space=
"preserve"
>
<value>
--- End of inner exception stack trace ---
</value>
</data>
<data
name=
"in_0_line_1"
xml:space=
"preserve"
>
<value>
in {0}:line {1}
</value>
</data>
<data
name=
"_0_1_InnerException_2_3_4_5"
xml:space=
"preserve"
>
<value>
{0}{1}---
>
(Inner Exception #{2}) {3}{4}{5}
</value>
</data>
<data
name=
"Unknown_parameters"
xml:space=
"preserve"
>
<value>
<
Unknown Parameters
>
</value>
</data>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录