Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
fd90dd44
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,发现更多精彩内容 >>
未验证
提交
fd90dd44
编写于
1月 31, 2020
作者:
M
msftbot[bot]
提交者:
GitHub
1月 31, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #41325 from dotnet/merges/master-to-release/dev16.6-preview1
Merge master to release/dev16.6-preview1
上级
7347b64a
3423ebac
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
83 addition
and
72 deletion
+83
-72
eng/build.ps1
eng/build.ps1
+11
-2
src/Compilers/Core/Portable/Compilation/CompilationOptions.cs
...Compilers/Core/Portable/Compilation/CompilationOptions.cs
+4
-4
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs
...Providers/ExtensionMethodImportCompletionProviderTests.cs
+10
-28
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
...tion/CompletionProviders/SymbolCompletionProviderTests.cs
+5
-5
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.cs
.../CompletionProviders/TypeImportCompletionProviderTests.cs
+5
-5
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.vb
...Providers/ExtensionMethodImportCompletionProviderTests.vb
+5
-1
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/SymbolCompletionProviderTests.vb
...tion/CompletionProviders/SymbolCompletionProviderTests.vb
+5
-1
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.vb
.../CompletionProviders/TypeImportCompletionProviderTests.vb
+5
-1
src/VisualStudio/Core/Impl/ProjectSystem/CPS/TempPECompiler.cs
...isualStudio/Core/Impl/ProjectSystem/CPS/TempPECompiler.cs
+19
-15
src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs
...le/Workspace/Solution/SolutionState.CompilationTracker.cs
+3
-10
src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs
...kspaces/Core/Portable/Workspace/Solution/SolutionState.cs
+6
-0
src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
+5
-0
未找到文件。
eng/build.ps1
浏览文件 @
fd90dd44
...
...
@@ -428,6 +428,11 @@ function TestUsingOptimizedRunner() {
if
(
$testIOperation
)
{
Remove-Item
env:\ROSLYN_TEST_IOPERATION
}
if
(
$testVsi
)
{
Write-Host
"Copying ServiceHub logs to
$LogDir
"
Copy-Item
-Path
(
Join-Path
$TempDir
"servicehub\logs"
)
-Destination
(
Join-Path
$LogDir
"servicehub"
)
-Recurse
}
}
}
...
...
@@ -622,7 +627,9 @@ try {
}
catch
{
echo
"##vso[task.logissue type=error](NETCORE_ENGINEERING_TELEMETRY=Build) Build failed"
if
(
$ci
)
{
echo
"##vso[task.logissue type=error](NETCORE_ENGINEERING_TELEMETRY=Build) Build failed"
}
throw
$_
}
...
...
@@ -642,7 +649,9 @@ try {
}
catch
{
echo
"##vso[task.logissue type=error](NETCORE_ENGINEERING_TELEMETRY=Test) Tests failed"
if
(
$ci
)
{
echo
"##vso[task.logissue type=error](NETCORE_ENGINEERING_TELEMETRY=Test) Tests failed"
}
throw
$_
}
...
...
src/Compilers/Core/Portable/Compilation/CompilationOptions.cs
浏览文件 @
fd90dd44
...
...
@@ -386,7 +386,7 @@ public CompilationOptions WithGeneralDiagnosticOption(ReportDiagnostic value)
/// <summary>
/// Creates a new options instance with the specified diagnostic-specific options.
/// </summary>
public
CompilationOptions
WithSpecificDiagnosticOptions
(
ImmutableDictionary
<
string
,
ReportDiagnostic
>
value
)
public
CompilationOptions
WithSpecificDiagnosticOptions
(
ImmutableDictionary
<
string
,
ReportDiagnostic
>
?
value
)
{
return
CommonWithSpecificDiagnosticOptions
(
value
);
}
...
...
@@ -497,7 +497,7 @@ public CompilationOptions WithCryptoKeyContainer(string? cryptoKeyContainer)
return
CommonWithCryptoKeyContainer
(
cryptoKeyContainer
);
}
public
CompilationOptions
WithCryptoKeyFile
(
string
cryptoKeyFile
)
public
CompilationOptions
WithCryptoKeyFile
(
string
?
cryptoKeyFile
)
{
return
CommonWithCryptoKeyFile
(
cryptoKeyFile
);
}
...
...
@@ -531,14 +531,14 @@ public CompilationOptions WithOverflowChecks(bool checkOverflow)
protected
abstract
CompilationOptions
CommonWithAssemblyIdentityComparer
(
AssemblyIdentityComparer
comparer
);
protected
abstract
CompilationOptions
CommonWithStrongNameProvider
(
StrongNameProvider
?
provider
);
protected
abstract
CompilationOptions
CommonWithGeneralDiagnosticOption
(
ReportDiagnostic
generalDiagnosticOption
);
protected
abstract
CompilationOptions
CommonWithSpecificDiagnosticOptions
(
ImmutableDictionary
<
string
,
ReportDiagnostic
>
specificDiagnosticOptions
);
protected
abstract
CompilationOptions
CommonWithSpecificDiagnosticOptions
(
ImmutableDictionary
<
string
,
ReportDiagnostic
>
?
specificDiagnosticOptions
);
protected
abstract
CompilationOptions
CommonWithSpecificDiagnosticOptions
(
IEnumerable
<
KeyValuePair
<
string
,
ReportDiagnostic
>>
specificDiagnosticOptions
);
protected
abstract
CompilationOptions
CommonWithReportSuppressedDiagnostics
(
bool
reportSuppressedDiagnostics
);
protected
abstract
CompilationOptions
CommonWithModuleName
(
string
?
moduleName
);
protected
abstract
CompilationOptions
CommonWithMainTypeName
(
string
?
mainTypeName
);
protected
abstract
CompilationOptions
CommonWithScriptClassName
(
string
scriptClassName
);
protected
abstract
CompilationOptions
CommonWithCryptoKeyContainer
(
string
?
cryptoKeyContainer
);
protected
abstract
CompilationOptions
CommonWithCryptoKeyFile
(
string
cryptoKeyFile
);
protected
abstract
CompilationOptions
CommonWithCryptoKeyFile
(
string
?
cryptoKeyFile
);
protected
abstract
CompilationOptions
CommonWithCryptoPublicKey
(
ImmutableArray
<
byte
>
cryptoPublicKey
);
protected
abstract
CompilationOptions
CommonWithDelaySign
(
bool
?
delaySign
);
protected
abstract
CompilationOptions
CommonWithCheckOverflow
(
bool
checkOverflow
);
...
...
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs
浏览文件 @
fd90dd44
...
...
@@ -20,6 +20,10 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionPr
[
UseExportProvider
]
public
class
ExtensionMethodImportCompletionProviderTests
:
AbstractCSharpCompletionProviderTests
{
private
static
readonly
IExportProviderFactory
s_exportProviderFactory
=
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
typeof
(
TestExperimentationService
)));
public
ExtensionMethodImportCompletionProviderTests
(
CSharpTestWorkspaceFixture
workspaceFixture
)
:
base
(
workspaceFixture
)
{
}
...
...
@@ -36,11 +40,7 @@ protected override OptionSet WithChangedOptions(OptionSet options)
}
protected
override
ExportProvider
GetExportProvider
()
{
return
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
typeof
(
TestExperimentationService
)))
.
CreateExportProvider
();
}
=>
s_exportProviderFactory
.
CreateExportProvider
();
internal
override
CompletionProvider
CreateCompletionProvider
()
{
...
...
@@ -76,34 +76,16 @@ private static IEnumerable<List<object>> BuiltInTypes
{
get
{
var
predefinedTypes
=
new
List
<
List
<
string
>>
{
new
List
<
string
>()
{
"int"
,
"Int32"
,
"System.Int32"
},
new
List
<
string
>()
{
"float"
,
"Single"
,
"System.Single"
},
new
List
<
string
>()
{
"uint"
,
"UInt32"
,
"System.UInt32"
},
new
List
<
string
>()
{
"bool"
,
"Boolean"
,
"System.Boolean"
},
new
List
<
string
>()
{
"string"
,
"String"
,
"System.String"
},
new
List
<
string
>()
{
"object"
,
"Object"
,
"System.Object"
},
};
var
predefinedTypes
=
new
List
<
string
>()
{
"string"
,
"String"
,
"System.String"
};
var
arraySuffixes
=
new
[]
{
""
,
"[]"
,
"[,]"
};
foreach
(
var
group
in
predefinedTypes
)
foreach
(
var
type1
in
predefinedTypes
)
{
foreach
(
var
type
1
in
group
)
foreach
(
var
type
2
in
predefinedTypes
)
{
foreach
(
var
type2
in
group
)
foreach
(
var
suffix
in
arraySuffixes
)
{
foreach
(
var
suffix
in
arraySuffixes
)
{
yield
return
new
List
<
object
>()
{
type1
+
suffix
,
type2
+
suffix
};
}
yield
return
new
List
<
object
>()
{
type1
+
suffix
,
type2
+
suffix
};
}
}
}
...
...
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SymbolCompletionProviderTests.cs
浏览文件 @
fd90dd44
...
...
@@ -25,6 +25,10 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionSe
[
UseExportProvider
]
public
partial
class
SymbolCompletionProviderTests
:
AbstractCSharpCompletionProviderTests
{
private
static
readonly
IExportProviderFactory
s_exportProviderFactory
=
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
typeof
(
TestExperimentationService
)));
public
SymbolCompletionProviderTests
(
CSharpTestWorkspaceFixture
workspaceFixture
)
:
base
(
workspaceFixture
)
{
}
...
...
@@ -35,11 +39,7 @@ internal override CompletionProvider CreateCompletionProvider()
}
protected
override
ExportProvider
GetExportProvider
()
{
return
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
typeof
(
TestExperimentationService
)))
.
CreateExportProvider
();
}
=>
s_exportProviderFactory
.
CreateExportProvider
();
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
EmptyFile
()
...
...
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.cs
浏览文件 @
fd90dd44
...
...
@@ -22,6 +22,10 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionPr
[
UseExportProvider
]
public
class
TypeImportCompletionProviderTests
:
AbstractCSharpCompletionProviderTests
{
private
static
readonly
IExportProviderFactory
s_exportProviderFactory
=
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
typeof
(
TestExperimentationService
)));
public
TypeImportCompletionProviderTests
(
CSharpTestWorkspaceFixture
workspaceFixture
)
:
base
(
workspaceFixture
)
{
}
...
...
@@ -43,11 +47,7 @@ protected override OptionSet WithChangedOptions(OptionSet options)
}
protected
override
ExportProvider
GetExportProvider
()
{
return
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
typeof
(
TestExperimentationService
)))
.
CreateExportProvider
();
}
=>
s_exportProviderFactory
.
CreateExportProvider
();
#
region
"Option tests"
...
...
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.vb
浏览文件 @
fd90dd44
...
...
@@ -15,6 +15,10 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
Public
Class
ExtensionMethodImportCompletionProviderTests
Inherits
AbstractVisualBasicCompletionProviderTests
Private
Shared
ReadOnly
s_exportProviderFactory
As
IExportProviderFactory
=
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
GetType
(
TestExperimentationService
)))
Public
Sub
New
(
workspaceFixture
As
VisualBasicTestWorkspaceFixture
)
MyBase
.
New
(
workspaceFixture
)
End
Sub
...
...
@@ -32,7 +36,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
End
Function
Protected
Overrides
Function
GetExportProvider
()
As
ExportProvider
Return
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
GetType
(
TestExperimentationService
)))
.
CreateExportProvider
()
Return
s_exportProviderFactory
.
CreateExportProvider
()
End
Function
Friend
Overrides
Function
CreateCompletionProvider
()
As
CompletionProvider
...
...
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/SymbolCompletionProviderTests.vb
浏览文件 @
fd90dd44
...
...
@@ -18,6 +18,10 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
Private
Const
s_unicodeEllipsis
=
ChrW
(
&
H2026
)
Private
Shared
ReadOnly
s_exportProviderFactory
As
IExportProviderFactory
=
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
GetType
(
TestExperimentationService
)))
Public
Sub
New
(
workspaceFixture
As
VisualBasicTestWorkspaceFixture
)
MyBase
.
New
(
workspaceFixture
)
End
Sub
...
...
@@ -27,7 +31,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
End
Function
Protected
Overrides
Function
GetExportProvider
()
As
ExportProvider
Return
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
GetType
(
TestExperimentationService
)))
.
CreateExportProvider
()
Return
s_exportProviderFactory
.
CreateExportProvider
()
End
Function
#Region "StandaloneNamespaceAndTypeSourceTests"
...
...
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.vb
浏览文件 @
fd90dd44
...
...
@@ -15,6 +15,10 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
Public
Class
TypeImportCompletionProviderTests
Inherits
AbstractVisualBasicCompletionProviderTests
Private
Shared
ReadOnly
s_exportProviderFactory
As
IExportProviderFactory
=
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
GetType
(
TestExperimentationService
)))
Public
Sub
New
(
workspaceFixture
As
VisualBasicTestWorkspaceFixture
)
MyBase
.
New
(
workspaceFixture
)
End
Sub
...
...
@@ -30,7 +34,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
End
Function
Protected
Overrides
Function
GetExportProvider
()
As
ExportProvider
Return
ExportProviderCache
.
GetOrCreateExportProviderFactory
(
TestExportProvider
.
EntireAssemblyCatalogWithCSharpAndVisualBasic
.
WithPart
(
GetType
(
TestExperimentationService
)))
.
CreateExportProvider
()
Return
s_exportProviderFactory
.
CreateExportProvider
()
End
Function
Friend
Overrides
Function
CreateCompletionProvider
()
As
CompletionProvider
...
...
src/VisualStudio/Core/Impl/ProjectSystem/CPS/TempPECompiler.cs
浏览文件 @
fd90dd44
...
...
@@ -2,14 +2,17 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.ComponentModel.Composition
;
using
System.IO
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.
Host
;
using
Microsoft.CodeAnalysis.
Shared.Extensions
;
using
Microsoft.VisualStudio.LanguageServices.ProjectSystem
;
using
Roslyn.Utilities
;
...
...
@@ -37,22 +40,27 @@ public async Task<bool> CompileAsync(IWorkspaceProjectContext context, string ou
throw
new
ArgumentException
(
nameof
(
outputFileName
),
"Must specify an output file name."
);
}
var
project
=
_workspace
.
CurrentSolution
.
GetProject
(
context
.
Id
);
var
project
=
_workspace
.
CurrentSolution
.
GetRequiredProject
(
context
.
Id
);
// Start by fetching the compilation we have already have that will have references correct
var
compilation
=
await
project
.
GetRequiredCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
//
Remove all files except the ones we care about
var
documents
=
project
.
Documents
;
foreach
(
var
document
in
d
ocuments
)
//
Update to just the syntax trees we need to keep
var
syntaxTrees
=
new
List
<
SyntaxTree
>(
capacity
:
filesToInclude
.
Count
)
;
foreach
(
var
document
in
project
.
D
ocuments
)
{
if
(
!
filesToInclude
.
Contains
(
document
.
FilePath
))
if
(
document
.
FilePath
!=
null
&&
filesToInclude
.
Contains
(
document
.
FilePath
))
{
project
=
project
.
RemoveDocument
(
document
.
Id
);
syntaxTrees
.
Add
(
await
document
.
GetRequiredSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
false
)
);
}
cancellationToken
.
ThrowIfCancellationRequested
();
}
compilation
=
compilation
.
RemoveAllSyntaxTrees
().
AddSyntaxTrees
(
syntaxTrees
);
// We need to inherit most of the projects options, mainly for VB (RootNamespace, GlobalImports etc.), but we need to override about some specific things surrounding the output
var
options
=
project
.
Compilation
Options
compilation
=
compilation
.
WithOptions
(
compilation
.
Options
// copied from the old TempPE compiler used by legacy, for parity.
// See: https://github.com/dotnet/roslyn/blob/fab7134296816fc80019c60b0f5bef7400cf23ea/src/VisualStudio/CSharp/Impl/ProjectSystemShim/TempPECompilerService.cs#L58
.
WithAssemblyIdentityComparer
(
DesktopAssemblyIdentityComparer
.
Default
)
...
...
@@ -70,14 +78,10 @@ public async Task<bool> CompileAsync(IWorkspaceProjectContext context, string ou
.
WithDelaySign
(
false
)
.
WithCryptoKeyFile
(
null
)
.
WithPublicSign
(
false
)
.
WithStrongNameProvider
(
null
);
project
=
project
.
WithCompilationOptions
(
options
)
// AssemblyName should be set to the filename of the output file because multiple TempPE DLLs can be created for the same project
.
WithAssemblyName
(
Path
.
GetFileName
(
outputFileName
));
.
WithStrongNameProvider
(
null
));
var
compilation
=
await
project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
// AssemblyName should be set to the filename of the output file because multiple TempPE DLLs can be created for the same project
compilation
=
compilation
.
WithAssemblyName
(
Path
.
GetFileName
(
outputFileName
));
cancellationToken
.
ThrowIfCancellationRequested
();
...
...
src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs
浏览文件 @
fd90dd44
...
...
@@ -510,21 +510,14 @@ private async Task<Compilation> GetOrBuildDeclarationCompilationAsync(SolutionSt
var
compilation
=
CreateEmptyCompilation
();
var
trees
=
ArrayBuilder
<
SyntaxTree
>.
GetInstance
(
ProjectState
.
DocumentIds
.
Count
);
foreach
(
var
document
in
this
.
ProjectState
.
OrderedDocumentStates
)
foreach
(
var
document
in
ProjectState
.
OrderedDocumentStates
)
{
cancellationToken
.
ThrowIfCancellationRequested
();
// Do not include syntax trees for documents whose content failed to load.
// Analyzers should not run on these (empty) syntax trees.
var
loadDiagnostic
=
await
document
.
GetLoadDiagnosticAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
if
(
loadDiagnostic
==
null
)
{
trees
.
Add
(
await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
false
));
}
// Include the tree even if the content of the document failed to load.
trees
.
Add
(
await
document
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
false
));
}
compilation
=
compilation
.
AddSyntaxTrees
(
trees
);
trees
.
Free
();
WriteState
(
new
FullDeclarationState
(
compilation
),
solution
);
...
...
src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.cs
浏览文件 @
fd90dd44
...
...
@@ -1995,6 +1995,9 @@ public bool TryGetCompilation(ProjectId projectId, [NotNullWhen(returnValue: tru
/// Returns the compilation for the specified <see cref="ProjectId"/>. Can return <see langword="null"/> when the project
/// does not support compilations.
/// </summary>
/// <remarks>
/// The compilation is guaranteed to have a syntax tree for each document of the project.
/// </remarks>
private
Task
<
Compilation
?>
GetCompilationAsync
(
ProjectId
projectId
,
CancellationToken
cancellationToken
)
{
// TODO: figure out where this is called and why the nullable suppression is required
...
...
@@ -2005,6 +2008,9 @@ public bool TryGetCompilation(ProjectId projectId, [NotNullWhen(returnValue: tru
/// Returns the compilation for the specified <see cref="ProjectState"/>. Can return <see langword="null"/> when the project
/// does not support compilations.
/// </summary>
/// <remarks>
/// The compilation is guaranteed to have a syntax tree for each document of the project.
/// </remarks>
public
Task
<
Compilation
?>
GetCompilationAsync
(
ProjectState
project
,
CancellationToken
cancellationToken
)
{
return
project
.
SupportsCompilation
...
...
src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs
浏览文件 @
fd90dd44
...
...
@@ -1273,6 +1273,11 @@ public async Task TestDocumentFileAccessFailureMissingFile()
Assert
.
Equal
(
@"C:\doesnotexist.cs: (0,0)-(0,0)"
,
diagnostic
.
Location
.
GetLineSpan
().
ToString
());
Assert
.
Equal
(
WorkspaceDiagnosticKind
.
Failure
,
diagnosticFromEvent
.
Kind
);
Assert
.
Equal
(
""
,
text
.
ToString
());
// Verify invariant: The compilation is guaranteed to have a syntax tree for each document of the project (even if the contnet fails to load).
var
compilation
=
await
solution
.
State
.
GetCompilationAsync
(
doc
.
Project
.
State
,
CancellationToken
.
None
).
ConfigureAwait
(
false
);
var
syntaxTree
=
compilation
.
SyntaxTrees
.
Single
();
Assert
.
Equal
(
""
,
syntaxTree
.
ToString
());
}
[
Fact
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录