Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
063d0801
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
063d0801
编写于
4月 01, 2022
作者:
M
Maksym Koshovyi
提交者:
GitHub
4月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Group 5] Enable nullable annotations for `Microsoft.Extensions.Configuration.Xml` (#67178)
上级
fc7da6e5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
22 deletion
+24
-22
src/libraries/Microsoft.Extensions.Configuration.Xml/ref/Microsoft.Extensions.Configuration.Xml.cs
...uration.Xml/ref/Microsoft.Extensions.Configuration.Xml.cs
+4
-4
src/libraries/Microsoft.Extensions.Configuration.Xml/ref/Microsoft.Extensions.Configuration.Xml.csproj
...ion.Xml/ref/Microsoft.Extensions.Configuration.Xml.csproj
+1
-0
src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj
...ion.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj
+1
-0
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlConfigurationElement.cs
...tensions.Configuration.Xml/src/XmlConfigurationElement.cs
+6
-6
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlConfigurationExtensions.cs
...sions.Configuration.Xml/src/XmlConfigurationExtensions.cs
+2
-2
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs
....Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs
+3
-3
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlStreamConfigurationProvider.cs
...s.Configuration.Xml/src/XmlStreamConfigurationProvider.cs
+7
-7
未找到文件。
src/libraries/Microsoft.Extensions.Configuration.Xml/ref/Microsoft.Extensions.Configuration.Xml.cs
浏览文件 @
063d0801
...
...
@@ -8,8 +8,8 @@ namespace Microsoft.Extensions.Configuration
{
public
static
partial
class
XmlConfigurationExtensions
{
public
static
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
AddXmlFile
(
this
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
builder
,
Microsoft
.
Extensions
.
FileProviders
.
IFileProvider
provider
,
string
path
,
bool
optional
,
bool
reloadOnChange
)
{
throw
null
;
}
public
static
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
AddXmlFile
(
this
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
builder
,
System
.
Action
<
Microsoft
.
Extensions
.
Configuration
.
Xml
.
XmlConfigurationSource
>
configureSource
)
{
throw
null
;
}
public
static
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
AddXmlFile
(
this
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
builder
,
Microsoft
.
Extensions
.
FileProviders
.
IFileProvider
?
provider
,
string
path
,
bool
optional
,
bool
reloadOnChange
)
{
throw
null
;
}
public
static
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
AddXmlFile
(
this
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
builder
,
System
.
Action
<
Microsoft
.
Extensions
.
Configuration
.
Xml
.
XmlConfigurationSource
>
?
configureSource
)
{
throw
null
;
}
public
static
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
AddXmlFile
(
this
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
builder
,
string
path
)
{
throw
null
;
}
public
static
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
AddXmlFile
(
this
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
builder
,
string
path
,
bool
optional
)
{
throw
null
;
}
public
static
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
AddXmlFile
(
this
Microsoft
.
Extensions
.
Configuration
.
IConfigurationBuilder
builder
,
string
path
,
bool
optional
,
bool
reloadOnChange
)
{
throw
null
;
}
...
...
@@ -32,7 +32,7 @@ public partial class XmlDocumentDecryptor
{
public
static
readonly
Microsoft
.
Extensions
.
Configuration
.
Xml
.
XmlDocumentDecryptor
Instance
;
protected
XmlDocumentDecryptor
()
{
}
public
System
.
Xml
.
XmlReader
CreateDecryptingXmlReader
(
System
.
IO
.
Stream
input
,
System
.
Xml
.
XmlReaderSettings
settings
)
{
throw
null
;
}
public
System
.
Xml
.
XmlReader
CreateDecryptingXmlReader
(
System
.
IO
.
Stream
input
,
System
.
Xml
.
XmlReaderSettings
?
settings
)
{
throw
null
;
}
[
System
.
Runtime
.
Versioning
.
UnsupportedOSPlatform
(
"browser"
)]
protected
virtual
System
.
Xml
.
XmlReader
DecryptDocumentAndCreateXmlReader
(
System
.
Xml
.
XmlDocument
document
)
{
throw
null
;
}
}
...
...
@@ -40,7 +40,7 @@ public partial class XmlStreamConfigurationProvider : Microsoft.Extensions.Confi
{
public
XmlStreamConfigurationProvider
(
Microsoft
.
Extensions
.
Configuration
.
Xml
.
XmlStreamConfigurationSource
source
)
:
base
(
default
(
Microsoft
.
Extensions
.
Configuration
.
StreamConfigurationSource
))
{
}
public
override
void
Load
(
System
.
IO
.
Stream
stream
)
{
}
public
static
System
.
Collections
.
Generic
.
IDictionary
<
string
,
string
>
Read
(
System
.
IO
.
Stream
stream
,
Microsoft
.
Extensions
.
Configuration
.
Xml
.
XmlDocumentDecryptor
decryptor
)
{
throw
null
;
}
public
static
System
.
Collections
.
Generic
.
IDictionary
<
string
,
string
?
>
Read
(
System
.
IO
.
Stream
stream
,
Microsoft
.
Extensions
.
Configuration
.
Xml
.
XmlDocumentDecryptor
decryptor
)
{
throw
null
;
}
}
public
partial
class
XmlStreamConfigurationSource
:
Microsoft
.
Extensions
.
Configuration
.
StreamConfigurationSource
{
...
...
src/libraries/Microsoft.Extensions.Configuration.Xml/ref/Microsoft.Extensions.Configuration.Xml.csproj
浏览文件 @
063d0801
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
...
...
src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj
浏览文件 @
063d0801
...
...
@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<Nullable>enable</Nullable>
<EnableDefaultItems>true</EnableDefaultItems>
<!-- Use targeting pack references instead of granular ones in the project file. -->
<DisableImplicitAssemblyReferences>false</DisableImplicitAssemblyReferences>
...
...
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlConfigurationElement.cs
浏览文件 @
063d0801
...
...
@@ -10,7 +10,7 @@ internal sealed class XmlConfigurationElement
{
public
string
ElementName
{
get
;
}
public
string
Name
{
get
;
}
public
string
?
Name
{
get
;
}
/// <summary>
/// A composition of ElementName and Name, that serves as the basis for detecting siblings
...
...
@@ -20,18 +20,18 @@ internal sealed class XmlConfigurationElement
/// <summary>
/// The children of this element
/// </summary>
public
IDictionary
<
string
,
List
<
XmlConfigurationElement
>>
ChildrenBySiblingName
{
get
;
set
;
}
public
IDictionary
<
string
,
List
<
XmlConfigurationElement
>>
?
ChildrenBySiblingName
{
get
;
set
;
}
/// <summary>
/// Performance optimization: do not initialize a dictionary and a list for elements with a single child
/// </summary>
public
XmlConfigurationElement
SingleChild
{
get
;
set
;
}
public
XmlConfigurationElement
?
SingleChild
{
get
;
set
;
}
public
XmlConfigurationElementTextContent
TextContent
{
get
;
set
;
}
public
XmlConfigurationElementTextContent
?
TextContent
{
get
;
set
;
}
public
List
<
XmlConfigurationElementAttributeValue
>
Attributes
{
get
;
set
;
}
public
List
<
XmlConfigurationElementAttributeValue
>
?
Attributes
{
get
;
set
;
}
public
XmlConfigurationElement
(
string
elementName
!!,
string
name
)
public
XmlConfigurationElement
(
string
elementName
!!,
string
?
name
)
{
ElementName
=
elementName
;
Name
=
name
;
...
...
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlConfigurationExtensions.cs
浏览文件 @
063d0801
...
...
@@ -62,7 +62,7 @@ public static IConfigurationBuilder AddXmlFile(this IConfigurationBuilder builde
/// <param name="optional">Whether the file is optional.</param>
/// <param name="reloadOnChange">Whether the configuration should be reloaded if the file changes.</param>
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
public
static
IConfigurationBuilder
AddXmlFile
(
this
IConfigurationBuilder
builder
!!,
IFileProvider
provider
,
string
path
,
bool
optional
,
bool
reloadOnChange
)
public
static
IConfigurationBuilder
AddXmlFile
(
this
IConfigurationBuilder
builder
!!,
IFileProvider
?
provider
,
string
path
,
bool
optional
,
bool
reloadOnChange
)
{
if
(
string
.
IsNullOrEmpty
(
path
))
{
...
...
@@ -85,7 +85,7 @@ public static IConfigurationBuilder AddXmlFile(this IConfigurationBuilder builde
/// <param name="builder">The <see cref="IConfigurationBuilder"/> to add to.</param>
/// <param name="configureSource">Configures the source.</param>
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
public
static
IConfigurationBuilder
AddXmlFile
(
this
IConfigurationBuilder
builder
,
Action
<
XmlConfigurationSource
>
configureSource
)
public
static
IConfigurationBuilder
AddXmlFile
(
this
IConfigurationBuilder
builder
,
Action
<
XmlConfigurationSource
>
?
configureSource
)
=>
builder
.
Add
(
configureSource
);
/// <summary>
...
...
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlDocumentDecryptor.cs
浏览文件 @
063d0801
...
...
@@ -19,7 +19,7 @@ public class XmlDocumentDecryptor
/// </summary>
public
static
readonly
XmlDocumentDecryptor
Instance
=
new
XmlDocumentDecryptor
();
private
readonly
Func
<
XmlDocument
,
EncryptedXml
>
_encryptedXmlFactory
;
private
readonly
Func
<
XmlDocument
,
EncryptedXml
>
?
_encryptedXmlFactory
;
/// <summary>
/// Initializes a XmlDocumentDecryptor.
...
...
@@ -50,7 +50,7 @@ private static bool ContainsEncryptedData(XmlDocument document)
/// <summary>
/// Returns an XmlReader that decrypts data transparently.
/// </summary>
public
XmlReader
CreateDecryptingXmlReader
(
Stream
input
,
XmlReaderSettings
settings
)
public
XmlReader
CreateDecryptingXmlReader
(
Stream
input
,
XmlReaderSettings
?
settings
)
{
// XML-based configurations aren't really all that big, so we can buffer
// the whole thing in memory while we determine decryption operations.
...
...
@@ -98,7 +98,7 @@ protected virtual XmlReader DecryptDocumentAndCreateXmlReader(XmlDocument docume
// Finally, return the new XmlReader from the updated XmlDocument.
// Error messages based on this XmlReader won't show line numbers,
// but that's fine since we transformed the document anyway.
return
document
.
CreateNavigator
().
ReadSubtree
();
return
document
.
CreateNavigator
()
!
.
ReadSubtree
();
}
}
}
src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlStreamConfigurationProvider.cs
浏览文件 @
063d0801
...
...
@@ -29,7 +29,7 @@ public class XmlStreamConfigurationProvider : StreamConfigurationProvider
/// <param name="stream">The stream of XML data.</param>
/// <param name="decryptor">The <see cref="XmlDocumentDecryptor"/> to use to decrypt.</param>
/// <returns>The <see cref="IDictionary{String, String}"/> which was read from the stream.</returns>
public
static
IDictionary
<
string
,
string
>
Read
(
Stream
stream
,
XmlDocumentDecryptor
decryptor
)
public
static
IDictionary
<
string
,
string
?
>
Read
(
Stream
stream
,
XmlDocumentDecryptor
decryptor
)
{
var
readerSettings
=
new
XmlReaderSettings
()
{
...
...
@@ -39,7 +39,7 @@ public class XmlStreamConfigurationProvider : StreamConfigurationProvider
IgnoreWhitespace
=
true
};
XmlConfigurationElement
root
=
null
;
XmlConfigurationElement
?
root
=
null
;
using
(
XmlReader
reader
=
decryptor
.
CreateDecryptingXmlReader
(
stream
,
readerSettings
))
{
...
...
@@ -211,7 +211,7 @@ private static void ReadAttributes(XmlReader reader, XmlConfigurationElement ele
throw
new
FormatException
(
SR
.
Format
(
SR
.
Error_NamespaceIsNotSupported
,
GetLineInfo
(
reader
)));
}
element
.
Attributes
.
Add
(
new
XmlConfigurationElementAttributeValue
(
reader
.
LocalName
,
reader
.
Value
,
lineNumber
,
linePosition
));
element
.
Attributes
!
.
Add
(
new
XmlConfigurationElementAttributeValue
(
reader
.
LocalName
,
reader
.
Value
,
lineNumber
,
linePosition
));
}
// Go back to the element containing the attributes we just processed
...
...
@@ -221,9 +221,9 @@ private static void ReadAttributes(XmlReader reader, XmlConfigurationElement ele
// The special attribute "Name" only contributes to prefix
// This method retrieves the Name of the element, if the attribute is present
// Unfortunately XmlReader.GetAttribute cannot be used, as it does not support looking for attributes in a case insensitive manner
private
static
string
GetName
(
XmlReader
reader
)
private
static
string
?
GetName
(
XmlReader
reader
)
{
string
name
=
null
;
string
?
name
=
null
;
while
(
reader
.
MoveToNextAttribute
())
{
...
...
@@ -245,9 +245,9 @@ private static string GetName(XmlReader reader)
return
name
;
}
private
static
IDictionary
<
string
,
string
>
ProvideConfiguration
(
XmlConfigurationElement
root
)
private
static
IDictionary
<
string
,
string
?>
ProvideConfiguration
(
XmlConfigurationElement
?
root
)
{
var
configuration
=
new
Dictionary
<
string
,
string
>
(
StringComparer
.
OrdinalIgnoreCase
);
Dictionary
<
string
,
string
?>
configuration
=
new
(
StringComparer
.
OrdinalIgnoreCase
);
if
(
root
==
null
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录