Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable nullability on System.Xml.XPath #41060

Merged
merged 2 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class XPathException : SystemException
{
// we need to keep this members for V1 serialization compatibility
private readonly string _res;
private readonly string[]? _args;
private readonly string?[]? _args;

// message != null for V1 & V2 exceptions deserialized in Whidbey
// message == null for created V2 exceptions; the exception message is stored in Exception._message
Expand Down Expand Up @@ -60,10 +60,10 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont

public XPathException() : this(string.Empty, (Exception?)null) { }

public XPathException(string message) : this(message, (Exception?)null) { }
public XPathException(string? message) : this(message, (Exception?)null) { }

public XPathException(string message, Exception? innerException) :
this(SR.Xml_UserException, new string[] { message }, innerException)
public XPathException(string? message, Exception? innerException) :
this(SR.Xml_UserException, new string?[] { message }, innerException)
{
}

Expand Down Expand Up @@ -92,15 +92,15 @@ private XPathException(string res, string[]? args) :
{
}

private XPathException(string res, string[]? args, Exception? inner) :
private XPathException(string res, string?[]? args, Exception? inner) :
base(CreateMessage(res, args), inner)
{
HResult = HResults.XmlXPath;
_res = res;
_args = args;
}

private static string CreateMessage(string res, string[]? args)
private static string CreateMessage(string res, string?[]? args)
{
try
{
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/System.Xml.XPath/ref/System.Xml.XPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public partial class XPathException : System.SystemException
{
public XPathException() { }
protected XPathException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public XPathException(string message) { }
public XPathException(string message, System.Exception innerException) { }
public XPathException(string? message) { }
public XPathException(string? message, System.Exception? innerException) { }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
Expand Down
1 change: 1 addition & 0 deletions src/libraries/System.Xml.XPath/ref/System.Xml.XPath.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Xml.XPath.cs" />
Expand Down
1 change: 1 addition & 0 deletions src/libraries/System.Xml.XPath/src/System.Xml.XPath.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Private.Xml\src\System.Private.Xml.csproj" />
Expand Down