Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
79d5850f
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,发现更多精彩内容 >>
提交
79d5850f
编写于
2月 16, 2016
作者:
G
Gen Lu
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'dotnet/master' into MergeFromMaster
上级
0b0e4906
bd417db6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
80 addition
and
64 deletion
+80
-64
src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioWorkspaceDiagnosticAnalyzerProviderService.cs
...VisualStudioWorkspaceDiagnosticAnalyzerProviderService.cs
+3
-56
src/VisualStudio/Core/Def/Implementation/GCManager.cs
src/VisualStudio/Core/Def/Implementation/GCManager.cs
+28
-0
src/VisualStudio/Core/Def/Implementation/TableDataSource/Suppression/SuppressionStateColumnFilterDefinition.cs
...rce/Suppression/SuppressionStateColumnFilterDefinition.cs
+23
-0
src/VisualStudio/Core/Def/Implementation/VirtualMemoryNotificationListener.cs
...e/Def/Implementation/VirtualMemoryNotificationListener.cs
+7
-0
src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
+1
-0
src/VisualStudio/Core/Test/Diagnostics/MockExtensionManager.vb
...isualStudio/Core/Test/Diagnostics/MockExtensionManager.vb
+17
-7
src/VisualStudio/Core/Test/Diagnostics/VisualStudioWorkspaceDiagnosticAnalyzerProviderServiceTests.vb
...lStudioWorkspaceDiagnosticAnalyzerProviderServiceTests.vb
+1
-1
未找到文件。
src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioWorkspaceDiagnosticAnalyzerProviderService.cs
浏览文件 @
79d5850f
...
...
@@ -37,17 +37,7 @@ public VisualStudioWorkspaceDiagnosticAnalyzerProviderService(VisualStudioWorksp
// Get the analyzer assets for installed VSIX extensions through the VSIX extension manager.
var
extensionManager
=
workspace
.
GetVsService
<
SVsExtensionManager
,
IVsExtensionManager
>();
// get rootfolder and shellfolder location
string
rootFolder
;
string
shellFolder
;
if
(
TryGetRootAndShellFolder
(
extensionManager
,
out
shellFolder
,
out
rootFolder
))
{
_hostDiagnosticAnalyzerInfo
=
GetHostAnalyzerPackagesWithName
(
extensionManager
,
rootFolder
,
shellFolder
);
return
;
}
// if we can't get rootFolder/shellFolder location, use old behavior.
_hostDiagnosticAnalyzerInfo
=
GetHostAnalyzerPackages
(
extensionManager
);
_hostDiagnosticAnalyzerInfo
=
GetHostAnalyzerPackagesWithName
(
extensionManager
);
}
public
IEnumerable
<
HostDiagnosticAnalyzerPackage
>
GetHostDiagnosticAnalyzerPackages
()
...
...
@@ -67,14 +57,14 @@ internal static IAnalyzerAssemblyLoader GetLoader()
}
// internal for testing purpose
internal
static
ImmutableArray
<
HostDiagnosticAnalyzerPackage
>
GetHostAnalyzerPackagesWithName
(
IVsExtensionManager
extensionManager
,
string
rootFolder
,
string
shellFolder
)
internal
static
ImmutableArray
<
HostDiagnosticAnalyzerPackage
>
GetHostAnalyzerPackagesWithName
(
IVsExtensionManager
extensionManager
)
{
var
builder
=
ImmutableArray
.
CreateBuilder
<
HostDiagnosticAnalyzerPackage
>();
foreach
(
var
extension
in
extensionManager
.
GetEnabledExtensions
(
AnalyzerContentTypeName
))
{
var
name
=
extension
.
Header
.
LocalizedName
;
var
assemblies
=
extension
.
Content
.
Where
(
ShouldInclude
)
.
Select
(
c
=>
GetContentLocation
(
shellFolder
,
rootFolder
,
extension
.
InstallPath
,
c
.
RelativePath
))
.
Select
(
c
=>
extension
.
GetContentLocation
(
c
))
.
WhereNotNull
();
builder
.
Add
(
new
HostDiagnosticAnalyzerPackage
(
name
,
assemblies
.
ToImmutableArray
()));
...
...
@@ -100,49 +90,6 @@ internal static ImmutableArray<HostDiagnosticAnalyzerPackage> GetHostAnalyzerPac
return
ImmutableArray
.
Create
(
new
HostDiagnosticAnalyzerPackage
(
name
:
null
,
assemblies
:
references
.
ToImmutable
()));
}
private
static
bool
TryGetRootAndShellFolder
(
IVsExtensionManager
extensionManager
,
out
string
shellFolder
,
out
string
rootFolder
)
{
// use reflection to get this information. currently there is no other way to get this information
shellFolder
=
GetProperty
(
extensionManager
,
"ShellFolder"
);
rootFolder
=
GetProperty
(
extensionManager
,
"RootFolder"
);
return
!
string
.
IsNullOrEmpty
(
rootFolder
)
&&
!
string
.
IsNullOrEmpty
(
shellFolder
);
}
private
static
string
GetContentLocation
(
string
shellFolder
,
string
rootFolder
,
string
installPath
,
string
relativePath
)
{
// extension manager should expose an API that doesn't require this.
const
string
ShellFolderToken
=
"$ShellFolder$"
;
const
string
RootFolderToken
=
"$RootFolder$"
;
if
(
relativePath
.
StartsWith
(
ShellFolderToken
))
{
return
relativePath
.
Replace
(
ShellFolderToken
,
shellFolder
);
}
else
if
(
relativePath
.
StartsWith
(
RootFolderToken
))
{
return
relativePath
.
Replace
(
RootFolderToken
,
rootFolder
);
}
string
contentLocation
=
null
;
try
{
contentLocation
=
Path
.
Combine
(
installPath
,
relativePath
);
}
//Path.Combine will throw an ArgumentException if either of the two path arguments contain illegal characters.
//We'll just catch this exception here and ignore the paths with illegal characters.
catch
(
ArgumentException
)
{
}
return
contentLocation
;
}
private
static
string
GetProperty
(
IVsExtensionManager
extensionManager
,
string
propertyName
)
{
return
(
string
)
extensionManager
.
GetType
().
GetProperty
(
propertyName
,
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
)?.
GetValue
(
extensionManager
);
}
private
static
bool
ShouldInclude
(
IExtensionContent
content
)
{
return
string
.
Equals
(
content
.
ContentTypeName
,
AnalyzerContentTypeName
,
StringComparison
.
InvariantCultureIgnoreCase
);
...
...
src/VisualStudio/Core/Def/Implementation/GCManager.cs
浏览文件 @
79d5850f
...
...
@@ -49,6 +49,34 @@ static GCManager()
});
}
/// <summary>
/// Turn off low latency GC mode.
///
/// if there is a pending low latency mode request, Latency mode will go back to its original status as
/// pending request timeout. once it goes back to its original status, it will not go back to low latency mode again.
/// </summary>
internal
static
void
TurnOffLowLatencyMode
()
{
if
(
s_delayMilliseconds
<=
0
)
{
// if it is already turned off, we don't do anything.
return
;
}
// first set delay to 0 to turn it off
s_delayMilliseconds
=
0
;
// explictly call Full GC to remove impact of SustainedLowLatency
// this is based on finding on https://github.com/dotnet/roslyn/issues/6802
// one of reason we do this here is so that GC do compact on fragmented memory.
// which will in return let us have bigger continuous free memory chunk.
for
(
var
i
=
0
;
i
<
5
;
i
++)
{
GC
.
Collect
();
GC
.
WaitForPendingFinalizers
();
}
}
/// <summary>
/// Call this method to suppress expensive blocking Gen 2 garbage GCs in
/// scenarios where high-latency is unacceptable (e.g. processing typing input).
...
...
src/VisualStudio/Core/Def/Implementation/TableDataSource/Suppression/SuppressionStateColumnFilterDefinition.cs
0 → 100644
浏览文件 @
79d5850f
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System.ComponentModel.Composition
;
using
Microsoft.VisualStudio.Utilities
;
using
Microsoft.Internal.VisualStudio.Shell.TableControl
;
using
System
;
namespace
Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource
{
/// <summary>
/// Supporession column definition filter
/// </summary>
/// <remarks>
/// TODO: Move this column down to the shell as it is shared by multiple issue sources (Roslyn and FxCop).
/// </remarks>
[
Export
(
typeof
(
EntryFilterDefinition
))]
[
Name
(
SuppressionStateColumnDefinition
.
ColumnName
)]
internal
class
SuppressionStateColumnFilterDefinition
:
EntryFilterDefinition
{
public
override
bool
HasAttribute
(
string
key
)
=>
string
.
Equals
(
NonActionable
,
key
,
StringComparison
.
OrdinalIgnoreCase
);
}
}
src/VisualStudio/Core/Def/Implementation/VirtualMemoryNotificationListener.cs
浏览文件 @
79d5850f
...
...
@@ -8,6 +8,7 @@
using
Microsoft.CodeAnalysis.Internal.Log
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Shared.Options
;
using
Microsoft.VisualStudio.LanguageServices.Implementation
;
using
Microsoft.VisualStudio.Shell
;
using
Microsoft.VisualStudio.Shell.Interop
;
...
...
@@ -79,6 +80,12 @@ public int OnBroadcastMessage(uint msg, IntPtr wParam, IntPtr lParam)
_workspace
.
Services
.
GetService
<
IErrorReportingService
>().
ShowErrorInfo
(
ServicesVSResources
.
FullSolutionAnalysisOff
,
()
=>
{
});
}
// turn off low latency GC mode.
// once we hit this, not hitting "Out of memory" exception is more important than typing being smooth all the time.
// once it is turned off, user will hit time to time keystroke which responsive time is more than 50ms. in our own perf lab,
// about 1-2% was over 50ms with this off when we first introduced this GC mode.
GCManager
.
TurnOffLowLatencyMode
();
break
;
}
}
...
...
src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
浏览文件 @
79d5850f
...
...
@@ -79,6 +79,7 @@
<Compile
Include=
"Implementation\SolutionSize\SolutionSizeTracker.cs"
/>
<Compile
Include=
"Implementation\TableDataSource\DiagnosticTableControlEventProcessorProvider.AggregateDiagnosticTableControlEventProcessor.cs"
/>
<Compile
Include=
"Implementation\TableDataSource\Suppression\IVisualStudioDiagnosticListSuppressionStateService.cs"
/>
<Compile
Include=
"Implementation\TableDataSource\Suppression\SuppressionStateColumnFilterDefinition.cs"
/>
<Compile
Include=
"Implementation\TableDataSource\Suppression\VisualStudioDiagnosticListTableCommandHandler.cs"
/>
<Compile
Include=
"Implementation\TableDataSource\Suppression\VisualStudioDiagnosticListSuppressionStateService.cs"
/>
<Compile
Include=
"Implementation\TableDataSource\Suppression\DiagnosticTableControlEventProcessorProvider.SuppressionStateProcessor.cs"
/>
...
...
src/VisualStudio/Core/Test/Diagnostics/MockExtensionManager.vb
浏览文件 @
79d5850f
...
...
@@ -2,6 +2,7 @@
Imports
System.ComponentModel
Imports
System.Globalization
Imports
System.IO
Imports
System.Xml
Imports
Microsoft.CodeAnalysis
Imports
Microsoft.VisualStudio.ExtensionManager
...
...
@@ -29,18 +30,27 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
Assert
.
Equal
(
_contentType
,
contentTypeName
)
For
Each
location
In
_locations
Dim
installedExceptionMock
As
New
Mock
(
Of
IInstalledExtension
)(
MockBehavior
.
Strict
)
installedExceptionMock
.
SetupGet
(
Function
(
m
)
m
.
InstallPath
).
Returns
(
"\InstallPath"
)
installedExceptionMock
.
SetupGet
(
Function
(
m
)
m
.
Content
).
Returns
(
SpecializedCollections
.
SingletonEnumerable
(
Of
IExtensionContent
)(
New
MockContent
(
_contentType
,
location
)))
Dim
installedExtensionMock
As
New
Mock
(
Of
IInstalledExtension
)(
MockBehavior
.
Strict
)
Dim
contentMock
=
New
MockContent
(
_contentType
,
location
)
installedExtensionMock
.
SetupGet
(
Function
(
m
)
m
.
Content
).
Returns
(
SpecializedCollections
.
SingletonEnumerable
(
Of
IExtensionContent
)(
contentMock
))
installedExtensionMock
.
Setup
(
Function
(
m
)
m
.
GetContentLocation
(
contentMock
)).
Returns
(
Function
()
If
contentMock
.
RelativePath
.
IndexOf
(
"$RootFolder$"
)
>=
0
Then
Return
contentMock
.
RelativePath
.
Replace
(
"$RootFolder$"
,
"ResolvedRootFolder"
)
ElseIf
contentMock
.
RelativePath
.
IndexOf
(
"$ShellFolder$"
)
>=
0
Then
Return
contentMock
.
RelativePath
.
Replace
(
"$ShellFolder$"
,
"ResolvedShellFolder"
)
Else
Return
Path
.
Combine
(
"\InstallPath"
,
contentMock
.
RelativePath
)
End
If
End
Function
)
Dim
headerMock
As
New
Mock
(
Of
IExtensionHeader
)(
MockBehavior
.
Strict
)
headerMock
.
SetupGet
(
Function
(
h
)
h
.
LocalizedName
).
Returns
(
"Vsix"
)
installedEx
cept
ionMock
.
SetupGet
(
Function
(
m
)
m
.
Header
).
Returns
(
headerMock
.
Object
)
installedEx
tens
ionMock
.
SetupGet
(
Function
(
m
)
m
.
Header
).
Returns
(
headerMock
.
Object
)
Yield
installedEx
cept
ionMock
.
Object
Yield
installedEx
tens
ionMock
.
Object
Next
End
Function
...
...
src/VisualStudio/Core/Test/Diagnostics/VisualStudioWorkspaceDiagnosticAnalyzerProviderServiceTests.vb
浏览文件 @
79d5850f
...
...
@@ -13,7 +13,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
<
Fact
>
Public
Sub
GetHostAnalyzerPackagesWithNameTest
()
Dim
extensionManager
=
New
MockExtensionManager
(
"Microsoft.VisualStudio.Analyzer"
,
"$RootFolder$\test\test.dll"
,
"$ShellFolder$\test\test.dll"
,
"test\test.dll"
)
Dim
packages
=
VisualStudioWorkspaceDiagnosticAnalyzerProviderService
.
GetHostAnalyzerPackagesWithName
(
extensionManager
,
"ResolvedRootFolder"
,
"ResolvedShellFolder"
)
Dim
packages
=
VisualStudioWorkspaceDiagnosticAnalyzerProviderService
.
GetHostAnalyzerPackagesWithName
(
extensionManager
)
Assert
.
Equal
(
packages
.
Count
(),
3
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录