11// Copyright (c) Microsoft Corporation.
22// Licensed under the MIT License.
3-
3+ #nullable enable
44using System ;
55using System . Collections . Generic ;
66using System . Collections . ObjectModel ;
@@ -69,7 +69,7 @@ and not PSInvocationState.Failed
6969 pwsh . InvocationStateChanged += handler ;
7070 }
7171
72- public static Collection < TResult > InvokeAndClear < TResult > ( this PowerShell pwsh , PSInvocationSettings invocationSettings = null )
72+ public static Collection < TResult > InvokeAndClear < TResult > ( this PowerShell pwsh , PSInvocationSettings ? invocationSettings = null )
7373 {
7474 try
7575 {
@@ -81,7 +81,7 @@ public static Collection<TResult> InvokeAndClear<TResult>(this PowerShell pwsh,
8181 }
8282 }
8383
84- public static void InvokeAndClear ( this PowerShell pwsh , PSInvocationSettings invocationSettings = null )
84+ public static void InvokeAndClear ( this PowerShell pwsh , PSInvocationSettings ? invocationSettings = null )
8585 {
8686 try
8787 {
@@ -93,13 +93,13 @@ public static void InvokeAndClear(this PowerShell pwsh, PSInvocationSettings inv
9393 }
9494 }
9595
96- public static Collection < TResult > InvokeCommand < TResult > ( this PowerShell pwsh , PSCommand psCommand , PSInvocationSettings invocationSettings = null )
96+ public static Collection < TResult > InvokeCommand < TResult > ( this PowerShell pwsh , PSCommand psCommand , PSInvocationSettings ? invocationSettings = null )
9797 {
9898 pwsh . Commands = psCommand ;
9999 return pwsh . InvokeAndClear < TResult > ( invocationSettings ) ;
100100 }
101101
102- public static void InvokeCommand ( this PowerShell pwsh , PSCommand psCommand , PSInvocationSettings invocationSettings = null )
102+ public static void InvokeCommand ( this PowerShell pwsh , PSCommand psCommand , PSInvocationSettings ? invocationSettings = null )
103103 {
104104 pwsh . Commands = psCommand ;
105105 pwsh . InvokeAndClear ( invocationSettings ) ;
@@ -262,7 +262,7 @@ private static StringBuilder AddErrorString(this StringBuilder sb, ErrorRecord e
262262 . AppendLine ( "Exception:" )
263263 . Append ( " " ) . Append ( error . Exception . ToString ( ) ?? "<null>" ) ;
264264
265- Exception innerException = error . Exception ? . InnerException ;
265+ Exception ? innerException = error . Exception ? . InnerException ;
266266 while ( innerException != null )
267267 {
268268 sb . AppendLine ( "InnerException:" )
0 commit comments