Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
61ca87cb
R
runtime
项目概览
dotNET Platform
/
runtime
大约 1 年 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
61ca87cb
编写于
6月 09, 2022
作者:
B
Buyaa Namnan
提交者:
GitHub
6月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update analyzer version and fix new findings (#70157)
上级
a0662e38
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
38 addition
and
41 deletion
+38
-41
eng/CodeAnalysis.src.globalconfig
eng/CodeAnalysis.src.globalconfig
+3
-0
eng/CodeAnalysis.test.globalconfig
eng/CodeAnalysis.test.globalconfig
+3
-0
src/installer/managed/Microsoft.NET.HostModel/ComHost/ClsidMap.cs
...aller/managed/Microsoft.NET.HostModel/ComHost/ClsidMap.cs
+2
-2
src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
...ft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
+2
-6
src/libraries/Microsoft.XmlSerializer.Generator/src/Sgen.cs
src/libraries/Microsoft.XmlSerializer.Generator/src/Sgen.cs
+1
-3
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs
...Composition/AttributedModel/AttributedExportDefinition.cs
+2
-2
src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs
...nManager/src/System/Configuration/ConfigurationElement.cs
+2
-2
src/libraries/System.Data.Common/src/System/Data/XMLSchema.cs
...libraries/System.Data.Common/src/System/Data/XMLSchema.cs
+4
-4
src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DbConnectionOptions.cs
...Odbc/src/Common/System/Data/Common/DbConnectionOptions.cs
+4
-5
src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_Query.cs
...irectoryServices/AccountManagement/AD/ADStoreCtx_Query.cs
+3
-4
src/libraries/System.IO.Packaging/src/System/IO/Packaging/Package.cs
...es/System.IO.Packaging/src/System/IO/Packaging/Package.cs
+4
-4
src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs
...System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs
+6
-7
src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlNodeReader.cs
...es/System.Private.Xml/src/System/Xml/Dom/XmlNodeReader.cs
+1
-1
src/libraries/System.Speech/src/Internal/SrgsCompiler/BackEnd.cs
...raries/System.Speech/src/Internal/SrgsCompiler/BackEnd.cs
+1
-1
未找到文件。
eng/CodeAnalysis.src.globalconfig
浏览文件 @
61ca87cb
...
...
@@ -411,6 +411,9 @@ dotnet_diagnostic.CA1852.severity = warning
# CA1853: Unnecessary call to 'Dictionary.ContainsKey(key)'
dotnet_diagnostic.CA1853.severity = warning
# CA1854: Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
dotnet_diagnostic.CA1854.severity = warning
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none
...
...
eng/CodeAnalysis.test.globalconfig
浏览文件 @
61ca87cb
...
...
@@ -408,6 +408,9 @@ dotnet_diagnostic.CA1852.severity = none
# CA1853: Unnecessary call to 'Dictionary.ContainsKey(key)'
dotnet_diagnostic.CA1853.severity = none
# CA1854: Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
dotnet_diagnostic.CA1854.severity = none
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none
...
...
src/installer/managed/Microsoft.NET.HostModel/ComHost/ClsidMap.cs
浏览文件 @
61ca87cb
...
...
@@ -46,9 +46,9 @@ public static void Create(MetadataReader metadataReader, string clsidMapPath)
Guid
guid
=
GetTypeGuid
(
metadataReader
,
definition
);
string
guidString
=
GetTypeGuid
(
metadataReader
,
definition
).
ToString
(
"B"
);
if
(
clsidMap
.
ContainsKey
(
guidString
))
if
(
clsidMap
.
TryGetValue
(
guidString
,
out
ClsidEntry
value
))
{
throw
new
ConflictingGuidException
(
clsidMap
[
guidString
]
.
Type
,
GetTypeName
(
metadataReader
,
definition
),
guid
);
throw
new
ConflictingGuidException
(
value
.
Type
,
GetTypeName
(
metadataReader
,
definition
),
guid
);
}
string
progId
=
GetProgId
(
metadataReader
,
definition
);
...
...
src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
浏览文件 @
61ca87cb
...
...
@@ -1004,10 +1004,8 @@ private static void RaiseEvent(bool checkFinalization, object key, params object
lock
(
s_eventLockObject
)
{
if
(
s_handlers
!=
null
&&
s_handlers
.
ContainsKey
(
key
))
if
(
s_handlers
!=
null
&&
s_handlers
.
TryGetValue
(
key
,
out
List
<
SystemEventInvokeInfo
>?
invokeItems
))
{
List
<
SystemEventInvokeInfo
>
invokeItems
=
s_handlers
[
key
];
// clone the list so we don't have this type locked and cause
// a deadlock if someone tries to modify handlers during an invoke.
if
(
invokeItems
!=
null
)
...
...
@@ -1068,10 +1066,8 @@ private static void RemoveEventHandler(object key, Delegate? value)
lock
(
s_eventLockObject
)
{
if
(
s_handlers
!=
null
&&
s_handlers
.
ContainsKey
(
key
))
if
(
s_handlers
!=
null
&&
s_handlers
.
TryGetValue
(
key
,
out
List
<
SystemEventInvokeInfo
>?
invokeItems
))
{
List
<
SystemEventInvokeInfo
>
invokeItems
=
s_handlers
[
key
];
invokeItems
.
Remove
(
new
SystemEventInvokeInfo
(
value
));
}
}
...
...
src/libraries/Microsoft.XmlSerializer.Generator/src/Sgen.cs
浏览文件 @
61ca87cb
...
...
@@ -618,10 +618,8 @@ private static Assembly SgenAssemblyResolver(object source, ResolveEventArgs e)
return
null
;
}
if
(
s_referencedic
.
ContainsKey
(
assemblynam
e
))
if
(
s_referencedic
.
TryGetValue
(
assemblyname
,
out
string
referenc
e
))
{
string
reference
=
s_referencedic
[
assemblyname
];
// For System.ServiceModel.Primitives, we need to load its runtime assembly rather than reference assembly
if
(
assemblyname
.
Equals
(
"System.ServiceModel.Primitives"
))
{
...
...
src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs
浏览文件 @
61ca87cb
...
...
@@ -46,9 +46,9 @@ public AttributedExportDefinition(AttributedPartCreationInfo partCreationInfo, M
metadata
.
Add
(
CompositionConstants
.
ExportTypeIdentityMetadataName
,
typeIdentity
);
var
partMetadata
=
_partCreationInfo
.
GetMetadata
();
if
(
partMetadata
!=
null
&&
partMetadata
.
ContainsKey
(
CompositionConstants
.
PartCreationPolicyMetadataNam
e
))
if
(
partMetadata
!=
null
&&
partMetadata
.
TryGetValue
(
CompositionConstants
.
PartCreationPolicyMetadataName
,
out
object
?
valu
e
))
{
metadata
.
Add
(
CompositionConstants
.
PartCreationPolicyMetadataName
,
partMetadata
[
CompositionConstants
.
PartCreationPolicyMetadataName
]
);
metadata
.
Add
(
CompositionConstants
.
PartCreationPolicyMetadataName
,
value
);
}
if
((
_typeIdentityType
!=
null
)
&&
(
_member
.
MemberType
!=
MemberTypes
.
Method
)
&&
_typeIdentityType
.
ContainsGenericParameters
)
...
...
src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs
浏览文件 @
61ca87cb
...
...
@@ -831,8 +831,8 @@ private static void ApplyValidator(ConfigurationElement elem)
{
Debug
.
Assert
(
elem
!=
null
);
if
((
s_perTypeValidators
!=
null
)
&&
s_perTypeValidators
.
ContainsKey
(
elem
.
GetType
()
))
elem
.
_elementProperty
=
new
ConfigurationElementProperty
(
s_perTypeValidators
[
elem
.
GetType
()]
);
if
((
s_perTypeValidators
!=
null
)
&&
s_perTypeValidators
.
TryGetValue
(
elem
.
GetType
(),
out
ConfigurationValidatorBase
value
))
elem
.
_elementProperty
=
new
ConfigurationElementProperty
(
value
);
}
protected
void
SetPropertyValue
(
ConfigurationProperty
prop
,
object
value
,
bool
ignoreLocks
)
...
...
src/libraries/System.Data.Common/src/System/Data/XMLSchema.cs
浏览文件 @
61ca87cb
...
...
@@ -1349,9 +1349,9 @@ internal void HandleKeyref(XmlSchemaKeyref keyref)
if
(
FromInference
&&
relation
.
Nested
)
{
if
(
_tableDictionary
!.
ContainsKey
(
relation
.
ParentTabl
e
))
if
(
_tableDictionary
!.
TryGetValue
(
relation
.
ParentTable
,
out
List
<
DataTable
>?
valu
e
))
{
_tableDictionary
[
relation
.
ParentTable
]
.
Add
(
relation
.
ChildTable
);
value
.
Add
(
relation
.
ChildTable
);
}
}
...
...
@@ -1762,9 +1762,9 @@ internal DataTable InstantiateTable(XmlSchemaElement node, XmlSchemaComplexType
_tableChild
.
DataSet
!.
Relations
.
Add
(
relation
);
if
(
FromInference
&&
relation
.
Nested
)
{
if
(
_tableDictionary
!.
ContainsKey
(
relation
.
ParentTabl
e
))
if
(
_tableDictionary
!.
TryGetValue
(
relation
.
ParentTable
,
out
List
<
DataTable
>?
valu
e
))
{
_tableDictionary
[
relation
.
ParentTable
]
.
Add
(
relation
.
ChildTable
);
value
.
Add
(
relation
.
ChildTable
);
}
}
}
...
...
src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DbConnectionOptions.cs
浏览文件 @
61ca87cb
...
...
@@ -77,14 +77,13 @@ internal bool HasBlankPassword
{
if
(!
ConvertValueToIntegratedSecurity
())
{
if
(
_parsetable
.
ContainsKey
(
KEY
.
Password
))
if
(
_parsetable
.
TryGetValue
(
KEY
.
Password
,
out
string
?
value
))
{
return
string
.
IsNullOrEmpty
(
_parsetable
[
KEY
.
Password
]
);
return
string
.
IsNullOrEmpty
(
value
);
}
else
if
(
_parsetable
.
ContainsKey
(
SYNONYM
.
Pwd
))
else
if
(
_parsetable
.
TryGetValue
(
SYNONYM
.
Pwd
,
out
string
?
val
))
{
return
string
.
IsNullOrEmpty
(
_parsetable
[
SYNONYM
.
Pwd
]
);
// MDAC 83097
return
string
.
IsNullOrEmpty
(
val
);
// MDAC 83097
}
else
{
...
...
src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_Query.cs
浏览文件 @
61ca87cb
...
...
@@ -44,11 +44,10 @@ private void BuildExtensionPropertyList(Hashtable propertyList, Type p)
protected
void
BuildPropertySet
(
Type
p
,
StringCollection
propertySet
)
{
if
(
TypeToLdapPropListMap
[
this
.
MappingTableIndex
].
ContainsKey
(
p
))
if
(
TypeToLdapPropListMap
[
this
.
MappingTableIndex
].
TryGetValue
(
p
,
out
StringCollection
value
))
{
Debug
.
Assert
(
TypeToLdapPropListMap
[
this
.
MappingTableIndex
].
ContainsKey
(
p
));
string
[]
props
=
new
string
[
TypeToLdapPropListMap
[
this
.
MappingTableIndex
][
p
].
Count
];
TypeToLdapPropListMap
[
this
.
MappingTableIndex
][
p
].
CopyTo
(
props
,
0
);
string
[]
props
=
new
string
[
value
.
Count
];
value
.
CopyTo
(
props
,
0
);
propertySet
.
AddRange
(
props
);
}
else
...
...
src/libraries/System.IO.Packaging/src/System/IO/Packaging/Package.cs
浏览文件 @
61ca87cb
...
...
@@ -316,12 +316,12 @@ public void DeletePart(Uri partUri)
PackUriHelper
.
ValidatedPartUri
validatedPartUri
=
(
PackUriHelper
.
ValidatedPartUri
)
PackUriHelper
.
ValidatePartUri
(
partUri
);
if
(
_partList
.
ContainsKey
(
validatedPartUri
))
if
(
_partList
.
TryGetValue
(
validatedPartUri
,
out
PackagePart
?
value
))
{
//This will get the actual casing of the part that
//is stored in the partList which is equivalent to the
//partUri provided by the user
validatedPartUri
=
(
PackUriHelper
.
ValidatedPartUri
)
_partList
[
validatedPartUri
]
.
Uri
;
validatedPartUri
=
(
PackUriHelper
.
ValidatedPartUri
)
value
.
Uri
;
_partList
[
validatedPartUri
].
IsDeleted
=
true
;
_partList
[
validatedPartUri
].
Close
();
...
...
@@ -1125,9 +1125,9 @@ private bool DoCloseRelationshipsXml(PackagePart p)
PackUriHelper
.
ValidatedPartUri
validatePartUri
=
PackUriHelper
.
ValidatePartUri
(
partUri
);
if
(
_partList
.
ContainsKey
(
validatePartUri
))
if
(
_partList
.
TryGetValue
(
validatePartUri
,
out
PackagePart
?
value
))
{
return
_partList
[
validatePartUri
]
;
return
value
;
}
else
{
...
...
src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs
浏览文件 @
61ca87cb
...
...
@@ -606,9 +606,8 @@ internal static string ContentTypeFileName
// Need to create an override entry?
if
(
extension
.
Length
==
0
||
(
_defaultDictionary
.
ContainsKey
(
extension
)
&&
!(
foundMatchingDefault
=
_defaultDictionary
[
extension
].
AreTypeAndSubTypeEqual
(
contentType
))))
||
(
_defaultDictionary
.
TryGetValue
(
extension
,
out
ContentType
?
value
)
&&
!(
foundMatchingDefault
=
value
.
AreTypeAndSubTypeEqual
(
contentType
))))
{
AddOverrideElement
(
partUri
,
contentType
);
}
...
...
@@ -629,16 +628,16 @@ internal static string ContentTypeFileName
//partUri provided. Override takes precedence over the default entries
if
(
_overrideDictionary
!=
null
)
{
if
(
_overrideDictionary
.
ContainsKey
(
partUri
))
return
_overrideDictionary
[
partUri
]
;
if
(
_overrideDictionary
.
TryGetValue
(
partUri
,
out
ContentType
?
val
))
return
val
;
}
//Step 2: Check if there is a default entry corresponding to the
//extension of the partUri provided.
string
extension
=
partUri
.
PartUriExtension
;
if
(
_defaultDictionary
.
ContainsKey
(
extension
))
return
_defaultDictionary
[
extension
]
;
if
(
_defaultDictionary
.
TryGetValue
(
extension
,
out
ContentType
?
value
))
return
value
;
//Step 3: If we did not find an entry in the override and the default
//dictionaries, this is an error condition
...
...
src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlNodeReader.cs
浏览文件 @
61ca87cb
...
...
@@ -1027,7 +1027,7 @@ public bool MoveToElement()
if
(
scope
!=
XmlNamespaceScope
.
Local
)
{
if
(
dict
.
ContainsKey
(
string
.
Empty
)
&&
dict
[
string
.
Empty
]
==
string
.
Empty
)
if
(
dict
.
TryGetValue
(
string
.
Empty
,
out
string
?
value
)
&&
value
==
string
.
Empty
)
{
dict
.
Remove
(
string
.
Empty
);
}
...
...
src/libraries/System.Speech/src/Internal/SrgsCompiler/BackEnd.cs
浏览文件 @
61ca87cb
...
...
@@ -342,7 +342,7 @@ internal Rule FindRule(string sRule)
System
.
Diagnostics
.
Debug
.
Assert
(
dwSymbolOffset
==
0
||
_symbols
[
iWord
]
==
sRule
);
rule
=
dwSymbolOffset
>
0
&&
_nameOffsetRules
.
ContainsKey
(
dwSymbolOffset
)
?
_nameOffsetRules
[
dwSymbolOffset
]
:
null
;
rule
=
dwSymbolOffset
>
0
&&
_nameOffsetRules
.
TryGetValue
(
dwSymbolOffset
,
out
Rule
value
)
?
value
:
null
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录