diff --git a/src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/CommandPrediction.cs b/src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/CommandPrediction.cs index 7a87b259314..7ed70e247a5 100644 --- a/src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/CommandPrediction.cs +++ b/src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/CommandPrediction.cs @@ -142,7 +142,7 @@ await Task.WhenAny( /// History command lines provided as references for prediction. public static void OnCommandLineAccepted(PredictionClient client, IReadOnlyList history) { - Requires.NotNull(history, nameof(history)); + ArgumentNullException.ThrowIfNull(history); var predictors = SubsystemManager.GetSubsystems(); if (predictors.Count == 0) diff --git a/src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/ICommandPredictor.cs b/src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/ICommandPredictor.cs index d528067452c..95e8487bbad 100644 --- a/src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/ICommandPredictor.cs +++ b/src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/ICommandPredictor.cs @@ -181,8 +181,8 @@ public sealed class PredictionContext /// The objects from parsing the current command line input. 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); diff --git a/src/System.Management.Automation/engine/Subsystem/SubsystemManager.cs b/src/System.Management.Automation/engine/Subsystem/SubsystemManager.cs index 1af41a67457..022c163a16c 100644 --- a/src/System.Management.Automation/engine/Subsystem/SubsystemManager.cs +++ b/src/System.Management.Automation/engine/Subsystem/SubsystemManager.cs @@ -131,7 +131,7 @@ public static ReadOnlyCollection GetAllSubsystemInfo() /// The object that represents the concrete subsystem. 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 @@ public static void RegisterSubsystem(TImple 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 @@ public static void RegisterSubsystem(TImple /// An instance of the implementation. 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()))