Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
a10f631a
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,发现更多精彩内容 >>
提交
a10f631a
编写于
10月 18, 2016
作者:
H
Heejae Chang
提交者:
GitHub
10月 18, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14594 from heejaechang/dllloading
avoid loading dlls not needed
上级
7195b964
f5dbc0a9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
60 addition
and
7 deletion
+60
-7
src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioDiagnosticAnalyzerExecutor.cs
...ion/Diagnostics/VisualStudioDiagnosticAnalyzerExecutor.cs
+12
-2
src/Workspaces/Core/Portable/Execution/CustomAsset.cs
src/Workspaces/Core/Portable/Execution/CustomAsset.cs
+45
-0
src/Workspaces/Core/Portable/Execution/CustomAssetBuilder.cs
src/Workspaces/Core/Portable/Execution/CustomAssetBuilder.cs
+3
-5
未找到文件。
src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioDiagnosticAnalyzerExecutor.cs
浏览文件 @
a10f631a
...
...
@@ -78,7 +78,7 @@ internal class VisualStudioDiagnosticAnalyzerExecutor : ICodeAnalysisDiagnosticA
}
var
optionAsset
=
GetOptionsAsset
(
solution
,
project
.
Language
,
cancellationToken
);
var
hostChecksums
=
GetHostAnalyzerReferences
(
snapshotService
,
_analyzerService
.
GetHostAnalyzerReferences
(),
cancellationToken
);
var
hostChecksums
=
GetHostAnalyzerReferences
(
snapshotService
,
project
.
Language
,
_analyzerService
.
GetHostAnalyzerReferences
(),
cancellationToken
);
var
argument
=
new
DiagnosticArguments
(
analyzerDriver
.
AnalysisOptions
.
ReportSuppressedDiagnostics
,
...
...
@@ -158,12 +158,22 @@ private void ReportAnalyzerExceptions(Project project, ImmutableDictionary<Diagn
}
}
private
ImmutableArray
<
byte
[
]>
GetHostAnalyzerReferences
(
ISolutionSynchronizationService
snapshotService
,
IEnumerable
<
AnalyzerReference
>
references
,
CancellationToken
cancellationToken
)
private
ImmutableArray
<
byte
[
]>
GetHostAnalyzerReferences
(
ISolutionSynchronizationService
snapshotService
,
string
language
,
IEnumerable
<
AnalyzerReference
>
references
,
CancellationToken
cancellationToken
)
{
// TODO: cache this to somewhere
var
builder
=
ImmutableArray
.
CreateBuilder
<
byte
[
]>
();
foreach
(
var
reference
in
references
)
{
var
analyzers
=
reference
.
GetAnalyzers
(
language
);
if
(
analyzers
.
Length
==
0
)
{
// skip reference that doesn't contain any analyzers for the given language
// we do this so that we don't load analyzer dlls that MEF exported from vsix
// not related to this solution
continue
;
}
var
asset
=
snapshotService
.
GetGlobalAsset
(
reference
,
cancellationToken
);
builder
.
Add
(
asset
.
Checksum
.
ToArray
());
}
...
...
src/Workspaces/Core/Portable/Execution/CustomAsset.cs
浏览文件 @
a10f631a
...
...
@@ -3,6 +3,8 @@
using
System
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Serialization
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.Execution
...
...
@@ -48,4 +50,47 @@ private static Checksum CreateChecksumFromStreamWriter(string kind, Action<Objec
}
}
}
/// <summary>
/// workspace analyzer specific asset.
///
/// we need this to prevent dlls from other languages such as typescript, f#, xaml and etc
/// from loading at OOP start up.
///
/// unlike project analyzer, analyzer that got installed from vsix doesn't do shadow copying
/// so we don't need to load assembly to find out actual filepath.
///
/// this also will be temporary solution for RC since we will move to MVID for checksum soon
/// </summary>
internal
sealed
class
WorkspaceAnalyzerReferenceAsset
:
CustomAsset
{
private
readonly
AnalyzerReference
_reference
;
private
readonly
Serializer
_serializer
;
public
WorkspaceAnalyzerReferenceAsset
(
AnalyzerReference
reference
,
Serializer
serializer
)
:
base
(
CreateChecksum
(
reference
),
WellKnownSynchronizationKinds
.
AnalyzerReference
)
{
_reference
=
reference
;
_serializer
=
serializer
;
}
public
override
Task
WriteObjectToAsync
(
ObjectWriter
writer
,
CancellationToken
cancellationToken
)
{
_serializer
.
SerializeAnalyzerReference
(
_reference
,
writer
,
cancellationToken
);
return
SpecializedTasks
.
EmptyTask
;
}
private
static
Checksum
CreateChecksum
(
AnalyzerReference
reference
)
{
using
(
var
stream
=
SerializableBytes
.
CreateWritableStream
())
using
(
var
objectWriter
=
new
ObjectWriter
(
stream
))
{
objectWriter
.
WriteString
(
WellKnownSynchronizationKinds
.
AnalyzerReference
);
objectWriter
.
WriteString
(
reference
.
FullPath
);
return
Checksum
.
Create
(
stream
);
}
}
}
}
src/Workspaces/Core/Portable/Execution/CustomAssetBuilder.cs
浏览文件 @
a10f631a
...
...
@@ -23,16 +23,14 @@ public CustomAsset Build(OptionSet options, string language, CancellationToken c
{
cancellationToken
.
ThrowIfCancellationRequested
();
return
new
SimpleCustomAsset
(
WellKnownSynchronizationKinds
.
OptionSet
,
(
writer
,
cancellationTokenOnStreamWriting
)
=>
return
new
SimpleCustomAsset
(
WellKnownSynchronizationKinds
.
OptionSet
,
(
writer
,
cancellationTokenOnStreamWriting
)
=>
_serializer
.
SerializeOptionSet
(
options
,
language
,
writer
,
cancellationTokenOnStreamWriting
));
}
public
CustomAsset
Build
(
AnalyzerReference
reference
,
CancellationToken
cancellationToken
)
{
return
new
SimpleCustomAsset
(
WellKnownSynchronizationKinds
.
AnalyzerReference
,
(
writer
,
cancellationTokenOnStreamWriting
)
=>
_serializer
.
SerializeAnalyzerReference
(
reference
,
writer
,
cancellationTokenOnStreamWriting
));
return
new
WorkspaceAnalyzerReferenceAsset
(
reference
,
_serializer
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录