Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c5f85165
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,发现更多精彩内容 >>
提交
c5f85165
编写于
3月 25, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add netcoreapp3.1 target for the features layer
上级
7c63d34b
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
63 addition
and
41 deletion
+63
-41
src/Analyzers/Core/Analyzers/UseCoalesceExpression/AbstractUseCoalesceExpressionForNullableDiagnosticAnalyzer.cs
...ractUseCoalesceExpressionForNullableDiagnosticAnalyzer.cs
+1
-1
src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerDiagnosticAnalyzer.cs
...zer/AbstractUseCollectionInitializerDiagnosticAnalyzer.cs
+1
-1
src/Features/CSharp/Portable/CodeFixes/AddExplicitCast/InheritanceDistanceComparer.cs
.../CodeFixes/AddExplicitCast/InheritanceDistanceComparer.cs
+7
-2
src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs
...table/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs
+6
-6
src/Features/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.Features.csproj
...rp/Portable/Microsoft.CodeAnalysis.CSharp.Features.csproj
+1
-1
src/Features/Core/Portable/CodeFixes/Configuration/ConfigurationUpdater.cs
.../Portable/CodeFixes/Configuration/ConfigurationUpdater.cs
+1
-1
src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs
.../Core/Portable/CodeRefactorings/CodeRefactoringService.cs
+1
-1
src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractImportCompletionCacheServiceFactory.cs
...onProvider/AbstractImportCompletionCacheServiceFactory.cs
+1
-1
src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs
...CompletionProvider/AbstractTypeImportCompletionService.cs
+1
-0
src/Features/Core/Portable/Diagnostics/AnalyzerHelper.cs
src/Features/Core/Portable/Diagnostics/AnalyzerHelper.cs
+1
-1
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateSet.cs
...ostics/EngineV2/DiagnosticIncrementalAnalyzer.StateSet.cs
+3
-2
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs
...ble/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs
+1
-1
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
...V2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
+17
-5
src/Features/Core/Portable/Diagnostics/HostDiagnosticAnalyzers.cs
...ures/Core/Portable/Diagnostics/HostDiagnosticAnalyzers.cs
+1
-1
src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
...rtable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
+8
-7
src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs
...eatures/Core/Portable/EditAndContinue/DebuggingSession.cs
+1
-1
src/Features/Core/Portable/ExtractMethod/MethodExtractor.Analyzer.cs
...s/Core/Portable/ExtractMethod/MethodExtractor.Analyzer.cs
+1
-1
src/Features/Core/Portable/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeAction.cs
...HashCodeFromMembers/GenerateEqualsAndGetHashCodeAction.cs
+1
-1
src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.DisposePatternCodeAction.cs
...ractImplementInterfaceService.DisposePatternCodeAction.cs
+1
-1
src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj
...ures/Core/Portable/Microsoft.CodeAnalysis.Features.csproj
+1
-1
src/Features/Core/Portable/SimplifyInterpolation/Helpers.cs
src/Features/Core/Portable/SimplifyInterpolation/Helpers.cs
+1
-1
src/Features/Core/Portable/UseSystemHashCode/Analyzer.cs
src/Features/Core/Portable/UseSystemHashCode/Analyzer.cs
+1
-1
src/Features/Core/Portable/ValidateFormatString/AbstractValidateFormatStringDiagnosticAnalyzer.cs
...tString/AbstractValidateFormatStringDiagnosticAnalyzer.cs
+4
-2
src/Features/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Features.vbproj
...rtable/Microsoft.CodeAnalysis.VisualBasic.Features.vbproj
+1
-1
未找到文件。
src/Analyzers/Core/Analyzers/UseCoalesceExpression/AbstractUseCoalesceExpressionForNullableDiagnosticAnalyzer.cs
浏览文件 @
c5f85165
...
...
@@ -108,7 +108,7 @@ private void AnalyzeSyntax(SyntaxNodeAnalysisContext context)
// actually looking at something Nullable (and not some type that uses a similar
// syntactic pattern).
var
semanticModel
=
context
.
SemanticModel
;
var
nullableType
=
semanticModel
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
Nullable
<>).
FullName
);
var
nullableType
=
semanticModel
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
Nullable
<>).
FullName
!
);
if
(
nullableType
==
null
)
{
return
;
...
...
src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerDiagnosticAnalyzer.cs
浏览文件 @
c5f85165
...
...
@@ -49,7 +49,7 @@ protected override void InitializeWorker(AnalysisContext context)
private
void
OnCompilationStart
(
CompilationStartAnalysisContext
context
)
{
var
ienumerableType
=
context
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerable
).
FullName
);
var
ienumerableType
=
context
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerable
).
FullName
!
);
if
(
ienumerableType
!=
null
)
{
var
syntaxKinds
=
GetSyntaxFacts
().
SyntaxKinds
;
...
...
src/Features/CSharp/Portable/CodeFixes/AddExplicitCast/InheritanceDistanceComparer.cs
浏览文件 @
c5f85165
...
...
@@ -30,7 +30,7 @@ namespace Microsoft.CodeAnalysis.CSharp.CodeFixes.AddExplicitCast
///
/// 'Derived1' is less specific than 'Derived2' compared to 'Base'
/// </summary>
internal
sealed
class
InheritanceDistanceComparer
:
IComparer
<
ITypeSymbol
>
internal
sealed
class
InheritanceDistanceComparer
:
IComparer
<
ITypeSymbol
?
>
{
private
readonly
ITypeSymbol
_baseType
;
private
readonly
SemanticModel
_semanticModel
;
...
...
@@ -41,8 +41,13 @@ public InheritanceDistanceComparer(SemanticModel semanticModel, ITypeSymbol base
_baseType
=
baseType
;
}
public
int
Compare
(
ITypeSymbol
x
,
ITypeSymbol
y
)
public
int
Compare
(
ITypeSymbol
?
x
,
ITypeSymbol
?
y
)
{
if
(
x
is
null
)
return
y
is
null
?
0
:
-
1
;
else
if
(
y
is
null
)
return
1
;
var
xDist
=
GetInheritanceDistance
(
x
);
var
yDist
=
GetInheritanceDistance
(
y
);
return
xDist
.
CompareTo
(
yDist
);
...
...
src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs
浏览文件 @
c5f85165
...
...
@@ -117,10 +117,10 @@ public override ImmutableArray<string> FixableDiagnosticIds
private
bool
IsCorrectTypeForYieldReturn
(
ITypeSymbol
typeArgument
,
ITypeSymbol
returnExpressionType
,
ITypeSymbol
methodReturnType
,
SemanticModel
model
)
{
var
ienumerableSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerable
).
FullName
);
var
ienumeratorSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerator
).
FullName
);
var
ienumerableGenericSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerable
<>).
FullName
);
var
ienumeratorGenericSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerator
<>).
FullName
);
var
ienumerableSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerable
).
FullName
!
);
var
ienumeratorSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerator
).
FullName
!
);
var
ienumerableGenericSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerable
<>).
FullName
!
);
var
ienumeratorGenericSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerator
<>).
FullName
!
);
if
(
ienumerableGenericSymbol
==
null
||
ienumerableSymbol
==
null
||
...
...
@@ -190,8 +190,8 @@ private bool CanConvertTypes(ITypeSymbol typeArgument, ITypeSymbol returnExpress
private
bool
IsCorrectTypeForYieldReturn
(
ITypeSymbol
methodReturnType
,
SemanticModel
model
)
{
var
ienumerableSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerable
).
FullName
);
var
ienumeratorSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerator
).
FullName
);
var
ienumerableSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerable
).
FullName
!
);
var
ienumeratorSymbol
=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEnumerator
).
FullName
!
);
if
(
ienumerableSymbol
==
null
||
ienumeratorSymbol
==
null
)
...
...
src/Features/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.Features.csproj
浏览文件 @
c5f85165
...
...
@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>
Library
</OutputType>
<RootNamespace>
Microsoft.CodeAnalysis.CSharp
</RootNamespace>
<TargetFramework
>
netstandard2.0
</TargetFramework
>
<TargetFramework
s>
netcoreapp3.1;netstandard2.0
</TargetFrameworks
>
<ApplyNgenOptimization>
partial
</ApplyNgenOptimization>
<!-- NuGet -->
...
...
src/Features/Core/Portable/CodeFixes/Configuration/ConfigurationUpdater.cs
浏览文件 @
c5f85165
...
...
@@ -274,7 +274,7 @@ private async Task<Solution> ConfigureAsync()
// Otherwise, add analyzer config document to all applicable projects for the current project's solution.
AnalyzerConfigDocument
?
analyzerConfigDocument
=
null
;
var
analyzerConfigDirectory
=
PathUtilities
.
GetDirectoryName
(
analyzerConfigPath
);
var
analyzerConfigDirectory
=
PathUtilities
.
GetDirectoryName
(
analyzerConfigPath
)
??
throw
ExceptionUtilities
.
Unreachable
;
var
currentSolution
=
_project
.
Solution
;
foreach
(
var
projectId
in
_project
.
Solution
.
ProjectIds
)
{
...
...
src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs
浏览文件 @
c5f85165
...
...
@@ -287,7 +287,7 @@ private ImmutableArray<CodeRefactoringProvider> CreateRefactorings(string langua
attribute
.
Languages
.
Length
==
0
||
attribute
.
Languages
.
Contains
(
language
))
{
builder
.
Add
((
CodeRefactoringProvider
)
Activator
.
CreateInstance
(
typeInfo
.
AsType
()));
builder
.
Add
((
CodeRefactoringProvider
)
Activator
.
CreateInstance
(
typeInfo
.
AsType
())
!
);
}
}
}
...
...
src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractImportCompletionCacheServiceFactory.cs
浏览文件 @
c5f85165
...
...
@@ -35,7 +35,7 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
return
new
ImportCompletionCacheService
(
_peItemsCache
,
_projectItemsCache
);
}
private
void
OnCacheFlushRequested
(
object
sender
,
EventArgs
e
)
private
void
OnCacheFlushRequested
(
object
?
sender
,
EventArgs
e
)
{
_peItemsCache
.
Clear
();
_projectItemsCache
.
Clear
();
...
...
src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs
浏览文件 @
c5f85165
...
...
@@ -215,6 +215,7 @@ static bool HasGlobalAlias(MetadataReference? metadataReference)
bool
forceCacheCreation
,
IDictionary
<
TKey
,
CacheEntry
>
cache
,
CancellationToken
cancellationToken
)
where
TKey
:
notnull
{
var
language
=
syntaxContext
.
SemanticModel
.
Language
;
...
...
src/Features/Core/Portable/Diagnostics/AnalyzerHelper.cs
浏览文件 @
c5f85165
...
...
@@ -91,7 +91,7 @@ public static (string analyzerId, VersionStamp version) GetAnalyzerIdAndVersion(
}
public
static
string
GetAnalyzerAssemblyName
(
this
DiagnosticAnalyzer
analyzer
)
=>
analyzer
.
GetType
().
Assembly
.
GetName
().
Name
;
=>
analyzer
.
GetType
().
Assembly
.
GetName
().
Name
??
throw
ExceptionUtilities
.
Unreachable
;
public
static
OptionSet
GetAnalyzerOptionSet
(
this
AnalyzerOptions
analyzerOptions
,
SyntaxTree
syntaxTree
,
CancellationToken
cancellationToken
)
{
...
...
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateSet.cs
浏览文件 @
c5f85165
...
...
@@ -6,6 +6,7 @@
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Diagnostics.CodeAnalysis
;
using
System.Linq
;
using
System.Threading
;
using
System.Threading.Tasks
;
...
...
@@ -125,10 +126,10 @@ public bool IsActiveFile(DocumentId documentId)
public
bool
FromBuild
(
ProjectId
projectId
)
=>
_projectStates
.
TryGetValue
(
projectId
,
out
var
projectState
)
&&
projectState
.
FromBuild
;
public
bool
TryGetActiveFileState
(
DocumentId
documentId
,
out
ActiveFileState
state
)
public
bool
TryGetActiveFileState
(
DocumentId
documentId
,
[
NotNullWhen
(
true
)]
out
ActiveFileState
?
state
)
=>
_activeFileStates
.
TryGetValue
(
documentId
,
out
state
);
public
bool
TryGetProjectState
(
ProjectId
projectId
,
out
ProjectState
state
)
public
bool
TryGetProjectState
(
ProjectId
projectId
,
[
NotNullWhen
(
true
)]
out
ProjectState
?
state
)
=>
_projectStates
.
TryGetValue
(
projectId
,
out
state
);
public
ActiveFileState
GetOrCreateActiveFileState
(
DocumentId
documentId
)
...
...
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs
浏览文件 @
c5f85165
...
...
@@ -100,7 +100,7 @@ public bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs
#pragma warning restore CS0618 // Type or member is obsolete
}
private
void
OnProjectAnalyzerReferenceChanged
(
object
sender
,
ProjectAnalyzerReferenceChangedEventArgs
e
)
private
void
OnProjectAnalyzerReferenceChanged
(
object
?
sender
,
ProjectAnalyzerReferenceChangedEventArgs
e
)
{
if
(
e
.
Removed
.
Length
==
0
)
{
...
...
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs
浏览文件 @
c5f85165
...
...
@@ -440,15 +440,27 @@ internal static bool AreEquivalent(Diagnostic[] diagnosticsA, Diagnostic[] diagn
return
set
.
SetEquals
(
diagnosticsB
);
}
private
sealed
class
DiagnosticComparer
:
IEqualityComparer
<
Diagnostic
>
private
sealed
class
DiagnosticComparer
:
IEqualityComparer
<
Diagnostic
?
>
{
internal
static
readonly
DiagnosticComparer
Instance
=
new
DiagnosticComparer
();
public
bool
Equals
(
Diagnostic
x
,
Diagnostic
y
)
=>
x
.
Id
==
y
.
Id
&&
x
.
Location
==
y
.
Location
;
public
bool
Equals
(
Diagnostic
?
x
,
Diagnostic
?
y
)
{
if
(
x
is
null
)
return
y
is
null
;
else
if
(
y
is
null
)
return
false
;
return
x
.
Id
==
y
.
Id
&&
x
.
Location
==
y
.
Location
;
}
public
int
GetHashCode
(
Diagnostic
obj
)
=>
Hash
.
Combine
(
obj
.
Id
.
GetHashCode
(),
obj
.
Location
.
GetHashCode
());
public
int
GetHashCode
(
Diagnostic
?
obj
)
{
if
(
obj
is
null
)
return
0
;
return
Hash
.
Combine
(
obj
.
Id
.
GetHashCode
(),
obj
.
Location
.
GetHashCode
());
}
}
#endif
}
...
...
src/Features/Core/Portable/Diagnostics/HostDiagnosticAnalyzers.cs
浏览文件 @
c5f85165
...
...
@@ -322,7 +322,7 @@ public HostAnalyzerReferenceDiagnosticReporter(AbstractHostDiagnosticUpdateSourc
_primaryWorkspace
=
primaryWorkspace
;
}
public
void
OnAnalyzerLoadFailed
(
object
sender
,
AnalyzerLoadFailureEventArgs
e
)
public
void
OnAnalyzerLoadFailed
(
object
?
sender
,
AnalyzerLoadFailureEventArgs
e
)
{
if
(!(
sender
is
AnalyzerFileReference
reference
))
{
...
...
src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
浏览文件 @
c5f85165
...
...
@@ -2108,11 +2108,11 @@ private static int CompareLineChanges(LineChange x, LineChange y)
#
region
Semantic
Analysis
private
sealed
class
AssemblyEqualityComparer
:
IEqualityComparer
<
IAssemblySymbol
>
private
sealed
class
AssemblyEqualityComparer
:
IEqualityComparer
<
IAssemblySymbol
?
>
{
public
static
readonly
IEqualityComparer
<
IAssemblySymbol
>
Instance
=
new
AssemblyEqualityComparer
();
public
static
readonly
IEqualityComparer
<
IAssemblySymbol
?
>
Instance
=
new
AssemblyEqualityComparer
();
public
bool
Equals
(
IAssemblySymbol
x
,
IAssemblySymbol
y
)
public
bool
Equals
(
IAssemblySymbol
?
x
,
IAssemblySymbol
?
y
)
{
// Types defined in old source assembly need to be treated as equivalent to types in the new source assembly,
// provided that they only differ in their containing assemblies.
...
...
@@ -2123,11 +2123,11 @@ public bool Equals(IAssemblySymbol x, IAssemblySymbol y)
// a single PE symbol. Thus comparing assemblies by identity partitions them so that each partition
// contains assemblies that originated from the same Gen0 assembly.
return
x
.
Identity
.
Equals
(
y
.
Identity
);
return
Equals
(
x
?.
Identity
,
y
?
.
Identity
);
}
public
int
GetHashCode
(
IAssemblySymbol
obj
)
=>
obj
.
Identity
.
GetHashCode
()
;
public
int
GetHashCode
(
IAssemblySymbol
?
obj
)
=>
obj
?.
Identity
.
GetHashCode
()
??
0
;
}
protected
static
readonly
SymbolEquivalenceComparer
s_assemblyEqualityComparer
=
new
SymbolEquivalenceComparer
(
...
...
@@ -2727,7 +2727,7 @@ private static bool HasBackingField(IEventSymbol @event)
return
false
;
}
lazyLayoutAttribute
??=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
StructLayoutAttribute
).
FullName
);
lazyLayoutAttribute
??=
model
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
StructLayoutAttribute
).
FullName
!
);
if
(
lazyLayoutAttribute
==
null
)
{
return
false
;
...
...
@@ -3397,6 +3397,7 @@ private static void MarkVariables(ref BitVector mask, ImmutableArray<ISymbol> va
}
private
static
void
BuildIndex
<
TKey
>(
Dictionary
<
TKey
,
int
>
index
,
ImmutableArray
<
TKey
>
array
)
where
TKey
:
notnull
{
for
(
var
i
=
0
;
i
<
array
.
Length
;
i
++)
{
...
...
src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs
浏览文件 @
c5f85165
...
...
@@ -248,7 +248,7 @@ public async Task<(Guid Mvid, Diagnostic? Error)> GetProjectModuleIdAsync(Projec
{
Debug
.
Assert
(
Thread
.
CurrentThread
.
GetApartmentState
()
==
ApartmentState
.
MTA
,
"SymReader requires MTA"
);
EmitBaseline
baseline
;
EmitBaseline
?
baseline
;
lock
(
_projectEmitBaselinesGuard
)
{
if
(
_projectEmitBaselines
.
TryGetValue
(
projectId
,
out
baseline
))
...
...
src/Features/Core/Portable/ExtractMethod/MethodExtractor.Analyzer.cs
浏览文件 @
c5f85165
...
...
@@ -628,7 +628,7 @@ private bool WellKnownFrameworkValueType(Compilation compilation, ITypeSymbol ty
return
false
;
}
var
cancellationTokenType
=
compilation
.
GetTypeByMetadataName
(
typeof
(
CancellationToken
).
FullName
);
var
cancellationTokenType
=
compilation
.
GetTypeByMetadataName
(
typeof
(
CancellationToken
).
FullName
!
);
if
(
cancellationTokenType
!=
null
&&
cancellationTokenType
.
Equals
(
type
))
{
return
true
;
...
...
src/Features/Core/Portable/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeAction.cs
浏览文件 @
c5f85165
...
...
@@ -111,7 +111,7 @@ protected override async Task<Document> GetChangedDocumentAsync(CancellationToke
return
null
;
var
semanticModel
=
await
_document
.
GetRequiredSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
equatableType
=
semanticModel
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEquatable
<>).
FullName
);
var
equatableType
=
semanticModel
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
IEquatable
<>).
FullName
!
);
if
(
equatableType
==
null
)
return
null
;
...
...
src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.DisposePatternCodeAction.cs
浏览文件 @
c5f85165
...
...
@@ -292,7 +292,7 @@ public override string Title
statements
.
Add
(
g
.
ExpressionStatement
(
g
.
InvocationExpression
(
g
.
MemberAccessExpression
(
g
.
TypeExpression
(
compilation
.
GetTypeByMetadataName
(
typeof
(
GC
).
FullName
)),
g
.
TypeExpression
(
compilation
.
GetTypeByMetadataName
(
typeof
(
GC
).
FullName
!
)),
nameof
(
GC
.
SuppressFinalize
)),
g
.
ThisExpression
())));
...
...
src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj
浏览文件 @
c5f85165
...
...
@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>
Library
</OutputType>
<RootNamespace>
Microsoft.CodeAnalysis
</RootNamespace>
<TargetFramework
>
netstandard2.0
</TargetFramework
>
<TargetFramework
s>
netcoreapp3.1;netstandard2.0
</TargetFrameworks
>
<ApplyNgenOptimization>
partial
</ApplyNgenOptimization>
<AllowUnsafeBlocks>
true
</AllowUnsafeBlocks>
...
...
src/Features/Core/Portable/SimplifyInterpolation/Helpers.cs
浏览文件 @
c5f85165
...
...
@@ -77,7 +77,7 @@ private static IOperation Unwrap(IOperation expression)
{
if
(
invocation
.
Arguments
.
Length
==
1
&&
invocation
.
Arguments
[
0
].
Value
is
ILiteralOperation
{
ConstantValue
:
{
HasValue
:
true
,
Value
:
string
value
}
}
literal
&&
invocation
.
SemanticModel
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
System
.
IFormattable
).
FullName
)
is
{
}
systemIFormattable
&&
invocation
.
SemanticModel
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
System
.
IFormattable
).
FullName
!
)
is
{
}
systemIFormattable
&&
invocation
.
Instance
.
Type
.
Implements
(
systemIFormattable
))
{
unwrapped
=
invocation
.
Instance
;
...
...
src/Features/Core/Portable/UseSystemHashCode/Analyzer.cs
浏览文件 @
c5f85165
...
...
@@ -41,7 +41,7 @@ public static bool TryGetAnalyzer(Compilation compilation, [NotNullWhen(true)] o
// This may not find anything. However, CanAnalyze checks for this. So
// we represent the value as non-nullable for all future code.
var
objectGetHashCodeMethod
=
objectType
?.
GetMembers
(
nameof
(
GetHashCode
)).
FirstOrDefault
()
as
IMethodSymbol
;
var
equalityComparerType
=
compilation
.
GetTypeByMetadataName
(
typeof
(
EqualityComparer
<>).
FullName
);
var
equalityComparerType
=
compilation
.
GetTypeByMetadataName
(
typeof
(
EqualityComparer
<>).
FullName
!
);
var
systemHashCodeType
=
compilation
.
GetTypeByMetadataName
(
"System.HashCode"
);
if
(
systemHashCodeType
==
null
||
objectGetHashCodeMethod
==
null
)
...
...
src/Features/Core/Portable/ValidateFormatString/AbstractValidateFormatStringDiagnosticAnalyzer.cs
浏览文件 @
c5f85165
...
...
@@ -71,7 +71,7 @@ public override void Initialize(AnalysisContext context)
context
.
RegisterCompilationStartAction
(
startContext
=>
{
var
formatProviderType
=
startContext
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
System
.
IFormatProvider
).
FullName
);
var
formatProviderType
=
startContext
.
Compilation
.
GetTypeByMetadataName
(
typeof
(
System
.
IFormatProvider
).
FullName
!
);
if
(
formatProviderType
==
null
)
{
return
;
...
...
@@ -343,8 +343,10 @@ private bool FormatCallWorksAtRuntime(string formatString, int numberOfPlacehold
var
formatStringWithEscapedBracketsChangedToSpaces
=
RemoveEscapedBrackets
(
formatString
);
var
matches
=
s_extractPlaceholdersRegex
.
Matches
(
formatStringWithEscapedBracketsChangedToSpaces
);
foreach
(
Match
match
in
matches
)
foreach
(
Match
?
match
in
matches
)
{
RoslynDebug
.
AssertNotNull
(
match
);
var
textInsideBrackets
=
match
.
Groups
[
1
].
Value
;
if
(!
PlaceholderIndexIsValid
(
textInsideBrackets
,
numberOfPlaceholderArguments
))
...
...
src/Features/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Features.vbproj
浏览文件 @
c5f85165
...
...
@@ -3,7 +3,7 @@
<Project
Sdk=
"Microsoft.NET.Sdk"
>
<PropertyGroup>
<OutputType>
Library
</OutputType>
<TargetFramework
>
netstandard2.0
</TargetFramework
>
<TargetFramework
s>
netcoreapp3.1;netstandard2.0
</TargetFrameworks
>
<RootNamespace></RootNamespace>
<ApplyNgenOptimization>
partial
</ApplyNgenOptimization>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录