From 425799d6f1756279192795962318e72c3bbaaee7 Mon Sep 17 00:00:00 2001
From: rlittlesii <6969701+RLittlesII@users.noreply.github.com>
Date: Wed, 8 May 2024 16:15:14 -0600
Subject: [PATCH 1/5] chore: enable nullability for ParameterBase
enable nullability
rename namespaces
remove unnecessary usings
---
src/Prism.Core/Common/IParameters.cs | 4 +-
src/Prism.Core/Common/ListDictionary.cs | 3 --
src/Prism.Core/Common/ParametersBase.cs | 19 ++++----
src/Prism.Core/Common/ParametersExtensions.cs | 10 +----
src/Prism.Core/Common/UriParsingHelper.cs | 44 ++++---------------
.../Common/UriParsingHelperFixture.cs | 13 +++---
.../Common/ListDictionaryFixture.cs | 4 +-
.../Prism.Core.Tests/Common/Mocks/MockEnum.cs | 2 +-
.../Common/Mocks/MockParameters.cs | 4 +-
.../MulticastExceptionHandlerFixture.cs | 5 +--
.../Common/ParametersFixture.cs | 9 ++--
11 files changed, 36 insertions(+), 81 deletions(-)
diff --git a/src/Prism.Core/Common/IParameters.cs b/src/Prism.Core/Common/IParameters.cs
index 4fa05b4cc1..4f1d544d9e 100644
--- a/src/Prism.Core/Common/IParameters.cs
+++ b/src/Prism.Core/Common/IParameters.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
+#nullable enable
namespace Prism.Common
{
///
@@ -65,6 +65,6 @@ public interface IParameters : IEnumerable>
///
/// The key of the parameter to get.
/// A matching value if it exists.
- object this[string key] { get; }
+ object? this[string key] { get; }
}
}
diff --git a/src/Prism.Core/Common/ListDictionary.cs b/src/Prism.Core/Common/ListDictionary.cs
index 4c21b370e9..99d8293f60 100644
--- a/src/Prism.Core/Common/ListDictionary.cs
+++ b/src/Prism.Core/Common/ListDictionary.cs
@@ -1,6 +1,3 @@
-using System;
-using System.Collections.Generic;
-
namespace Prism.Common
{
///
diff --git a/src/Prism.Core/Common/ParametersBase.cs b/src/Prism.Core/Common/ParametersBase.cs
index 077ff736af..3814e290ce 100644
--- a/src/Prism.Core/Common/ParametersBase.cs
+++ b/src/Prism.Core/Common/ParametersBase.cs
@@ -1,11 +1,8 @@
-using System;
using System.Collections;
-using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
-using System.Linq;
using System.Text;
-
+#nullable enable
namespace Prism.Common
{
///
@@ -13,7 +10,7 @@ namespace Prism.Common
///
public abstract class ParametersBase : IParameters
{
- private readonly List> _entries = [];
+ private readonly List> _entries = [];
///
/// Default constructor.
@@ -51,7 +48,7 @@ protected ParametersBase(string query)
}
i++;
}
- string key = null;
+ string? key = null;
string value;
if (num4 >= 0)
{
@@ -75,7 +72,7 @@ protected ParametersBase(string query)
///
/// The key for the value to be returned.
/// The value of the parameter referenced by the key; otherwise null.
- public object this[string key]
+ public object? this[string key]
{
get
{
@@ -108,7 +105,7 @@ public object this[string key]
/// The key to reference this value in the parameters collection.
/// The value of the parameter to store.
public void Add(string key, object value) =>
- _entries.Add(new KeyValuePair(key, value));
+ _entries.Add(new KeyValuePair(key, value));
///
/// Checks collection for presence of key.
@@ -122,7 +119,7 @@ public bool ContainsKey(string key) =>
/// Gets an enumerator for the KeyValuePairs in parameter collection.
///
/// Enumerator.
- public IEnumerator> GetEnumerator() =>
+ public IEnumerator> GetEnumerator() =>
_entries.GetEnumerator();
///
@@ -181,7 +178,7 @@ public override string ToString()
queryBuilder.Append(Uri.EscapeDataString(kvp.Key));
queryBuilder.Append('=');
- queryBuilder.Append(Uri.EscapeDataString(kvp.Value?.ToString() is string str ? str : string.Empty));
+ queryBuilder.Append(Uri.EscapeDataString(kvp.Value?.ToString() ?? string.Empty));
}
}
@@ -193,7 +190,7 @@ public override string ToString()
///
/// An IEnumerable of KeyValuePairs to add to the current parameter list.
[EditorBrowsable(EditorBrowsableState.Never)]
- public void FromParameters(IEnumerable> parameters) =>
+ public void FromParameters(IEnumerable> parameters) =>
_entries.AddRange(parameters);
}
}
diff --git a/src/Prism.Core/Common/ParametersExtensions.cs b/src/Prism.Core/Common/ParametersExtensions.cs
index 2f6f56d1e9..c34b45895d 100644
--- a/src/Prism.Core/Common/ParametersExtensions.cs
+++ b/src/Prism.Core/Common/ParametersExtensions.cs
@@ -1,3 +1,4 @@
+#nullable enable
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -156,13 +157,6 @@ private static bool TryGetValueInternal(KeyValuePair kvp, Type t
public static bool ContainsKey(this IEnumerable> parameters, string key) =>
parameters.Any(x => string.Compare(x.Key, key, StringComparison.Ordinal) == 0);
- private static object GetDefault(Type type)
- {
- if (type.IsValueType)
- {
- return Activator.CreateInstance(type);
- }
- return null;
- }
+ private static object? GetDefault(Type type) => type.IsValueType ? Activator.CreateInstance(type) : null;
}
}
diff --git a/src/Prism.Core/Common/UriParsingHelper.cs b/src/Prism.Core/Common/UriParsingHelper.cs
index f768ac1059..8e9acb165d 100644
--- a/src/Prism.Core/Common/UriParsingHelper.cs
+++ b/src/Prism.Core/Common/UriParsingHelper.cs
@@ -1,8 +1,7 @@
-using System;
-using System.Collections.Generic;
using Prism.Dialogs;
using Prism.Navigation;
+#nullable enable
namespace Prism.Common
{
///
@@ -10,7 +9,7 @@ namespace Prism.Common
///
public static class UriParsingHelper
{
- private static readonly char[] _pathDelimiter = { '/' };
+ private static readonly char[] _pathDelimiter = ['/'];
///
/// Gets the Uri segments from a deep linked Navigation Uri
@@ -40,10 +39,7 @@ public static Queue GetUriSegments(Uri uri)
///
/// A Navigation Segment
/// The navigation segment name from the provided segment.
- public static string GetSegmentName(string segment)
- {
- return segment.Split('?')[0];
- }
+ public static string GetSegmentName(string segment) => segment.Split('?')[0];
///
/// Gets the Segment Parameters from a Navigation Segment that may contain a querystring
@@ -72,7 +68,7 @@ public static INavigationParameters GetSegmentParameters(string segment)
/// The segment
/// The existing .
/// The combined .
- public static INavigationParameters GetSegmentParameters(string uriSegment, INavigationParameters parameters)
+ public static INavigationParameters GetSegmentParameters(string uriSegment, INavigationParameters? parameters)
{
var navParameters = GetSegmentParameters(uriSegment);
@@ -114,7 +110,7 @@ public static IDialogParameters GetSegmentDialogParameters(string segment)
/// A navigation segment which may contain a querystring.
/// Existing .
///
- public static IDialogParameters GetSegmentParameters(string uriSegment, IDialogParameters parameters)
+ public static IDialogParameters GetSegmentParameters(string uriSegment, IDialogParameters? parameters)
{
var dialogParameters = GetSegmentDialogParameters(uriSegment);
@@ -133,19 +129,13 @@ public static IDialogParameters GetSegmentParameters(string uriSegment, IDialogP
/// Gets the query part of .
///
/// The Uri.
- public static string GetQuery(Uri uri)
- {
- return EnsureAbsolute(uri).Query;
- }
+ public static string GetQuery(Uri uri) => EnsureAbsolute(uri).Query;
///
/// Gets the AbsolutePath part of .
///
/// The Uri.
- public static string GetAbsolutePath(Uri uri)
- {
- return EnsureAbsolute(uri).AbsolutePath;
- }
+ public static string GetAbsolutePath(Uri uri) => EnsureAbsolute(uri).AbsolutePath;
///
/// Parses the query of into a dictionary.
@@ -164,19 +154,7 @@ public static INavigationParameters ParseQuery(Uri uri)
/// A uri string.
/// A .
/// Throws an when the string is null or empty.
- public static Uri Parse(string uri)
- {
- if (uri == null) throw new ArgumentNullException(nameof(uri));
-
- if (uri.StartsWith("/", StringComparison.Ordinal))
- {
- return new Uri("http://localhost" + uri, UriKind.Absolute);
- }
- else
- {
- return new Uri(uri, UriKind.RelativeOrAbsolute);
- }
- }
+ public static Uri Parse(string uri) => uri.StartsWith("/", StringComparison.Ordinal) ? new Uri("http://localhost" + uri, UriKind.Absolute) : new Uri(uri, UriKind.RelativeOrAbsolute);
///
/// This will provide the existing if it is already Absolute, otherwise
@@ -191,11 +169,7 @@ public static Uri EnsureAbsolute(Uri uri)
return uri;
}
- if ((uri != null) && !uri.OriginalString.StartsWith("/", StringComparison.Ordinal))
- {
- return new Uri("http://localhost/" + uri, UriKind.Absolute);
- }
- return new Uri("http://localhost" + uri, UriKind.Absolute);
+ return !uri.OriginalString.StartsWith("/", StringComparison.Ordinal) ? new Uri("http://localhost/" + uri, UriKind.Absolute) : new Uri("http://localhost" + uri, UriKind.Absolute);
}
}
}
diff --git a/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs b/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs
index a39e5d1750..ef509897fd 100644
--- a/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs
+++ b/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs
@@ -1,8 +1,7 @@
-using System;
-using Prism.Common;
+using Prism.Common;
namespace Prism.Maui.Tests.Fixtures.Common;
-
+#nullable enable
public class UriParsingHelperFixture
{
const string _relativeUri = "MainPage?id=3&name=dan";
@@ -14,7 +13,7 @@ public class UriParsingHelperFixture
[Fact]
public void ParametersParsedFromNullSegment()
{
- var parameters = UriParsingHelper.GetSegmentParameters(null);
+ var parameters = UriParsingHelper.GetSegmentParameters(null!);
Assert.NotNull(parameters);
}
@@ -62,7 +61,7 @@ public void ParametersParsedFromNavigationParametersInRelativeUri()
{ "name", "dan" }
};
- var parameters = UriParsingHelper.GetSegmentParameters("MainPage" + navParameters.ToString());
+ var parameters = UriParsingHelper.GetSegmentParameters("MainPage" + navParameters);
Assert.NotEmpty(parameters);
@@ -82,7 +81,7 @@ public void ParametersParsedFromNavigationParametersInAbsoluteUri()
{ "name", "dan" }
};
- var parameters = UriParsingHelper.GetSegmentParameters("http://www.dansiegel.net/MainPage" + navParameters.ToString());
+ var parameters = UriParsingHelper.GetSegmentParameters("http://www.dansiegel.net/MainPage" + navParameters);
Assert.NotEmpty(parameters);
@@ -177,7 +176,7 @@ public void EnsureAbsoluteUriForAbsoluteUri()
[Fact]
public void ParseForNull()
{
- var actual = Assert.Throws(() => UriParsingHelper.Parse(null));
+ var actual = Assert.Throws(() => UriParsingHelper.Parse(null!));
Assert.NotNull(actual);
Assert.Equal("uri", actual.ParamName);
}
diff --git a/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs b/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs
index eb25cc801e..294ca98de6 100644
--- a/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs
+++ b/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs
@@ -1,9 +1,7 @@
-using System;
-using System.Collections.Generic;
using Prism.Common;
using Xunit;
-namespace Prism.Wpf.Tests
+namespace Prism.Core.Tests.Common
{
public class ListDictionaryFixture
diff --git a/tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs b/tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs
index 74ebae993b..7e952e91f7 100644
--- a/tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs
+++ b/tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs
@@ -1,4 +1,4 @@
-namespace Prism.Tests.Common.Mocks
+namespace Prism.Core.Tests.Common.Mocks
{
internal enum MockEnum
{
diff --git a/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs b/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs
index 671f990144..e8eb52bc64 100644
--- a/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs
+++ b/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs
@@ -1,10 +1,10 @@
using Prism.Common;
-namespace Prism.Tests.Common.Mocks
+namespace Prism.Core.Tests.Common.Mocks
{
internal class MockParameters : ParametersBase
{
- public MockParameters() : base() { }
+ public MockParameters() { }
public MockParameters(string query) : base(query) { }
}
}
diff --git a/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs b/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs
index d5b7026fcf..dde56ef560 100644
--- a/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs
+++ b/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs
@@ -1,7 +1,4 @@
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using Prism.Common;
+using Prism.Common;
using Xunit;
namespace Prism.Core.Tests.Common;
diff --git a/tests/Prism.Core.Tests/Common/ParametersFixture.cs b/tests/Prism.Core.Tests/Common/ParametersFixture.cs
index abd2aa8cf0..caeae3509a 100644
--- a/tests/Prism.Core.Tests/Common/ParametersFixture.cs
+++ b/tests/Prism.Core.Tests/Common/ParametersFixture.cs
@@ -1,9 +1,8 @@
-using System.Collections.Generic;
-using System.Linq;
-using Prism.Tests.Common.Mocks;
+#nullable enable
+using Prism.Core.Tests.Common.Mocks;
using Xunit;
-namespace Prism.Tests.Common
+namespace Prism.Core.Tests.Common
{
public class ParametersFixture
{
@@ -28,7 +27,7 @@ public void GetValuesOfT()
{
var parameters = new MockParameters("mock=Foo&mock=2&mock=Fizz");
- IEnumerable values = default;
+ IEnumerable values = Enumerable.Empty();
var ex = Record.Exception(() => values = parameters.GetValues("mock"));
Assert.Null(ex);
From fa65a644eb116625b29c35803bec7fc19d850cb7 Mon Sep 17 00:00:00 2001
From: rlittlesii <6969701+RLittlesII@users.noreply.github.com>
Date: Wed, 8 May 2024 16:44:08 -0600
Subject: [PATCH 2/5] verifying GetSegmentName
---
src/Prism.Core/Common/UriParsingHelper.cs | 11 +++++++++--
.../Fixtures/Common/UriParsingHelperFixture.cs | 7 +++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/Prism.Core/Common/UriParsingHelper.cs b/src/Prism.Core/Common/UriParsingHelper.cs
index 8e9acb165d..3f3ad1db8d 100644
--- a/src/Prism.Core/Common/UriParsingHelper.cs
+++ b/src/Prism.Core/Common/UriParsingHelper.cs
@@ -72,7 +72,7 @@ public static INavigationParameters GetSegmentParameters(string uriSegment, INav
{
var navParameters = GetSegmentParameters(uriSegment);
- if (parameters != null)
+ if (parameters is not null)
{
foreach (KeyValuePair navigationParameter in parameters)
{
@@ -154,7 +154,14 @@ public static INavigationParameters ParseQuery(Uri uri)
/// A uri string.
/// A .
/// Throws an when the string is null or empty.
- public static Uri Parse(string uri) => uri.StartsWith("/", StringComparison.Ordinal) ? new Uri("http://localhost" + uri, UriKind.Absolute) : new Uri(uri, UriKind.RelativeOrAbsolute);
+ public static Uri Parse(string uri)
+ {
+ ArgumentNullException.ThrowIfNull(uri);
+
+ return uri.StartsWith("/", StringComparison.Ordinal)
+ ? new Uri("http://localhost" + uri, UriKind.Absolute)
+ : new Uri(uri, UriKind.RelativeOrAbsolute);
+ }
///
/// This will provide the existing if it is already Absolute, otherwise
diff --git a/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs b/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs
index ef509897fd..2327ac37fd 100644
--- a/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs
+++ b/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs
@@ -92,6 +92,13 @@ public void ParametersParsedFromNavigationParametersInAbsoluteUri()
Assert.Equal("dan", parameters["name"]);
}
+ [Fact]
+ public void TargetNameParsedFromEmptySegment()
+ {
+ var target = UriParsingHelper.GetSegmentName(string.Empty);
+ Assert.Equal(string.Empty, target);
+ }
+
[Fact]
public void TargetNameParsedFromSingleSegment()
{
From 25281cfc58c5c0bc2b369831d74b5b1d469e3807 Mon Sep 17 00:00:00 2001
From: rlittlesii <6969701+RLittlesII@users.noreply.github.com>
Date: Wed, 8 May 2024 16:46:34 -0600
Subject: [PATCH 3/5] correcting test namespaces, again
---
tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs | 2 +-
tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs | 2 +-
tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs | 2 +-
.../Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs | 2 +-
tests/Prism.Core.Tests/Common/ParametersFixture.cs | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs b/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs
index 294ca98de6..91f4ffb518 100644
--- a/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs
+++ b/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs
@@ -1,7 +1,7 @@
using Prism.Common;
using Xunit;
-namespace Prism.Core.Tests.Common
+namespace Prism.Tests.Common
{
public class ListDictionaryFixture
diff --git a/tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs b/tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs
index 7e952e91f7..74ebae993b 100644
--- a/tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs
+++ b/tests/Prism.Core.Tests/Common/Mocks/MockEnum.cs
@@ -1,4 +1,4 @@
-namespace Prism.Core.Tests.Common.Mocks
+namespace Prism.Tests.Common.Mocks
{
internal enum MockEnum
{
diff --git a/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs b/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs
index e8eb52bc64..b59252be1c 100644
--- a/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs
+++ b/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs
@@ -1,6 +1,6 @@
using Prism.Common;
-namespace Prism.Core.Tests.Common.Mocks
+namespace Prism.Tests.Common.Mocks
{
internal class MockParameters : ParametersBase
{
diff --git a/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs b/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs
index dde56ef560..65d756fd48 100644
--- a/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs
+++ b/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs
@@ -1,7 +1,7 @@
using Prism.Common;
using Xunit;
-namespace Prism.Core.Tests.Common;
+namespace Prism.Tests.Common;
#nullable enable
public class MulticastExceptionHandlerFixture
diff --git a/tests/Prism.Core.Tests/Common/ParametersFixture.cs b/tests/Prism.Core.Tests/Common/ParametersFixture.cs
index caeae3509a..1c3cdde6d7 100644
--- a/tests/Prism.Core.Tests/Common/ParametersFixture.cs
+++ b/tests/Prism.Core.Tests/Common/ParametersFixture.cs
@@ -2,7 +2,7 @@
using Prism.Core.Tests.Common.Mocks;
using Xunit;
-namespace Prism.Core.Tests.Common
+namespace Prism.Tests.Common
{
public class ParametersFixture
{
From 64cb528871528fb4447a413dafdcaae7cdc75b44 Mon Sep 17 00:00:00 2001
From: rlittlesii <6969701+RLittlesII@users.noreply.github.com>
Date: Wed, 8 May 2024 16:47:50 -0600
Subject: [PATCH 4/5] empty is empty
---
tests/Prism.Core.Tests/Common/ParametersFixture.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Prism.Core.Tests/Common/ParametersFixture.cs b/tests/Prism.Core.Tests/Common/ParametersFixture.cs
index 1c3cdde6d7..ae629460dd 100644
--- a/tests/Prism.Core.Tests/Common/ParametersFixture.cs
+++ b/tests/Prism.Core.Tests/Common/ParametersFixture.cs
@@ -1,5 +1,5 @@
#nullable enable
-using Prism.Core.Tests.Common.Mocks;
+using Prism.Tests.Common.Mocks;
using Xunit;
namespace Prism.Tests.Common
@@ -27,7 +27,7 @@ public void GetValuesOfT()
{
var parameters = new MockParameters("mock=Foo&mock=2&mock=Fizz");
- IEnumerable values = Enumerable.Empty();
+ IEnumerable values = [];
var ex = Record.Exception(() => values = parameters.GetValues("mock"));
Assert.Null(ex);
From a0bff20558d179afae154bb986acdcd573a5107a Mon Sep 17 00:00:00 2001
From: rlittlesii <6969701+RLittlesII@users.noreply.github.com>
Date: Wed, 8 May 2024 17:04:25 -0600
Subject: [PATCH 5/5] netstandard2.0 is THE best
---
src/Prism.Core/Common/UriParsingHelper.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Prism.Core/Common/UriParsingHelper.cs b/src/Prism.Core/Common/UriParsingHelper.cs
index 3f3ad1db8d..e13dbcf7a6 100644
--- a/src/Prism.Core/Common/UriParsingHelper.cs
+++ b/src/Prism.Core/Common/UriParsingHelper.cs
@@ -156,7 +156,10 @@ public static INavigationParameters ParseQuery(Uri uri)
/// Throws an when the string is null or empty.
public static Uri Parse(string uri)
{
- ArgumentNullException.ThrowIfNull(uri);
+ if (uri == null)
+ {
+ throw new ArgumentNullException(nameof(uri));
+ }
return uri.StartsWith("/", StringComparison.Ordinal)
? new Uri("http://localhost" + uri, UriKind.Absolute)