Requires.NotNull-->ArgumentNullException.ThrowIfNull (#18820)

This commit is contained in:
CarloToso
2023-01-07 20:11:01 +05:00
committed by GitHub
parent 30bc32a083
commit 078866987b
3 changed files with 6 additions and 6 deletions
@@ -142,7 +142,7 @@ namespace System.Management.Automation.Subsystem.Prediction
/// <param name="history">History command lines provided as references for prediction.</param>
public static void OnCommandLineAccepted(PredictionClient client, IReadOnlyList<string> history)
{
Requires.NotNull(history, nameof(history));
ArgumentNullException.ThrowIfNull(history);
var predictors = SubsystemManager.GetSubsystems<ICommandPredictor>();
if (predictors.Count == 0)
@@ -181,8 +181,8 @@ namespace System.Management.Automation.Subsystem.Prediction
/// <param name="inputTokens">The <see cref="Token"/> objects from parsing the current command line input.</param>
public PredictionContext(Ast inputAst, Token[] inputTokens)
{
Requires.NotNull(inputAst, nameof(inputAst));
Requires.NotNull(inputTokens, nameof(inputTokens));
ArgumentNullException.ThrowIfNull(inputAst);
ArgumentNullException.ThrowIfNull(inputTokens);
var cursor = inputAst.Extent.EndScriptPosition;
var astContext = CompletionAnalysis.ExtractAstContext(inputAst, inputTokens, cursor);
@@ -131,7 +131,7 @@ namespace System.Management.Automation.Subsystem
/// <returns>The <see cref="SubsystemInfo"/> object that represents the concrete subsystem.</returns>
public static SubsystemInfo GetSubsystemInfo(Type subsystemType)
{
Requires.NotNull(subsystemType, nameof(subsystemType));
ArgumentNullException.ThrowIfNull(subsystemType);
if (s_subSystemTypeMap.TryGetValue(subsystemType, out SubsystemInfo? subsystemInfo))
{
@@ -180,7 +180,7 @@ namespace System.Management.Automation.Subsystem
where TConcreteSubsystem : class, ISubsystem
where TImplementation : class, TConcreteSubsystem
{
Requires.NotNull(proxy, nameof(proxy));
ArgumentNullException.ThrowIfNull(proxy);
RegisterSubsystem(GetSubsystemInfo(typeof(TConcreteSubsystem)), proxy);
}
@@ -192,7 +192,7 @@ namespace System.Management.Automation.Subsystem
/// <param name="proxy">An instance of the implementation.</param>
public static void RegisterSubsystem(SubsystemKind kind, ISubsystem proxy)
{
Requires.NotNull(proxy, nameof(proxy));
ArgumentNullException.ThrowIfNull(proxy);
SubsystemInfo info = GetSubsystemInfo(kind);
if (!info.SubsystemType.IsAssignableFrom(proxy.GetType()))